strapi-plugin-oidc 1.1.0 → 1.1.2
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.
- package/dist/admin/{index-DjcgmYQl.js → index-Csm9fJS0.js} +13 -2
- package/dist/admin/{index-CILUKj10.mjs → index-DDUvU8_H.mjs} +1 -1
- package/dist/admin/{index-QgIxjc0g.mjs → index-DxsqJhUk.mjs} +13 -2
- package/dist/admin/{index-BEJGt6t1.js → index-aBuEmqza.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +8 -3
- package/dist/server/index.mjs +8 -3
- package/package.json +3 -3
|
@@ -55,7 +55,7 @@ const index = {
|
|
|
55
55
|
defaultMessage: "Configuration"
|
|
56
56
|
},
|
|
57
57
|
Component: async () => {
|
|
58
|
-
return await Promise.resolve().then(() => require("./index-
|
|
58
|
+
return await Promise.resolve().then(() => require("./index-aBuEmqza.js"));
|
|
59
59
|
},
|
|
60
60
|
permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }]
|
|
61
61
|
}
|
|
@@ -80,7 +80,10 @@ const index = {
|
|
|
80
80
|
const url = args[2];
|
|
81
81
|
if (url && typeof url === "string") {
|
|
82
82
|
const urlWithoutQuery = url.split("?")[0].split("#")[0];
|
|
83
|
-
if (isAuthRoute(urlWithoutQuery)
|
|
83
|
+
if (isAuthRoute(urlWithoutQuery)) {
|
|
84
|
+
if (isLogoutInProgress) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
84
87
|
window.location.href = "/strapi-plugin-oidc/oidc";
|
|
85
88
|
return;
|
|
86
89
|
}
|
|
@@ -106,6 +109,14 @@ const index = {
|
|
|
106
109
|
}
|
|
107
110
|
const response = await originalFetch(...args);
|
|
108
111
|
if (isLogout && response.ok) {
|
|
112
|
+
window.localStorage.removeItem("jwtToken");
|
|
113
|
+
window.localStorage.removeItem("isLoggedIn");
|
|
114
|
+
window.sessionStorage.removeItem("jwtToken");
|
|
115
|
+
window.sessionStorage.removeItem("isLoggedIn");
|
|
116
|
+
document.cookie = "jwtToken=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/";
|
|
117
|
+
document.cookie = "jwtToken=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/admin";
|
|
118
|
+
document.cookie = "strapi_admin_refresh=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/";
|
|
119
|
+
document.cookie = "strapi_admin_refresh=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/admin";
|
|
109
120
|
window.location.href = "/strapi-plugin-oidc/logout";
|
|
110
121
|
return new Promise(() => {
|
|
111
122
|
});
|
|
@@ -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-
|
|
8
|
+
import { p as pluginId } from "./index-DxsqJhUk.mjs";
|
|
9
9
|
import en from "./en-DInn-mdh.mjs";
|
|
10
10
|
import styled from "styled-components";
|
|
11
11
|
function getTrad(id) {
|
|
@@ -54,7 +54,7 @@ const index = {
|
|
|
54
54
|
defaultMessage: "Configuration"
|
|
55
55
|
},
|
|
56
56
|
Component: async () => {
|
|
57
|
-
return await import("./index-
|
|
57
|
+
return await import("./index-DDUvU8_H.mjs");
|
|
58
58
|
},
|
|
59
59
|
permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }]
|
|
60
60
|
}
|
|
@@ -79,7 +79,10 @@ const index = {
|
|
|
79
79
|
const url = args[2];
|
|
80
80
|
if (url && typeof url === "string") {
|
|
81
81
|
const urlWithoutQuery = url.split("?")[0].split("#")[0];
|
|
82
|
-
if (isAuthRoute(urlWithoutQuery)
|
|
82
|
+
if (isAuthRoute(urlWithoutQuery)) {
|
|
83
|
+
if (isLogoutInProgress) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
83
86
|
window.location.href = "/strapi-plugin-oidc/oidc";
|
|
84
87
|
return;
|
|
85
88
|
}
|
|
@@ -105,6 +108,14 @@ const index = {
|
|
|
105
108
|
}
|
|
106
109
|
const response = await originalFetch(...args);
|
|
107
110
|
if (isLogout && response.ok) {
|
|
111
|
+
window.localStorage.removeItem("jwtToken");
|
|
112
|
+
window.localStorage.removeItem("isLoggedIn");
|
|
113
|
+
window.sessionStorage.removeItem("jwtToken");
|
|
114
|
+
window.sessionStorage.removeItem("isLoggedIn");
|
|
115
|
+
document.cookie = "jwtToken=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/";
|
|
116
|
+
document.cookie = "jwtToken=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/admin";
|
|
117
|
+
document.cookie = "strapi_admin_refresh=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/";
|
|
118
|
+
document.cookie = "strapi_admin_refresh=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/admin";
|
|
108
119
|
window.location.href = "/strapi-plugin-oidc/logout";
|
|
109
120
|
return new Promise(() => {
|
|
110
121
|
});
|
|
@@ -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-
|
|
10
|
+
const index = require("./index-Csm9fJS0.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 };
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const generator__default = /* @__PURE__ */ _interopDefault(generator);
|
|
|
11
11
|
function register$1() {
|
|
12
12
|
}
|
|
13
13
|
async function bootstrap({ strapi: strapi2 }) {
|
|
14
|
-
|
|
14
|
+
const enforceOidcMiddleware = async (ctx, next) => {
|
|
15
15
|
const adminUrl = strapi2.config.get("admin.url", "/admin");
|
|
16
16
|
const authRoutes = [
|
|
17
17
|
`${adminUrl}/login`,
|
|
@@ -20,7 +20,7 @@ async function bootstrap({ strapi: strapi2 }) {
|
|
|
20
20
|
`${adminUrl}/reset-password`
|
|
21
21
|
];
|
|
22
22
|
const isPostAuth = authRoutes.includes(ctx.request.path) && ctx.request.method === "POST";
|
|
23
|
-
const isHtmlRequest = ctx.request.accepts("html") && !ctx.request.path.match(/\.[a-zA-Z0-9]+$/);
|
|
23
|
+
const isHtmlRequest = ctx.request.accepts("html", "json") === "html" && !ctx.request.path.match(/\.[a-zA-Z0-9]+$/);
|
|
24
24
|
const isGetAdminHtml = ctx.request.method === "GET" && ctx.request.path.startsWith(adminUrl) && isHtmlRequest;
|
|
25
25
|
if (isPostAuth || isGetAdminHtml) {
|
|
26
26
|
try {
|
|
@@ -53,7 +53,12 @@ async function bootstrap({ strapi: strapi2 }) {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
await next();
|
|
56
|
-
}
|
|
56
|
+
};
|
|
57
|
+
if (strapi2.server.app && Array.isArray(strapi2.server.app.middleware)) {
|
|
58
|
+
strapi2.server.app.middleware.unshift(enforceOidcMiddleware);
|
|
59
|
+
} else {
|
|
60
|
+
strapi2.server.use(enforceOidcMiddleware);
|
|
61
|
+
}
|
|
57
62
|
const actions = [
|
|
58
63
|
{
|
|
59
64
|
section: "plugins",
|
package/dist/server/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import generator from "generate-password";
|
|
|
5
5
|
function register$1() {
|
|
6
6
|
}
|
|
7
7
|
async function bootstrap({ strapi: strapi2 }) {
|
|
8
|
-
|
|
8
|
+
const enforceOidcMiddleware = async (ctx, next) => {
|
|
9
9
|
const adminUrl = strapi2.config.get("admin.url", "/admin");
|
|
10
10
|
const authRoutes = [
|
|
11
11
|
`${adminUrl}/login`,
|
|
@@ -14,7 +14,7 @@ async function bootstrap({ strapi: strapi2 }) {
|
|
|
14
14
|
`${adminUrl}/reset-password`
|
|
15
15
|
];
|
|
16
16
|
const isPostAuth = authRoutes.includes(ctx.request.path) && ctx.request.method === "POST";
|
|
17
|
-
const isHtmlRequest = ctx.request.accepts("html") && !ctx.request.path.match(/\.[a-zA-Z0-9]+$/);
|
|
17
|
+
const isHtmlRequest = ctx.request.accepts("html", "json") === "html" && !ctx.request.path.match(/\.[a-zA-Z0-9]+$/);
|
|
18
18
|
const isGetAdminHtml = ctx.request.method === "GET" && ctx.request.path.startsWith(adminUrl) && isHtmlRequest;
|
|
19
19
|
if (isPostAuth || isGetAdminHtml) {
|
|
20
20
|
try {
|
|
@@ -47,7 +47,12 @@ async function bootstrap({ strapi: strapi2 }) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
await next();
|
|
50
|
-
}
|
|
50
|
+
};
|
|
51
|
+
if (strapi2.server.app && Array.isArray(strapi2.server.app.middleware)) {
|
|
52
|
+
strapi2.server.app.middleware.unshift(enforceOidcMiddleware);
|
|
53
|
+
} else {
|
|
54
|
+
strapi2.server.use(enforceOidcMiddleware);
|
|
55
|
+
}
|
|
51
56
|
const actions = [
|
|
52
57
|
{
|
|
53
58
|
section: "plugins",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strapi-plugin-oidc",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
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": ">=
|
|
67
|
-
"npm": "
|
|
66
|
+
"node": ">=20.0.0 <=24.x.x",
|
|
67
|
+
"npm": ">=6.0.0"
|
|
68
68
|
},
|
|
69
69
|
"files": [
|
|
70
70
|
"dist"
|