strapi-plugin-oidc 1.7.6 → 1.8.1
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/README.md +77 -47
- package/dist/admin/{index-DRJ6Ty2J.mjs → index-Bb9-aYb4.mjs} +54 -6
- package/dist/admin/{index-D2rlNx1-.js → index-Bmg4eTYb.js} +115 -88
- package/dist/admin/{index-pieFAsgM.mjs → index-BqWd-Iiq.mjs} +74 -47
- package/dist/admin/{index-CrnGXADu.js → index-Dk6TYtio.js} +58 -8
- package/dist/admin/index.js +3 -1
- package/dist/admin/index.mjs +3 -1
- package/dist/server/index.js +266 -92
- package/dist/server/index.mjs +266 -92
- package/package.json +2 -1
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
2
|
+
const React = require("react");
|
|
3
|
+
const client = require("react-dom/client");
|
|
4
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
+
const designSystem = require("@strapi/design-system");
|
|
6
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
7
|
+
const React__default = /* @__PURE__ */ _interopDefault(React);
|
|
3
8
|
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
4
9
|
const v = glob[path];
|
|
5
10
|
if (v) {
|
|
@@ -24,15 +29,51 @@ const pluginPkg = {
|
|
|
24
29
|
};
|
|
25
30
|
const pluginId = pluginPkg.name.replace(/^@strapi\/plugin-/i, "");
|
|
26
31
|
function Initializer({ setPlugin }) {
|
|
27
|
-
const ref =
|
|
32
|
+
const ref = React.useRef();
|
|
28
33
|
ref.current = setPlugin;
|
|
29
|
-
|
|
34
|
+
React.useEffect(() => {
|
|
30
35
|
if (ref.current) {
|
|
31
36
|
ref.current(pluginId);
|
|
32
37
|
}
|
|
33
38
|
}, []);
|
|
34
39
|
return null;
|
|
35
40
|
}
|
|
41
|
+
const LOGOUT_EVENT = "strapi-oidc:logout";
|
|
42
|
+
function Overlay({ bg }) {
|
|
43
|
+
const [active, setActive] = React.useState(false);
|
|
44
|
+
React.useEffect(() => {
|
|
45
|
+
const handler = () => setActive(true);
|
|
46
|
+
window.addEventListener(LOGOUT_EVENT, handler);
|
|
47
|
+
return () => window.removeEventListener(LOGOUT_EVENT, handler);
|
|
48
|
+
}, []);
|
|
49
|
+
if (!active) return null;
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
style: {
|
|
54
|
+
position: "fixed",
|
|
55
|
+
inset: 0,
|
|
56
|
+
zIndex: 1e4,
|
|
57
|
+
display: "flex",
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
justifyContent: "center",
|
|
60
|
+
background: bg,
|
|
61
|
+
backdropFilter: "blur(2px)"
|
|
62
|
+
},
|
|
63
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, {})
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
function resolveTheme() {
|
|
68
|
+
const stored = window.localStorage.getItem("STRAPI_THEME") ?? "system";
|
|
69
|
+
const isDark = stored === "dark" || stored === "system" && (window.matchMedia?.("(prefers-color-scheme: dark)").matches ?? false);
|
|
70
|
+
return isDark ? designSystem.darkTheme : designSystem.lightTheme;
|
|
71
|
+
}
|
|
72
|
+
function LogoutOverlay() {
|
|
73
|
+
const theme = resolveTheme();
|
|
74
|
+
const bg = theme === designSystem.darkTheme ? "rgba(24, 24, 38, 0.85)" : "rgba(255, 255, 255, 0.85)";
|
|
75
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.DesignSystemProvider, { theme, children: /* @__PURE__ */ jsxRuntime.jsx(Overlay, { bg }) });
|
|
76
|
+
}
|
|
36
77
|
const en = {
|
|
37
78
|
"global.plugins.strapi-plugin-oidc": "OIDC Plugin",
|
|
38
79
|
"page.title": "Configure OIDC default role(s) and access controls.",
|
|
@@ -95,7 +136,6 @@ const en = {
|
|
|
95
136
|
"auditlog.table.ip": "IP",
|
|
96
137
|
"auditlog.table.details": "Details",
|
|
97
138
|
"auditlog.table.empty": "No audit log entries",
|
|
98
|
-
"auditlog.loading": "Loading…",
|
|
99
139
|
"auditlog.clear": "Clear Logs",
|
|
100
140
|
"auditlog.clear.title": "Clear All Logs",
|
|
101
141
|
"auditlog.clear.description": "This will permanently delete all {count, plural, one {# audit log entry} other {# audit log entries}}. This action cannot be undone.",
|
|
@@ -126,6 +166,8 @@ const en = {
|
|
|
126
166
|
"auditlog.action.nonce_mismatch": "The nonce in the ID token did not match the one generated at login. This may indicate a token replay attack.",
|
|
127
167
|
"auditlog.action.token_exchange_failed": "The authorisation code could not be exchanged for tokens. The OIDC provider rejected the request.",
|
|
128
168
|
"auditlog.action.whitelist_rejected": "The user's email address is not on the whitelist. Access was denied.",
|
|
169
|
+
"auditlog.action.email_not_verified": "The OIDC provider did not confirm the user's email address as verified. Access was denied.",
|
|
170
|
+
"auditlog.action.id_token_invalid": "The ID token failed signature, issuer, audience, or expiry validation. Access was denied.",
|
|
129
171
|
"auth.page.authenticating.title": "Authenticating...",
|
|
130
172
|
"auth.page.authenticating.noscript.heading": "JavaScript Required",
|
|
131
173
|
"auth.page.authenticating.noscript.body": "JavaScript must be enabled for authentication to complete.",
|
|
@@ -166,7 +208,7 @@ const index = {
|
|
|
166
208
|
defaultMessage: "Configuration"
|
|
167
209
|
},
|
|
168
210
|
Component: async () => {
|
|
169
|
-
return await Promise.resolve().then(() => require("./index-
|
|
211
|
+
return await Promise.resolve().then(() => require("./index-Bmg4eTYb.js"));
|
|
170
212
|
},
|
|
171
213
|
permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }]
|
|
172
214
|
}
|
|
@@ -178,6 +220,9 @@ const index = {
|
|
|
178
220
|
});
|
|
179
221
|
},
|
|
180
222
|
bootstrap() {
|
|
223
|
+
const overlayContainer = document.createElement("div");
|
|
224
|
+
document.body.appendChild(overlayContainer);
|
|
225
|
+
client.createRoot(overlayContainer).render(React__default.default.createElement(LogoutOverlay));
|
|
181
226
|
const defaultButtonText = t("login.sso");
|
|
182
227
|
const isAuthRoute = (path) => /\/auth\/(login|register|forgot-password|reset-password)/.test(path);
|
|
183
228
|
let ssoButtonInjected = false;
|
|
@@ -237,6 +282,7 @@ const index = {
|
|
|
237
282
|
if (!isAuthRoute(window.location.pathname)) return;
|
|
238
283
|
injectSSOButton(buttonText);
|
|
239
284
|
if (enforced) removeEnforcedElements();
|
|
285
|
+
if (ssoButtonInjected && !enforced) loginObserver?.disconnect();
|
|
240
286
|
};
|
|
241
287
|
tick();
|
|
242
288
|
loginObserver = new MutationObserver(tick);
|
|
@@ -257,23 +303,27 @@ const index = {
|
|
|
257
303
|
}
|
|
258
304
|
};
|
|
259
305
|
applySettings();
|
|
306
|
+
if (window.__strapiOidcFetchPatched) return;
|
|
307
|
+
window.__strapiOidcFetchPatched = true;
|
|
260
308
|
const originalFetch = window.fetch;
|
|
261
309
|
window.fetch = async (...args) => {
|
|
262
310
|
const url = typeof args[0] === "string" ? args[0] : args[0].url;
|
|
263
311
|
const isLogout = url?.endsWith("/admin/logout") && args[1]?.method?.toUpperCase() === "POST";
|
|
264
|
-
|
|
265
|
-
|
|
312
|
+
if (isLogout) {
|
|
313
|
+
window.dispatchEvent(new CustomEvent(LOGOUT_EVENT));
|
|
266
314
|
window.localStorage.removeItem("jwtToken");
|
|
267
315
|
window.localStorage.removeItem("isLoggedIn");
|
|
268
316
|
window.sessionStorage.removeItem("jwtToken");
|
|
269
317
|
window.sessionStorage.removeItem("isLoggedIn");
|
|
270
318
|
document.cookie = "jwtToken=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/";
|
|
271
319
|
document.cookie = "jwtToken=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/admin";
|
|
320
|
+
originalFetch(...args).catch(() => {
|
|
321
|
+
});
|
|
272
322
|
window.location.href = "/strapi-plugin-oidc/logout";
|
|
273
323
|
return new Promise(() => {
|
|
274
324
|
});
|
|
275
325
|
}
|
|
276
|
-
return
|
|
326
|
+
return originalFetch(...args);
|
|
277
327
|
};
|
|
278
328
|
},
|
|
279
329
|
async registerTrads({ locales }) {
|
package/dist/admin/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-Dk6TYtio.js");
|
|
4
|
+
require("react");
|
|
5
|
+
require("react-dom/client");
|
|
4
6
|
exports.default = index.index;
|