strapi-plugin-oidc 1.0.4 → 1.0.5
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-C0GkDnGG.js → index-B525UaV3.js} +12 -18
- package/dist/admin/{index-DwpTg1-J.mjs → index-BbD-7Z4N.mjs} +182 -112
- package/dist/admin/{index-BuuCScSN.mjs → index-D3AvxXlB.mjs} +12 -18
- package/dist/admin/{index-D_0jCOLk.js → index-DlQ8NUBY.js} +181 -111
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +118 -87
- package/dist/server/index.mjs +118 -87
- package/package.json +3 -2
|
@@ -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-DlQ8NUBY.js"));
|
|
59
59
|
},
|
|
60
60
|
permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }]
|
|
61
61
|
}
|
|
@@ -77,24 +77,18 @@ const index = {
|
|
|
77
77
|
if (currentPath.endsWith("/auth/login")) {
|
|
78
78
|
window.location.href = "/strapi-plugin-oidc/oidc";
|
|
79
79
|
}
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const originalReplaceState = window.history.replaceState;
|
|
90
|
-
window.history.replaceState = function(...args) {
|
|
91
|
-
const url = args[2];
|
|
92
|
-
if (url && typeof url === "string" && url.endsWith("/auth/login")) {
|
|
93
|
-
window.location.href = "/strapi-plugin-oidc/oidc";
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
return originalReplaceState.apply(window.history, args);
|
|
80
|
+
const interceptHistory = (originalMethod) => {
|
|
81
|
+
return function(...args) {
|
|
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;
|
|
86
|
+
}
|
|
87
|
+
return originalMethod.apply(window.history, args);
|
|
88
|
+
};
|
|
97
89
|
};
|
|
90
|
+
window.history.pushState = interceptHistory(window.history.pushState);
|
|
91
|
+
window.history.replaceState = interceptHistory(window.history.replaceState);
|
|
98
92
|
}
|
|
99
93
|
}
|
|
100
94
|
} catch (error) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Routes, Route } from "react-router-dom";
|
|
3
3
|
import { useFetchClient, Page, Layouts } from "@strapi/strapi/admin";
|
|
4
|
-
import { useState, useCallback,
|
|
4
|
+
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-D3AvxXlB.mjs";
|
|
9
9
|
import en from "./en-f0TxVfx7.mjs";
|
|
10
10
|
import styled from "styled-components";
|
|
11
11
|
function getTrad(id) {
|
|
@@ -24,19 +24,22 @@ function Role({ oidcRoles, roles, onChangeRole }) {
|
|
|
24
24
|
{
|
|
25
25
|
withTags: true,
|
|
26
26
|
placeholder: formatMessage(getTrad("roles.placeholder")),
|
|
27
|
-
value: oidcRole
|
|
27
|
+
value: oidcRole.role ? oidcRole.role.map((r) => String(r)) : [],
|
|
28
28
|
onChange: (value) => {
|
|
29
29
|
if (value && value.length > 0) {
|
|
30
|
-
onChangeRole(value, oidcRole
|
|
30
|
+
onChangeRole(value, oidcRole.oauth_type);
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
children: roles.map((role) => /* @__PURE__ */ jsx(MultiSelectOption, { value: role.id
|
|
33
|
+
children: roles.map((role) => /* @__PURE__ */ jsx(MultiSelectOption, { value: String(role.id), children: role.name }, role.id))
|
|
34
34
|
}
|
|
35
|
-
) }, oidcRole
|
|
35
|
+
) }, oidcRole.oauth_type)) })
|
|
36
36
|
] });
|
|
37
37
|
}
|
|
38
38
|
const CustomTable = styled(Table)`
|
|
39
|
-
th,
|
|
39
|
+
th,
|
|
40
|
+
td,
|
|
41
|
+
th span,
|
|
42
|
+
td span {
|
|
40
43
|
font-size: 1.3rem !important;
|
|
41
44
|
}
|
|
42
45
|
`;
|
|
@@ -50,7 +53,15 @@ const LocalizedDate = ({ date }) => {
|
|
|
50
53
|
minute: "2-digit"
|
|
51
54
|
}).format(new Date(date));
|
|
52
55
|
};
|
|
53
|
-
function Whitelist({
|
|
56
|
+
function Whitelist({
|
|
57
|
+
users,
|
|
58
|
+
roles,
|
|
59
|
+
oidcRoles = [],
|
|
60
|
+
useWhitelist,
|
|
61
|
+
loading,
|
|
62
|
+
onSave,
|
|
63
|
+
onDelete
|
|
64
|
+
}) {
|
|
54
65
|
const [email, setEmail] = useState("");
|
|
55
66
|
const [selectedRoles, setSelectedRoles] = useState([]);
|
|
56
67
|
const [page, setPage] = useState(1);
|
|
@@ -61,9 +72,7 @@ function Whitelist({ users, roles, oidcRoles = [], useWhitelist, loading, onSave
|
|
|
61
72
|
const onSaveEmail = useCallback(async () => {
|
|
62
73
|
const emailText = email.trim();
|
|
63
74
|
if (users.some((user) => user.email === emailText)) {
|
|
64
|
-
alert(
|
|
65
|
-
formatMessage(getTrad("whitelist.error.unique"))
|
|
66
|
-
);
|
|
75
|
+
alert(formatMessage(getTrad("whitelist.error.unique")));
|
|
67
76
|
} else {
|
|
68
77
|
await onSave(emailText, selectedRoles);
|
|
69
78
|
setEmail("");
|
|
@@ -122,61 +131,103 @@ function Whitelist({ users, roles, oidcRoles = [], useWhitelist, loading, onSave
|
|
|
122
131
|
/* @__PURE__ */ jsx(Th, { style: { paddingRight: 0 }, children: " " })
|
|
123
132
|
] }) }),
|
|
124
133
|
/* @__PURE__ */ jsx(Tbody, { children: users.length === 0 ? /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, { colSpan: 5, children: /* @__PURE__ */ jsx(Flex, { justifyContent: "center", padding: 4, children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage(getTrad("whitelist.table.empty")) }) }) }) }) : paginatedUsers.map((user, index) => {
|
|
125
|
-
|
|
126
|
-
const r = roles.find((ro) => ro.id
|
|
134
|
+
const getRoleNames = (roleIds) => roleIds.map((roleId) => {
|
|
135
|
+
const r = roles.find((ro) => String(ro.id) === String(roleId));
|
|
127
136
|
return r ? r.name : roleId;
|
|
128
137
|
}).join(", ");
|
|
138
|
+
let userRolesNames = getRoleNames(user.roles || []);
|
|
129
139
|
if (!userRolesNames) {
|
|
130
140
|
const defaultRolesIds = oidcRoles.reduce((acc, oidc) => {
|
|
131
|
-
if (oidc.role)
|
|
132
|
-
acc.push(...oidc.role);
|
|
133
|
-
}
|
|
141
|
+
if (oidc.role) acc.push(...oidc.role);
|
|
134
142
|
return acc;
|
|
135
143
|
}, []);
|
|
136
|
-
userRolesNames = defaultRolesIds
|
|
137
|
-
const r = roles.find((ro) => ro.id.toString() === roleId.toString());
|
|
138
|
-
return r ? r.name : roleId;
|
|
139
|
-
}).join(", ");
|
|
144
|
+
userRolesNames = getRoleNames(defaultRolesIds);
|
|
140
145
|
}
|
|
141
146
|
return /* @__PURE__ */ jsxs(Tr, { children: [
|
|
142
147
|
/* @__PURE__ */ jsx(Td, { children: index + 1 + (page - 1) * PAGE_SIZE }),
|
|
143
148
|
/* @__PURE__ */ jsx(Td, { children: user.email }),
|
|
144
149
|
/* @__PURE__ */ jsx(Td, { children: userRolesNames || "-" }),
|
|
145
150
|
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(LocalizedDate, { date: user.createdAt }) }),
|
|
146
|
-
/* @__PURE__ */ jsx(Td, { style: { paddingRight: 0 }, children: /* @__PURE__ */ jsx(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
/* @__PURE__ */ jsx(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
151
|
+
/* @__PURE__ */ jsx(Td, { style: { paddingRight: 0 }, children: /* @__PURE__ */ jsx(
|
|
152
|
+
Flex,
|
|
153
|
+
{
|
|
154
|
+
justifyContent: "flex-end",
|
|
155
|
+
onClick: (e) => e.stopPropagation(),
|
|
156
|
+
style: { width: "100%" },
|
|
157
|
+
children: /* @__PURE__ */ jsxs(Dialog.Root, { children: [
|
|
158
|
+
/* @__PURE__ */ jsx(Dialog.Trigger, { children: /* @__PURE__ */ jsx(
|
|
159
|
+
IconButton,
|
|
160
|
+
{
|
|
161
|
+
label: formatMessage(getTrad("whitelist.delete.label")),
|
|
162
|
+
withTooltip: false,
|
|
163
|
+
children: /* @__PURE__ */ jsx(Trash, {})
|
|
164
|
+
}
|
|
165
|
+
) }),
|
|
166
|
+
/* @__PURE__ */ jsxs(Dialog.Content, { children: [
|
|
167
|
+
/* @__PURE__ */ jsx(Dialog.Header, { children: formatMessage(getTrad("whitelist.delete.title")) }),
|
|
168
|
+
/* @__PURE__ */ jsx(Dialog.Body, { icon: /* @__PURE__ */ jsx(WarningCircle, { fill: "danger600" }), children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "center", gap: 2, children: [
|
|
169
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Typography, { id: "confirm-description", children: formatMessage(getTrad("whitelist.delete.description")) }) }),
|
|
170
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "bold", children: user.email }) }),
|
|
171
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", marginTop: 2, children: /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(getTrad("whitelist.delete.note")) }) })
|
|
172
|
+
] }) }),
|
|
173
|
+
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
|
174
|
+
/* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { fullWidth: true, variant: "tertiary", children: formatMessage(getTrad("page.cancel")) }) }),
|
|
175
|
+
/* @__PURE__ */ jsx(Dialog.Action, { children: /* @__PURE__ */ jsx(
|
|
176
|
+
Button,
|
|
177
|
+
{
|
|
178
|
+
fullWidth: true,
|
|
179
|
+
variant: "danger-light",
|
|
180
|
+
onClick: () => onDelete(user.email),
|
|
181
|
+
children: formatMessage(getTrad("page.ok"))
|
|
182
|
+
}
|
|
183
|
+
) })
|
|
184
|
+
] })
|
|
185
|
+
] })
|
|
158
186
|
] })
|
|
159
|
-
|
|
160
|
-
|
|
187
|
+
}
|
|
188
|
+
) })
|
|
161
189
|
] }, user.email);
|
|
162
190
|
}) })
|
|
163
191
|
] }),
|
|
164
192
|
pageCount > 1 && /* @__PURE__ */ jsx(Box, { paddingTop: 4, children: /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxs(Pagination, { activePage: page, pageCount, children: [
|
|
165
|
-
/* @__PURE__ */ jsx(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
193
|
+
/* @__PURE__ */ jsx(
|
|
194
|
+
PreviousLink,
|
|
195
|
+
{
|
|
196
|
+
href: "#",
|
|
197
|
+
onClick: (e) => {
|
|
198
|
+
e.preventDefault();
|
|
199
|
+
setPage((p) => Math.max(1, p - 1));
|
|
200
|
+
},
|
|
201
|
+
children: "Go to previous page"
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
Array.from({ length: pageCount }).map((_, i) => /* @__PURE__ */ jsxs(
|
|
205
|
+
PageLink,
|
|
206
|
+
{
|
|
207
|
+
number: i + 1,
|
|
208
|
+
href: "#",
|
|
209
|
+
onClick: (e) => {
|
|
210
|
+
e.preventDefault();
|
|
211
|
+
setPage(i + 1);
|
|
212
|
+
},
|
|
213
|
+
children: [
|
|
214
|
+
"Go to page ",
|
|
215
|
+
i + 1
|
|
216
|
+
]
|
|
217
|
+
},
|
|
174
218
|
i + 1
|
|
175
|
-
|
|
176
|
-
/* @__PURE__ */ jsx(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
219
|
+
)),
|
|
220
|
+
/* @__PURE__ */ jsx(
|
|
221
|
+
NextLink,
|
|
222
|
+
{
|
|
223
|
+
href: "#",
|
|
224
|
+
onClick: (e) => {
|
|
225
|
+
e.preventDefault();
|
|
226
|
+
setPage((p) => Math.min(pageCount, p + 1));
|
|
227
|
+
},
|
|
228
|
+
children: "Go to next page"
|
|
229
|
+
}
|
|
230
|
+
)
|
|
180
231
|
] }) }) })
|
|
181
232
|
] }) });
|
|
182
233
|
}
|
|
@@ -297,9 +348,12 @@ function CustomSwitch({ checked, onChange, label, disabled }) {
|
|
|
297
348
|
label && /* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: disabled ? "neutral500" : "neutral800", children: label })
|
|
298
349
|
] });
|
|
299
350
|
}
|
|
300
|
-
function
|
|
301
|
-
const {
|
|
351
|
+
function useOidcSettings() {
|
|
352
|
+
const { get, put } = useFetchClient();
|
|
302
353
|
const [loading, setLoading] = useState(false);
|
|
354
|
+
const [showSuccess, setSuccess] = useState(false);
|
|
355
|
+
const [showError, setError] = useState(false);
|
|
356
|
+
const [showMatched, setMatched] = useState(0);
|
|
303
357
|
const [initialOidcRoles, setInitialOIDCRoles] = useState([]);
|
|
304
358
|
const [oidcRoles, setOIDCRoles] = useState([]);
|
|
305
359
|
const [roles, setRoles] = useState([]);
|
|
@@ -309,10 +363,6 @@ function HomePage() {
|
|
|
309
363
|
const [enforceOIDC, setEnforceOIDC] = useState(false);
|
|
310
364
|
const [initialUsers, setInitialUsers] = useState([]);
|
|
311
365
|
const [users, setUsers] = useState([]);
|
|
312
|
-
const [showSuccess, setSuccess] = useState(false);
|
|
313
|
-
const [showError, setError] = useState(false);
|
|
314
|
-
const [showMatched, setMatched] = useState(0);
|
|
315
|
-
const { get, put, post, del } = useFetchClient();
|
|
316
366
|
useEffect(() => {
|
|
317
367
|
get(`/strapi-plugin-oidc/oidc-roles`).then((response) => {
|
|
318
368
|
setOIDCRoles(response.data);
|
|
@@ -329,22 +379,34 @@ function HomePage() {
|
|
|
329
379
|
setEnforceOIDC(response.data.enforceOIDC);
|
|
330
380
|
setInitialEnforceOIDC(response.data.enforceOIDC);
|
|
331
381
|
});
|
|
332
|
-
}, [
|
|
382
|
+
}, [get]);
|
|
333
383
|
const onChangeRole = (values, oidcId) => {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
384
|
+
const updatedRoles = oidcRoles.map(
|
|
385
|
+
(role) => role.oauth_type === oidcId ? { ...role, role: values } : role
|
|
386
|
+
);
|
|
387
|
+
setOIDCRoles(updatedRoles);
|
|
388
|
+
};
|
|
389
|
+
const onRegisterWhitelist = async (email, selectedRoles) => {
|
|
390
|
+
const newUser = { email, roles: selectedRoles, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
391
|
+
setUsers([...users, newUser]);
|
|
392
|
+
};
|
|
393
|
+
const onDeleteWhitelist = async (email) => {
|
|
394
|
+
setUsers(users.filter((u) => u.email !== email));
|
|
395
|
+
};
|
|
396
|
+
const onToggleWhitelist = (e) => {
|
|
397
|
+
setUseWhitelist(e.target.checked);
|
|
340
398
|
};
|
|
399
|
+
const onToggleEnforce = (e) => {
|
|
400
|
+
setEnforceOIDC(e.target.checked);
|
|
401
|
+
};
|
|
402
|
+
const isDirty = useWhitelist !== initialUseWhitelist || enforceOIDC !== initialEnforceOIDC || JSON.stringify(oidcRoles) !== JSON.stringify(initialOidcRoles) || JSON.stringify(users) !== JSON.stringify(initialUsers);
|
|
341
403
|
const onSaveAll = async () => {
|
|
342
404
|
setLoading(true);
|
|
343
405
|
try {
|
|
344
406
|
await put("/strapi-plugin-oidc/oidc-roles", {
|
|
345
407
|
roles: oidcRoles.map((role) => ({
|
|
346
|
-
|
|
347
|
-
role: role
|
|
408
|
+
oauth_type: role.oauth_type,
|
|
409
|
+
role: role.role
|
|
348
410
|
}))
|
|
349
411
|
});
|
|
350
412
|
await put("/strapi-plugin-oidc/whitelist/settings", {
|
|
@@ -361,43 +423,51 @@ function HomePage() {
|
|
|
361
423
|
setUsers(getResponse.data.whitelistUsers);
|
|
362
424
|
setInitialUsers(JSON.parse(JSON.stringify(getResponse.data.whitelistUsers)));
|
|
363
425
|
});
|
|
364
|
-
if (syncResponse.data
|
|
426
|
+
if (syncResponse.data?.matchedExistingUsersCount > 0) {
|
|
365
427
|
setMatched(syncResponse.data.matchedExistingUsersCount);
|
|
366
|
-
setTimeout(() =>
|
|
367
|
-
setMatched(0);
|
|
368
|
-
}, 3e3);
|
|
428
|
+
setTimeout(() => setMatched(0), 3e3);
|
|
369
429
|
} else {
|
|
370
430
|
setSuccess(true);
|
|
371
|
-
setTimeout(() =>
|
|
372
|
-
setSuccess(false);
|
|
373
|
-
}, 3e3);
|
|
431
|
+
setTimeout(() => setSuccess(false), 3e3);
|
|
374
432
|
}
|
|
375
433
|
} catch (e) {
|
|
376
434
|
console.error(e);
|
|
377
435
|
setError(true);
|
|
378
|
-
setTimeout(() =>
|
|
379
|
-
setError(false);
|
|
380
|
-
}, 3e3);
|
|
436
|
+
setTimeout(() => setError(false), 3e3);
|
|
381
437
|
} finally {
|
|
382
438
|
setLoading(false);
|
|
383
439
|
}
|
|
384
440
|
};
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
441
|
+
return {
|
|
442
|
+
state: {
|
|
443
|
+
loading,
|
|
444
|
+
showSuccess,
|
|
445
|
+
showError,
|
|
446
|
+
showMatched,
|
|
447
|
+
oidcRoles,
|
|
448
|
+
roles,
|
|
449
|
+
useWhitelist,
|
|
450
|
+
enforceOIDC,
|
|
451
|
+
initialEnforceOIDC,
|
|
452
|
+
users,
|
|
453
|
+
isDirty
|
|
454
|
+
},
|
|
455
|
+
actions: {
|
|
456
|
+
setSuccess,
|
|
457
|
+
setError,
|
|
458
|
+
setMatched,
|
|
459
|
+
onChangeRole,
|
|
460
|
+
onRegisterWhitelist,
|
|
461
|
+
onDeleteWhitelist,
|
|
462
|
+
onToggleWhitelist,
|
|
463
|
+
onToggleEnforce,
|
|
464
|
+
onSaveAll
|
|
465
|
+
}
|
|
399
466
|
};
|
|
400
|
-
|
|
467
|
+
}
|
|
468
|
+
function HomePage() {
|
|
469
|
+
const { formatMessage } = useIntl();
|
|
470
|
+
const { state, actions } = useOidcSettings();
|
|
401
471
|
return /* @__PURE__ */ jsxs(Page.Protect, { permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }], children: [
|
|
402
472
|
/* @__PURE__ */ jsx(
|
|
403
473
|
Layouts.Header,
|
|
@@ -406,18 +476,18 @@ function HomePage() {
|
|
|
406
476
|
subtitle: formatMessage(getTrad("page.title"))
|
|
407
477
|
}
|
|
408
478
|
),
|
|
409
|
-
showSuccess && /* @__PURE__ */ jsx(SuccessAlertMessage, { onClose: () => setSuccess(false) }),
|
|
410
|
-
showError && /* @__PURE__ */ jsx(ErrorAlertMessage, { onClose: () => setError(false) }),
|
|
411
|
-
showMatched > 0 && /* @__PURE__ */ jsx(MatchedUserAlertMessage, { count: showMatched, onClose: () => setMatched(0) }),
|
|
479
|
+
state.showSuccess && /* @__PURE__ */ jsx(SuccessAlertMessage, { onClose: () => actions.setSuccess(false) }),
|
|
480
|
+
state.showError && /* @__PURE__ */ jsx(ErrorAlertMessage, { onClose: () => actions.setError(false) }),
|
|
481
|
+
state.showMatched > 0 && /* @__PURE__ */ jsx(MatchedUserAlertMessage, { count: state.showMatched, onClose: () => actions.setMatched(0) }),
|
|
412
482
|
/* @__PURE__ */ jsx(Layouts.Content, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
413
483
|
/* @__PURE__ */ jsxs(Box, { background: "neutral0", hasRadius: true, shadow: "filterShadow", padding: 6, children: [
|
|
414
484
|
/* @__PURE__ */ jsx(Box, { paddingBottom: 4, children: /* @__PURE__ */ jsx(Typography, { variant: "beta", tag: "h2", children: formatMessage(getTrad("roles.title")) }) }),
|
|
415
485
|
/* @__PURE__ */ jsx(
|
|
416
486
|
Role,
|
|
417
487
|
{
|
|
418
|
-
roles,
|
|
419
|
-
oidcRoles,
|
|
420
|
-
onChangeRole
|
|
488
|
+
roles: state.roles,
|
|
489
|
+
oidcRoles: state.oidcRoles,
|
|
490
|
+
onChangeRole: actions.onChangeRole
|
|
421
491
|
}
|
|
422
492
|
)
|
|
423
493
|
] }),
|
|
@@ -427,22 +497,22 @@ function HomePage() {
|
|
|
427
497
|
/* @__PURE__ */ jsx(
|
|
428
498
|
CustomSwitch,
|
|
429
499
|
{
|
|
430
|
-
checked: useWhitelist,
|
|
431
|
-
onChange: onToggleWhitelist,
|
|
432
|
-
label: useWhitelist ? formatMessage(getTrad("whitelist.toggle.enabled")) : formatMessage(getTrad("whitelist.toggle.disabled"))
|
|
500
|
+
checked: state.useWhitelist,
|
|
501
|
+
onChange: actions.onToggleWhitelist,
|
|
502
|
+
label: state.useWhitelist ? formatMessage(getTrad("whitelist.toggle.enabled")) : formatMessage(getTrad("whitelist.toggle.disabled"))
|
|
433
503
|
}
|
|
434
504
|
)
|
|
435
505
|
] }),
|
|
436
506
|
/* @__PURE__ */ jsx(
|
|
437
507
|
Whitelist,
|
|
438
508
|
{
|
|
439
|
-
loading,
|
|
440
|
-
users,
|
|
441
|
-
roles,
|
|
442
|
-
oidcRoles,
|
|
443
|
-
useWhitelist,
|
|
444
|
-
onSave: onRegisterWhitelist,
|
|
445
|
-
onDelete: onDeleteWhitelist
|
|
509
|
+
loading: state.loading,
|
|
510
|
+
users: state.users,
|
|
511
|
+
roles: state.roles,
|
|
512
|
+
oidcRoles: state.oidcRoles,
|
|
513
|
+
useWhitelist: state.useWhitelist,
|
|
514
|
+
onSave: actions.onRegisterWhitelist,
|
|
515
|
+
onDelete: actions.onDeleteWhitelist
|
|
446
516
|
}
|
|
447
517
|
)
|
|
448
518
|
] }),
|
|
@@ -452,14 +522,14 @@ function HomePage() {
|
|
|
452
522
|
/* @__PURE__ */ jsx(
|
|
453
523
|
CustomSwitch,
|
|
454
524
|
{
|
|
455
|
-
checked: enforceOIDC,
|
|
456
|
-
onChange: onToggleEnforce,
|
|
457
|
-
disabled: useWhitelist && users.length === 0,
|
|
458
|
-
label: enforceOIDC ? formatMessage(getTrad("enforce.toggle.enabled")) : formatMessage(getTrad("enforce.toggle.disabled"))
|
|
525
|
+
checked: state.enforceOIDC,
|
|
526
|
+
onChange: actions.onToggleEnforce,
|
|
527
|
+
disabled: state.useWhitelist && state.users.length === 0,
|
|
528
|
+
label: state.enforceOIDC ? formatMessage(getTrad("enforce.toggle.enabled")) : formatMessage(getTrad("enforce.toggle.disabled"))
|
|
459
529
|
}
|
|
460
530
|
)
|
|
461
531
|
] }),
|
|
462
|
-
enforceOIDC && enforceOIDC !== initialEnforceOIDC && /* @__PURE__ */ jsx(Box, { background: "danger100", padding: 3, hasRadius: true, children: /* @__PURE__ */ jsxs(Flex, { gap: 3, alignItems: "center", children: [
|
|
532
|
+
state.enforceOIDC && state.enforceOIDC !== state.initialEnforceOIDC && /* @__PURE__ */ jsx(Box, { background: "danger100", padding: 3, hasRadius: true, children: /* @__PURE__ */ jsxs(Flex, { gap: 3, alignItems: "center", children: [
|
|
463
533
|
/* @__PURE__ */ jsx(WarningCircle, { fill: "danger600" }),
|
|
464
534
|
/* @__PURE__ */ jsx(Typography, { textColor: "danger600", children: formatMessage(getTrad("enforce.warning")) })
|
|
465
535
|
] }) })
|
|
@@ -468,9 +538,9 @@ function HomePage() {
|
|
|
468
538
|
Button,
|
|
469
539
|
{
|
|
470
540
|
size: "L",
|
|
471
|
-
onClick: onSaveAll,
|
|
472
|
-
disabled: !isDirty || loading,
|
|
473
|
-
loading,
|
|
541
|
+
onClick: actions.onSaveAll,
|
|
542
|
+
disabled: !state.isDirty || state.loading,
|
|
543
|
+
loading: state.loading,
|
|
474
544
|
children: formatMessage(getTrad("page.save"))
|
|
475
545
|
}
|
|
476
546
|
) })
|
|
@@ -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-BbD-7Z4N.mjs");
|
|
58
58
|
},
|
|
59
59
|
permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }]
|
|
60
60
|
}
|
|
@@ -76,24 +76,18 @@ const index = {
|
|
|
76
76
|
if (currentPath.endsWith("/auth/login")) {
|
|
77
77
|
window.location.href = "/strapi-plugin-oidc/oidc";
|
|
78
78
|
}
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const originalReplaceState = window.history.replaceState;
|
|
89
|
-
window.history.replaceState = function(...args) {
|
|
90
|
-
const url = args[2];
|
|
91
|
-
if (url && typeof url === "string" && url.endsWith("/auth/login")) {
|
|
92
|
-
window.location.href = "/strapi-plugin-oidc/oidc";
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
return originalReplaceState.apply(window.history, args);
|
|
79
|
+
const interceptHistory = (originalMethod) => {
|
|
80
|
+
return function(...args) {
|
|
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;
|
|
85
|
+
}
|
|
86
|
+
return originalMethod.apply(window.history, args);
|
|
87
|
+
};
|
|
96
88
|
};
|
|
89
|
+
window.history.pushState = interceptHistory(window.history.pushState);
|
|
90
|
+
window.history.replaceState = interceptHistory(window.history.replaceState);
|
|
97
91
|
}
|
|
98
92
|
}
|
|
99
93
|
} catch (error) {
|