strapi-plugin-oidc 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,7 +54,7 @@ const index = {
54
54
  defaultMessage: "Configuration"
55
55
  },
56
56
  Component: async () => {
57
- return await import("./index-V4-lA3hu.mjs");
57
+ return await import("./index-CINLwPy3.mjs");
58
58
  },
59
59
  permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }]
60
60
  }
@@ -79,9 +79,12 @@ const index = {
79
79
  const interceptHistory = (originalMethod) => {
80
80
  return function(...args) {
81
81
  const url = args[2];
82
- if (url && typeof url === "string" && url.endsWith("/auth/login")) {
83
- window.location.href = "/strapi-plugin-oidc/oidc";
84
- return;
82
+ if (url && typeof url === "string") {
83
+ const urlWithoutQuery = url.split("?")[0].split("#")[0];
84
+ if (urlWithoutQuery.endsWith("/auth/login")) {
85
+ window.location.href = "/strapi-plugin-oidc/oidc";
86
+ return;
87
+ }
85
88
  }
86
89
  return originalMethod.apply(window.history, args);
87
90
  };
@@ -7,7 +7,7 @@ const react = require("react");
7
7
  const designSystem = require("@strapi/design-system");
8
8
  const icons = require("@strapi/icons");
9
9
  const reactIntl = require("react-intl");
10
- const index = require("./index-Bc2bQNhu.js");
10
+ const index = require("./index-Cq1ERJUV.js");
11
11
  const en = require("./en-8UlbiAHW.js");
12
12
  const styled = require("styled-components");
13
13
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
@@ -5,7 +5,7 @@ import { useState, useCallback, useEffect, memo } from "react";
5
5
  import { Typography, Flex, Box, MultiSelect, MultiSelectOption, Field, Button, Divider, Thead, Tr, Th, Tbody, Td, Dialog, IconButton, Pagination, PreviousLink, PageLink, NextLink, Table, Alert } from "@strapi/design-system";
6
6
  import { Plus, Trash, WarningCircle } from "@strapi/icons";
7
7
  import { useIntl } from "react-intl";
8
- import { p as pluginId } from "./index-Cz9Q6j4e.mjs";
8
+ import { p as pluginId } from "./index-BADTLgSt.mjs";
9
9
  import en from "./en-DInn-mdh.mjs";
10
10
  import styled from "styled-components";
11
11
  function getTrad(id) {
@@ -55,7 +55,7 @@ const index = {
55
55
  defaultMessage: "Configuration"
56
56
  },
57
57
  Component: async () => {
58
- return await Promise.resolve().then(() => require("./index-DNIqscJT.js"));
58
+ return await Promise.resolve().then(() => require("./index-C762D8BZ.js"));
59
59
  },
60
60
  permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }]
61
61
  }
@@ -80,9 +80,12 @@ const index = {
80
80
  const interceptHistory = (originalMethod) => {
81
81
  return function(...args) {
82
82
  const url = args[2];
83
- if (url && typeof url === "string" && url.endsWith("/auth/login")) {
84
- window.location.href = "/strapi-plugin-oidc/oidc";
85
- return;
83
+ if (url && typeof url === "string") {
84
+ const urlWithoutQuery = url.split("?")[0].split("#")[0];
85
+ if (urlWithoutQuery.endsWith("/auth/login")) {
86
+ window.location.href = "/strapi-plugin-oidc/oidc";
87
+ return;
88
+ }
86
89
  }
87
90
  return originalMethod.apply(window.history, args);
88
91
  };
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const index = require("./index-Bc2bQNhu.js");
3
+ const index = require("./index-Cq1ERJUV.js");
4
4
  exports.default = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "./index-Cz9Q6j4e.mjs";
1
+ import { i } from "./index-BADTLgSt.mjs";
2
2
  export {
3
3
  i as default
4
4
  };
@@ -11,6 +11,30 @@ const generator__default = /* @__PURE__ */ _interopDefault(generator);
11
11
  function register$1() {
12
12
  }
13
13
  async function bootstrap({ strapi: strapi2 }) {
14
+ strapi2.server.use(async (ctx, next) => {
15
+ if (ctx.request.path === "/admin/login" && ctx.request.method === "POST") {
16
+ try {
17
+ const whitelistService2 = strapi2.plugin("strapi-plugin-oidc").service("whitelist");
18
+ const settings = await whitelistService2.getSettings();
19
+ if (settings && settings.enforceOIDC) {
20
+ ctx.status = 403;
21
+ ctx.body = {
22
+ data: null,
23
+ error: {
24
+ status: 403,
25
+ name: "ForbiddenError",
26
+ message: "Local login is disabled. Please use OIDC.",
27
+ details: {}
28
+ }
29
+ };
30
+ return;
31
+ }
32
+ } catch (err) {
33
+ strapi2.log.error("Error checking OIDC enforcement in middleware:", err);
34
+ }
35
+ }
36
+ await next();
37
+ });
14
38
  const actions = [
15
39
  {
16
40
  section: "plugins",
@@ -481,7 +505,7 @@ const routes = [
481
505
  handler: "oidc.oidcSignIn",
482
506
  config: {
483
507
  auth: false,
484
- middlewares: [rateLimitMiddleware]
508
+ middlewares: [rateLimitMiddleware, "strapi::session"]
485
509
  }
486
510
  },
487
511
  {
@@ -490,7 +514,7 @@ const routes = [
490
514
  handler: "oidc.oidcSignInCallback",
491
515
  config: {
492
516
  auth: false,
493
- middlewares: [rateLimitMiddleware]
517
+ middlewares: [rateLimitMiddleware, "strapi::session"]
494
518
  }
495
519
  },
496
520
  {
@@ -5,6 +5,30 @@ import generator from "generate-password";
5
5
  function register$1() {
6
6
  }
7
7
  async function bootstrap({ strapi: strapi2 }) {
8
+ strapi2.server.use(async (ctx, next) => {
9
+ if (ctx.request.path === "/admin/login" && ctx.request.method === "POST") {
10
+ try {
11
+ const whitelistService2 = strapi2.plugin("strapi-plugin-oidc").service("whitelist");
12
+ const settings = await whitelistService2.getSettings();
13
+ if (settings && settings.enforceOIDC) {
14
+ ctx.status = 403;
15
+ ctx.body = {
16
+ data: null,
17
+ error: {
18
+ status: 403,
19
+ name: "ForbiddenError",
20
+ message: "Local login is disabled. Please use OIDC.",
21
+ details: {}
22
+ }
23
+ };
24
+ return;
25
+ }
26
+ } catch (err) {
27
+ strapi2.log.error("Error checking OIDC enforcement in middleware:", err);
28
+ }
29
+ }
30
+ await next();
31
+ });
8
32
  const actions = [
9
33
  {
10
34
  section: "plugins",
@@ -475,7 +499,7 @@ const routes = [
475
499
  handler: "oidc.oidcSignIn",
476
500
  config: {
477
501
  auth: false,
478
- middlewares: [rateLimitMiddleware]
502
+ middlewares: [rateLimitMiddleware, "strapi::session"]
479
503
  }
480
504
  },
481
505
  {
@@ -484,7 +508,7 @@ const routes = [
484
508
  handler: "oidc.oidcSignInCallback",
485
509
  config: {
486
510
  auth: false,
487
- middlewares: [rateLimitMiddleware]
511
+ middlewares: [rateLimitMiddleware, "strapi::session"]
488
512
  }
489
513
  },
490
514
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-oidc",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "A Strapi plugin that provides OpenID Connect (OIDC) authentication functionality for the Strapi Admin Panel.",
5
5
  "strapi": {
6
6
  "displayName": "OIDC Plugin",
@@ -63,8 +63,8 @@
63
63
  }
64
64
  ],
65
65
  "engines": {
66
- "node": ">=20.0.0 <=24.x.x",
67
- "npm": ">=6.0.0"
66
+ "node": ">=22.0.0 <=22.x.x",
67
+ "npm": "10.x.x"
68
68
  },
69
69
  "files": [
70
70
  "dist"