strapi-plugin-oidc 1.0.0
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/LICENSE +21 -0
- package/README.md +88 -0
- package/dist/_chunks/en-AsM8uCFB.mjs +23 -0
- package/dist/_chunks/en-BbQ9XzfO.js +23 -0
- package/dist/_chunks/fr-C8Qw4iPZ.js +4 -0
- package/dist/_chunks/fr-hkSxFuzl.mjs +4 -0
- package/dist/_chunks/index-Bq6bRISt.js +414 -0
- package/dist/_chunks/index-BuS0wmlA.mjs +412 -0
- package/dist/_chunks/index-CHl-03dY.mjs +204 -0
- package/dist/_chunks/index-DR3YYYZL.js +203 -0
- package/dist/_chunks/ja-B2WcMFA2.js +23 -0
- package/dist/_chunks/ja-COdupAQd.mjs +23 -0
- package/dist/admin/en-f0TxVfx7.mjs +41 -0
- package/dist/admin/en-jFPbEFeK.js +41 -0
- package/dist/admin/index-BuuCScSN.mjs +143 -0
- package/dist/admin/index-C0GkDnGG.js +142 -0
- package/dist/admin/index-D_0jCOLk.js +491 -0
- package/dist/admin/index-DwpTg1-J.mjs +489 -0
- package/dist/admin/index.js +4 -0
- package/dist/admin/index.mjs +4 -0
- package/dist/server/index.js +746 -0
- package/dist/server/index.mjs +741 -0
- package/package.json +107 -0
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback, memo, useEffect } from "react";
|
|
3
|
+
import { Routes, Route } from "react-router-dom";
|
|
4
|
+
import { useFetchClient, Page, Layouts } from "@strapi/strapi/admin";
|
|
5
|
+
import { Table, Thead, Tr, Th, Checkbox, Tbody, Td, Button, Box, Flex, Toggle, Typography, Grid, Field, MultiSelect, MultiSelectOption, Divider, Dialog, IconButton, Alert, Tabs } from "@strapi/design-system";
|
|
6
|
+
import { useIntl } from "react-intl";
|
|
7
|
+
import { p as pluginId } from "./index-CHl-03dY.mjs";
|
|
8
|
+
import styled from "styled-components";
|
|
9
|
+
import { Plus, Trash, WarningCircle } from "@strapi/icons";
|
|
10
|
+
const getTrad = (id) => `${pluginId}.${id}`;
|
|
11
|
+
const ButtonWrapper = styled.div`
|
|
12
|
+
margin: 10px 0 0 0;
|
|
13
|
+
|
|
14
|
+
& button {
|
|
15
|
+
margin: 0 0 0 auto;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
const Description = styled.p`
|
|
19
|
+
font-size: 16px;
|
|
20
|
+
margin: 20px 0;
|
|
21
|
+
`;
|
|
22
|
+
function Role({ ssoRoles, roles, onSaveRole, onChangeRoleCheck }) {
|
|
23
|
+
const { formatMessage } = useIntl();
|
|
24
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
+
/* @__PURE__ */ jsxs(Table, { colCount: roles.length + 1, rowCount: ssoRoles.length, children: [
|
|
26
|
+
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
|
|
27
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Checkbox, { style: { display: "none" } }) }),
|
|
28
|
+
roles.map((role) => /* @__PURE__ */ jsx(Th, { children: role["name"] }, role["id"]))
|
|
29
|
+
] }) }),
|
|
30
|
+
/* @__PURE__ */ jsx(Tbody, { children: ssoRoles.map((ssoRole) => /* @__PURE__ */ jsxs(Tr, { children: [
|
|
31
|
+
/* @__PURE__ */ jsx(Td, { children: ssoRole["name"] }),
|
|
32
|
+
roles.map((role) => /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(
|
|
33
|
+
Checkbox,
|
|
34
|
+
{
|
|
35
|
+
checked: ssoRole["role"] && ssoRole["role"].includes(role["id"]),
|
|
36
|
+
onCheckedChange: (value) => onChangeRoleCheck(value, ssoRole["oauth_type"], role["id"]),
|
|
37
|
+
children: ""
|
|
38
|
+
}
|
|
39
|
+
) }, role["id"]))
|
|
40
|
+
] }, ssoRole["oauth_type"])) })
|
|
41
|
+
] }),
|
|
42
|
+
/* @__PURE__ */ jsx(Description, { children: formatMessage({
|
|
43
|
+
id: getTrad("page.notes"),
|
|
44
|
+
defaultMessage: "This will not be reflected for already registered users."
|
|
45
|
+
}) }),
|
|
46
|
+
/* @__PURE__ */ jsx(ButtonWrapper, { children: /* @__PURE__ */ jsx(Button, { variant: "default", onClick: onSaveRole, children: formatMessage({
|
|
47
|
+
id: getTrad("page.save"),
|
|
48
|
+
defaultMessage: "Save"
|
|
49
|
+
}) }) })
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
const LocalizedDate = ({ date }) => {
|
|
53
|
+
const userLocale = navigator.language || "en-US";
|
|
54
|
+
return new Intl.DateTimeFormat(userLocale, {
|
|
55
|
+
year: "numeric",
|
|
56
|
+
month: "long",
|
|
57
|
+
day: "numeric",
|
|
58
|
+
hour: "2-digit",
|
|
59
|
+
minute: "2-digit"
|
|
60
|
+
}).format(new Date(date));
|
|
61
|
+
};
|
|
62
|
+
function Whitelist({ users, roles, useWhitelist, loading, onSave, onDelete, onToggle }) {
|
|
63
|
+
const [email, setEmail] = useState("");
|
|
64
|
+
const [selectedRoles, setSelectedRoles] = useState([]);
|
|
65
|
+
const { formatMessage } = useIntl();
|
|
66
|
+
const onSaveEmail = useCallback(async () => {
|
|
67
|
+
const emailText = email.trim();
|
|
68
|
+
if (users.some((user) => user.email === emailText)) {
|
|
69
|
+
alert(
|
|
70
|
+
formatMessage({
|
|
71
|
+
id: getTrad("tab.whitelist.error.unique"),
|
|
72
|
+
defaultMessage: "Already registered email address."
|
|
73
|
+
})
|
|
74
|
+
);
|
|
75
|
+
} else {
|
|
76
|
+
await onSave(emailText, selectedRoles);
|
|
77
|
+
setEmail("");
|
|
78
|
+
setSelectedRoles([]);
|
|
79
|
+
}
|
|
80
|
+
}, [email, selectedRoles, users, onSave, formatMessage]);
|
|
81
|
+
const isValidEmail = useCallback(() => {
|
|
82
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
83
|
+
return emailRegex.test(email);
|
|
84
|
+
}, [email]);
|
|
85
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Box, { padding: 4, children: [
|
|
86
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 4, marginBottom: 4, children: [
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
Toggle,
|
|
89
|
+
{
|
|
90
|
+
checked: useWhitelist,
|
|
91
|
+
onLabel: "Enabled",
|
|
92
|
+
offLabel: "Disabled",
|
|
93
|
+
onChange: onToggle
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
/* @__PURE__ */ jsx(Typography, { variant: "delta", children: useWhitelist ? formatMessage({
|
|
97
|
+
id: getTrad("tab.whitelist.enabled"),
|
|
98
|
+
defaultMessage: "Whitelist is currently enabled."
|
|
99
|
+
}) : formatMessage({
|
|
100
|
+
id: getTrad("tab.whitelist.disabled"),
|
|
101
|
+
defaultMessage: "Whitelist is currently disabled."
|
|
102
|
+
}) })
|
|
103
|
+
] }),
|
|
104
|
+
/* @__PURE__ */ jsx(Typography, { tag: "p", marginBottom: 4, children: formatMessage({
|
|
105
|
+
id: getTrad("tab.whitelist.description"),
|
|
106
|
+
defaultMessage: "Only the following email addresses are allowed to authenticate with SSO."
|
|
107
|
+
}) }),
|
|
108
|
+
/* @__PURE__ */ jsxs(Grid.Root, { tag: "fieldset", gap: 4, padding: "0px", gridCols: 3, borderWidth: 0, marginTop: 5, marginBottom: 5, children: [
|
|
109
|
+
/* @__PURE__ */ jsx(Grid.Item, { xs: 1, children: /* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsx(
|
|
110
|
+
Field.Input,
|
|
111
|
+
{
|
|
112
|
+
type: "email",
|
|
113
|
+
disabled: loading,
|
|
114
|
+
value: email,
|
|
115
|
+
hasError: email && !isValidEmail(),
|
|
116
|
+
onChange: (e) => setEmail(e.currentTarget.value),
|
|
117
|
+
placeholder: "Email address"
|
|
118
|
+
}
|
|
119
|
+
) }) }),
|
|
120
|
+
/* @__PURE__ */ jsx(Grid.Item, { xs: 1, children: /* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsx(
|
|
121
|
+
MultiSelect,
|
|
122
|
+
{
|
|
123
|
+
placeholder: "Select specific roles",
|
|
124
|
+
withTags: true,
|
|
125
|
+
value: selectedRoles,
|
|
126
|
+
onChange: setSelectedRoles,
|
|
127
|
+
children: roles.map((role) => /* @__PURE__ */ jsx(MultiSelectOption, { value: role.id.toString(), children: role.name }, role.id))
|
|
128
|
+
}
|
|
129
|
+
) }) }),
|
|
130
|
+
/* @__PURE__ */ jsx(Grid.Item, { xs: 1, children: /* @__PURE__ */ jsx(
|
|
131
|
+
Button,
|
|
132
|
+
{
|
|
133
|
+
startIcon: /* @__PURE__ */ jsx(Plus, {}),
|
|
134
|
+
disabled: loading || email.trim() === "" || !isValidEmail(),
|
|
135
|
+
loading,
|
|
136
|
+
onClick: onSaveEmail,
|
|
137
|
+
children: formatMessage({
|
|
138
|
+
id: getTrad("page.save"),
|
|
139
|
+
defaultMessage: "Save"
|
|
140
|
+
})
|
|
141
|
+
}
|
|
142
|
+
) })
|
|
143
|
+
] }),
|
|
144
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
145
|
+
/* @__PURE__ */ jsxs(Table, { colCount: 5, rowCount: users.length, children: [
|
|
146
|
+
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
|
|
147
|
+
/* @__PURE__ */ jsx(Th, { children: formatMessage({
|
|
148
|
+
id: getTrad("tab.whitelist.table.no"),
|
|
149
|
+
defaultMessage: "No"
|
|
150
|
+
}) }),
|
|
151
|
+
/* @__PURE__ */ jsx(Th, { children: formatMessage({
|
|
152
|
+
id: getTrad("tab.whitelist.table.email"),
|
|
153
|
+
defaultMessage: "Email"
|
|
154
|
+
}) }),
|
|
155
|
+
/* @__PURE__ */ jsx(Th, { children: "Roles" }),
|
|
156
|
+
/* @__PURE__ */ jsx(Th, { children: formatMessage({
|
|
157
|
+
id: getTrad("tab.whitelist.table.created"),
|
|
158
|
+
defaultMessage: "Created At"
|
|
159
|
+
}) }),
|
|
160
|
+
/* @__PURE__ */ jsx(Th, { children: " " })
|
|
161
|
+
] }) }),
|
|
162
|
+
/* @__PURE__ */ jsx(Tbody, { children: users.map((user) => {
|
|
163
|
+
const userRolesNames = (user.roles || []).map((roleId) => {
|
|
164
|
+
const r = roles.find((ro) => ro.id.toString() === roleId.toString());
|
|
165
|
+
return r ? r.name : roleId;
|
|
166
|
+
}).join(", ");
|
|
167
|
+
return /* @__PURE__ */ jsxs(Tr, { children: [
|
|
168
|
+
/* @__PURE__ */ jsx(Td, { children: user.id }),
|
|
169
|
+
/* @__PURE__ */ jsx(Td, { children: user.email }),
|
|
170
|
+
/* @__PURE__ */ jsx(Td, { children: userRolesNames || "Default" }),
|
|
171
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(LocalizedDate, { date: user.createdAt }) }),
|
|
172
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Dialog.Root, { children: [
|
|
173
|
+
/* @__PURE__ */ jsx(Dialog.Trigger, { children: /* @__PURE__ */ jsx(IconButton, { label: "Delete", withTooltip: false, children: /* @__PURE__ */ jsx(Trash, {}) }) }),
|
|
174
|
+
/* @__PURE__ */ jsxs(Dialog.Content, { children: [
|
|
175
|
+
/* @__PURE__ */ jsx(Dialog.Header, { children: formatMessage({
|
|
176
|
+
id: getTrad("tab.whitelist.delete.title"),
|
|
177
|
+
defaultMessage: "Confirmation"
|
|
178
|
+
}) }),
|
|
179
|
+
/* @__PURE__ */ jsx(Dialog.Body, { icon: /* @__PURE__ */ jsx(WarningCircle, { fill: "danger600" }), children: /* @__PURE__ */ jsxs(Typography, { variant: "delta", children: [
|
|
180
|
+
formatMessage({
|
|
181
|
+
id: getTrad("tab.whitelist.delete.description"),
|
|
182
|
+
defaultMessage: "Are you sure you want to delete this?"
|
|
183
|
+
}),
|
|
184
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
185
|
+
user.email
|
|
186
|
+
] }) }),
|
|
187
|
+
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
|
188
|
+
/* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { fullWidth: true, variant: "tertiary", children: formatMessage({
|
|
189
|
+
id: getTrad("page.cancel"),
|
|
190
|
+
defaultMessage: "Cancel"
|
|
191
|
+
}) }) }),
|
|
192
|
+
/* @__PURE__ */ jsx(Dialog.Action, { children: /* @__PURE__ */ jsx(Button, { fullWidth: true, variant: "danger-light", onClick: () => onDelete(user.id), children: formatMessage({
|
|
193
|
+
id: getTrad("page.ok"),
|
|
194
|
+
defaultMessage: "OK"
|
|
195
|
+
}) }) })
|
|
196
|
+
] })
|
|
197
|
+
] })
|
|
198
|
+
] }) })
|
|
199
|
+
] }, user.id);
|
|
200
|
+
}) })
|
|
201
|
+
] })
|
|
202
|
+
] }) });
|
|
203
|
+
}
|
|
204
|
+
const AlertMessage = styled.div`
|
|
205
|
+
margin-left: -250px;
|
|
206
|
+
position: fixed;
|
|
207
|
+
left: 50%;
|
|
208
|
+
top: 2.875rem;
|
|
209
|
+
z-index: 10;
|
|
210
|
+
width: 31.25rem;
|
|
211
|
+
`;
|
|
212
|
+
function SuccessAlertMessage({ onClose: onClose2 }) {
|
|
213
|
+
const { formatMessage } = useIntl();
|
|
214
|
+
return /* @__PURE__ */ jsx(AlertMessage, { children: /* @__PURE__ */ jsx(
|
|
215
|
+
Alert,
|
|
216
|
+
{
|
|
217
|
+
title: "Success",
|
|
218
|
+
variant: "success",
|
|
219
|
+
closeLabel: "",
|
|
220
|
+
onClose: onClose2,
|
|
221
|
+
children: formatMessage({
|
|
222
|
+
id: getTrad("page.save.success"),
|
|
223
|
+
defaultMessage: "Updated settings"
|
|
224
|
+
})
|
|
225
|
+
}
|
|
226
|
+
) });
|
|
227
|
+
}
|
|
228
|
+
function ErrorAlertMessage() {
|
|
229
|
+
const { formatMessage } = useIntl();
|
|
230
|
+
return /* @__PURE__ */ jsx(AlertMessage, { children: /* @__PURE__ */ jsx(
|
|
231
|
+
Alert,
|
|
232
|
+
{
|
|
233
|
+
title: "Error",
|
|
234
|
+
variant: "danger",
|
|
235
|
+
closeLabel: "",
|
|
236
|
+
onClose,
|
|
237
|
+
children: formatMessage({
|
|
238
|
+
id: getTrad("page.save.error"),
|
|
239
|
+
defaultMessage: "Update failed."
|
|
240
|
+
})
|
|
241
|
+
}
|
|
242
|
+
) });
|
|
243
|
+
}
|
|
244
|
+
const HomePage = () => {
|
|
245
|
+
const { formatMessage } = useIntl();
|
|
246
|
+
const [loading, setLoading] = useState(false);
|
|
247
|
+
const [ssoRoles, setSSORoles] = useState([]);
|
|
248
|
+
const [roles, setRoles] = useState([]);
|
|
249
|
+
const [useWhitelist, setUseWhitelist] = useState(false);
|
|
250
|
+
const [users, setUsers] = useState([]);
|
|
251
|
+
const [showSuccess, setSuccess] = useState(false);
|
|
252
|
+
const [showError, setError] = useState(false);
|
|
253
|
+
const { get, put, post, del } = useFetchClient();
|
|
254
|
+
useEffect(() => {
|
|
255
|
+
get(`/strapi-plugin-oidc/sso-roles`).then((response) => {
|
|
256
|
+
setSSORoles(response.data);
|
|
257
|
+
});
|
|
258
|
+
get(`/admin/roles`).then((response) => {
|
|
259
|
+
setRoles(response.data.data);
|
|
260
|
+
});
|
|
261
|
+
get("/strapi-plugin-oidc/whitelist").then((response) => {
|
|
262
|
+
setUsers(response.data.whitelistUsers);
|
|
263
|
+
setUseWhitelist(response.data.useWhitelist);
|
|
264
|
+
});
|
|
265
|
+
}, [setSSORoles, setRoles]);
|
|
266
|
+
const onChangeRoleCheck = (value, ssoId, role) => {
|
|
267
|
+
for (const ssoRole of ssoRoles) {
|
|
268
|
+
if (ssoRole["oauth_type"] === ssoId) {
|
|
269
|
+
if (ssoRole["role"]) {
|
|
270
|
+
if (value) {
|
|
271
|
+
ssoRole["role"].push(role);
|
|
272
|
+
} else {
|
|
273
|
+
ssoRole["role"] = ssoRole["role"].filter((selectRole) => selectRole !== role);
|
|
274
|
+
}
|
|
275
|
+
} else {
|
|
276
|
+
ssoRole["role"] = [role];
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
setSSORoles(ssoRoles.slice());
|
|
281
|
+
};
|
|
282
|
+
const onSaveRole = async () => {
|
|
283
|
+
try {
|
|
284
|
+
await put("/strapi-plugin-oidc/sso-roles", {
|
|
285
|
+
roles: ssoRoles.map((role) => ({
|
|
286
|
+
"oauth_type": role["oauth_type"],
|
|
287
|
+
role: role["role"]
|
|
288
|
+
}))
|
|
289
|
+
});
|
|
290
|
+
setSuccess(true);
|
|
291
|
+
setTimeout(() => {
|
|
292
|
+
setSuccess(false);
|
|
293
|
+
}, 3e3);
|
|
294
|
+
} catch (e) {
|
|
295
|
+
console.error(e);
|
|
296
|
+
setError(true);
|
|
297
|
+
setTimeout(() => {
|
|
298
|
+
setError(false);
|
|
299
|
+
}, 3e3);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
const onRegisterWhitelist = async (email, selectedRoles) => {
|
|
303
|
+
setLoading(true);
|
|
304
|
+
post("/strapi-plugin-oidc/whitelist", {
|
|
305
|
+
email,
|
|
306
|
+
roles: selectedRoles
|
|
307
|
+
}).then((response) => {
|
|
308
|
+
get("/strapi-plugin-oidc/whitelist").then((response2) => {
|
|
309
|
+
setUsers(response2.data.whitelistUsers);
|
|
310
|
+
setUseWhitelist(response2.data.useWhitelist);
|
|
311
|
+
});
|
|
312
|
+
setLoading(false);
|
|
313
|
+
setSuccess(true);
|
|
314
|
+
setTimeout(() => {
|
|
315
|
+
setSuccess(false);
|
|
316
|
+
}, 3e3);
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
const onDeleteWhitelist = async (id) => {
|
|
320
|
+
setLoading(true);
|
|
321
|
+
del(`/strapi-plugin-oidc/whitelist/${id}`).then((response) => {
|
|
322
|
+
get("/strapi-plugin-oidc/whitelist").then((response2) => {
|
|
323
|
+
setUsers(response2.data.whitelistUsers);
|
|
324
|
+
setUseWhitelist(response2.data.useWhitelist);
|
|
325
|
+
});
|
|
326
|
+
setLoading(false);
|
|
327
|
+
setSuccess(true);
|
|
328
|
+
setTimeout(() => {
|
|
329
|
+
setSuccess(false);
|
|
330
|
+
}, 3e3);
|
|
331
|
+
});
|
|
332
|
+
};
|
|
333
|
+
const onToggleWhitelist = async (e) => {
|
|
334
|
+
const newValue = e.target.checked;
|
|
335
|
+
setLoading(true);
|
|
336
|
+
try {
|
|
337
|
+
await put("/strapi-plugin-oidc/whitelist/settings", {
|
|
338
|
+
useWhitelist: newValue
|
|
339
|
+
});
|
|
340
|
+
setUseWhitelist(newValue);
|
|
341
|
+
setSuccess(true);
|
|
342
|
+
setTimeout(() => {
|
|
343
|
+
setSuccess(false);
|
|
344
|
+
}, 3e3);
|
|
345
|
+
} catch (err) {
|
|
346
|
+
console.error(err);
|
|
347
|
+
setError(true);
|
|
348
|
+
setTimeout(() => {
|
|
349
|
+
setError(false);
|
|
350
|
+
}, 3e3);
|
|
351
|
+
} finally {
|
|
352
|
+
setLoading(false);
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
return /* @__PURE__ */ jsxs(Page.Protect, { permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }], children: [
|
|
356
|
+
/* @__PURE__ */ jsx(
|
|
357
|
+
Layouts.Header,
|
|
358
|
+
{
|
|
359
|
+
title: "OIDC",
|
|
360
|
+
subtitle: formatMessage({
|
|
361
|
+
id: getTrad("page.title"),
|
|
362
|
+
defaultMessage: "Default role setting at first login"
|
|
363
|
+
})
|
|
364
|
+
}
|
|
365
|
+
),
|
|
366
|
+
showSuccess && /* @__PURE__ */ jsx(SuccessAlertMessage, { onClose: () => setSuccess(false) }),
|
|
367
|
+
showError && /* @__PURE__ */ jsx(ErrorAlertMessage, { onClose: () => setError(false) }),
|
|
368
|
+
/* @__PURE__ */ jsx(Box, { padding: 10, children: /* @__PURE__ */ jsxs(Tabs.Root, { defaultValue: "role", children: [
|
|
369
|
+
/* @__PURE__ */ jsxs(Tabs.List, { "aria-label": "Manage your attribute", style: { maxWidth: 300 }, children: [
|
|
370
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { value: "role", children: formatMessage({
|
|
371
|
+
id: getTrad("tab.roles"),
|
|
372
|
+
defaultMessage: "Roles"
|
|
373
|
+
}) }),
|
|
374
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { value: "whitelist", children: formatMessage({
|
|
375
|
+
id: getTrad("tab.whitelist"),
|
|
376
|
+
defaultMessage: "Whitelist"
|
|
377
|
+
}) })
|
|
378
|
+
] }),
|
|
379
|
+
/* @__PURE__ */ jsx(Tabs.Content, { value: "role", style: { background: "initial" }, children: /* @__PURE__ */ jsx(
|
|
380
|
+
Role,
|
|
381
|
+
{
|
|
382
|
+
roles,
|
|
383
|
+
ssoRoles,
|
|
384
|
+
onSaveRole,
|
|
385
|
+
onChangeRoleCheck
|
|
386
|
+
}
|
|
387
|
+
) }),
|
|
388
|
+
/* @__PURE__ */ jsx(Tabs.Content, { value: "whitelist", children: /* @__PURE__ */ jsx(
|
|
389
|
+
Whitelist,
|
|
390
|
+
{
|
|
391
|
+
loading,
|
|
392
|
+
users,
|
|
393
|
+
roles,
|
|
394
|
+
useWhitelist,
|
|
395
|
+
onSave: onRegisterWhitelist,
|
|
396
|
+
onDelete: onDeleteWhitelist,
|
|
397
|
+
onToggle: onToggleWhitelist
|
|
398
|
+
}
|
|
399
|
+
) })
|
|
400
|
+
] }) })
|
|
401
|
+
] });
|
|
402
|
+
};
|
|
403
|
+
const HomePage$1 = memo(HomePage);
|
|
404
|
+
const App = () => {
|
|
405
|
+
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(Routes, { children: [
|
|
406
|
+
/* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx(HomePage$1, {}) }),
|
|
407
|
+
/* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(Page.Error, {}) })
|
|
408
|
+
] }) });
|
|
409
|
+
};
|
|
410
|
+
export {
|
|
411
|
+
App as default
|
|
412
|
+
};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
import "react/jsx-runtime";
|
|
3
|
+
import "@strapi/icons";
|
|
4
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
5
|
+
const v = glob[path];
|
|
6
|
+
if (v) {
|
|
7
|
+
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
8
|
+
}
|
|
9
|
+
return new Promise((_, reject) => {
|
|
10
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
|
11
|
+
reject.bind(
|
|
12
|
+
null,
|
|
13
|
+
new Error(
|
|
14
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
|
15
|
+
)
|
|
16
|
+
)
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const name$1 = "strapi-plugin-oidc";
|
|
21
|
+
const version = "1.0.8";
|
|
22
|
+
const description = "OIDC Single Sign On plugin for Strapi!";
|
|
23
|
+
const strapi = {
|
|
24
|
+
displayName: "OIDC",
|
|
25
|
+
name: "strapi-plugin-oidc",
|
|
26
|
+
description: "Provides OIDC middleware for Strapi instances",
|
|
27
|
+
kind: "plugin"
|
|
28
|
+
};
|
|
29
|
+
const scripts = {
|
|
30
|
+
build: "strapi-plugin build",
|
|
31
|
+
watch: "strapi-plugin watch",
|
|
32
|
+
"watch:link": "strapi-plugin watch:link",
|
|
33
|
+
verify: "strapi-plugin verify",
|
|
34
|
+
test: "jest",
|
|
35
|
+
lint: "eslint"
|
|
36
|
+
};
|
|
37
|
+
const keywords = [
|
|
38
|
+
"strapi",
|
|
39
|
+
"plugin",
|
|
40
|
+
"oauth",
|
|
41
|
+
"SSO",
|
|
42
|
+
"OIDC",
|
|
43
|
+
"Zitadel"
|
|
44
|
+
];
|
|
45
|
+
const peerDependencies = {
|
|
46
|
+
"@strapi/strapi": "^5.24.1"
|
|
47
|
+
};
|
|
48
|
+
const dependencies = {
|
|
49
|
+
"@strapi/design-system": "^2.0.0-rc.11",
|
|
50
|
+
"@strapi/icons": "^2.0.0-rc.11",
|
|
51
|
+
"@strapi/utils": "^5.24.1",
|
|
52
|
+
axios: "^1.8.4",
|
|
53
|
+
"baseline-browser-mapping": "^2.10.14",
|
|
54
|
+
"caniuse-lite": "^1.0.30001785",
|
|
55
|
+
"generate-password": "^1.7.1",
|
|
56
|
+
"pkce-challenge": "^3.1.0",
|
|
57
|
+
react: "^18.0.0",
|
|
58
|
+
"react-dom": "^18.0.0",
|
|
59
|
+
"react-intl": "^6.0.0",
|
|
60
|
+
"react-router-dom": "^6.0.0",
|
|
61
|
+
"styled-components": "^6.0.0"
|
|
62
|
+
};
|
|
63
|
+
const author = {
|
|
64
|
+
name: "edmogeor",
|
|
65
|
+
url: "https://github.com/edmogeor/strapi-plugin-oidc"
|
|
66
|
+
};
|
|
67
|
+
const repository = {
|
|
68
|
+
type: "git",
|
|
69
|
+
url: "https://github.com/edmogeor/strapi-plugin-oidc"
|
|
70
|
+
};
|
|
71
|
+
const bugs = {
|
|
72
|
+
url: "https://github.com/edmogeor/strapi-plugin-oidc/issues"
|
|
73
|
+
};
|
|
74
|
+
const maintainers = [
|
|
75
|
+
{
|
|
76
|
+
name: "edmogeor"
|
|
77
|
+
}
|
|
78
|
+
];
|
|
79
|
+
const engines = {
|
|
80
|
+
node: ">=20.0.0 <=24.x.x",
|
|
81
|
+
npm: ">=6.0.0"
|
|
82
|
+
};
|
|
83
|
+
const files = [
|
|
84
|
+
"dist"
|
|
85
|
+
];
|
|
86
|
+
const license = "MIT";
|
|
87
|
+
const devDependencies = {
|
|
88
|
+
"@strapi/sdk-plugin": "^5.2.0",
|
|
89
|
+
eslint: "^9.0.0",
|
|
90
|
+
globals: "^15.9.0",
|
|
91
|
+
jest: "^29.3.1"
|
|
92
|
+
};
|
|
93
|
+
const jest = {
|
|
94
|
+
testPathIgnorePatterns: [
|
|
95
|
+
"/node_modules/",
|
|
96
|
+
".tmp",
|
|
97
|
+
"dist",
|
|
98
|
+
".cache"
|
|
99
|
+
],
|
|
100
|
+
testEnvironment: "node"
|
|
101
|
+
};
|
|
102
|
+
const exports = {
|
|
103
|
+
"./package.json": "./package.json",
|
|
104
|
+
"./strapi-admin": {
|
|
105
|
+
source: "./admin/src/index.js",
|
|
106
|
+
"import": "./dist/admin/index.mjs",
|
|
107
|
+
require: "./dist/admin/index.js",
|
|
108
|
+
"default": "./dist/admin/index.js"
|
|
109
|
+
},
|
|
110
|
+
"./strapi-server": {
|
|
111
|
+
source: "./server/index.js",
|
|
112
|
+
"import": "./dist/server/index.mjs",
|
|
113
|
+
require: "./dist/server/index.js",
|
|
114
|
+
"default": "./dist/server/index.js"
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const pluginPkg = {
|
|
118
|
+
name: name$1,
|
|
119
|
+
version,
|
|
120
|
+
description,
|
|
121
|
+
strapi,
|
|
122
|
+
scripts,
|
|
123
|
+
keywords,
|
|
124
|
+
peerDependencies,
|
|
125
|
+
dependencies,
|
|
126
|
+
author,
|
|
127
|
+
repository,
|
|
128
|
+
bugs,
|
|
129
|
+
maintainers,
|
|
130
|
+
engines,
|
|
131
|
+
files,
|
|
132
|
+
license,
|
|
133
|
+
devDependencies,
|
|
134
|
+
jest,
|
|
135
|
+
exports
|
|
136
|
+
};
|
|
137
|
+
const pluginId = pluginPkg.name.replace(/^@strapi\/plugin-/i, "");
|
|
138
|
+
const getTranslation = (id) => `${pluginId}.${id}`;
|
|
139
|
+
const Initializer = ({ setPlugin }) => {
|
|
140
|
+
const ref = useRef();
|
|
141
|
+
ref.current = setPlugin;
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
ref.current(pluginId);
|
|
144
|
+
}, []);
|
|
145
|
+
return null;
|
|
146
|
+
};
|
|
147
|
+
const name = pluginPkg.strapi.displayName;
|
|
148
|
+
const index = {
|
|
149
|
+
register(app) {
|
|
150
|
+
app.addSettingsLink(
|
|
151
|
+
{
|
|
152
|
+
id: "oidc",
|
|
153
|
+
intlLabel: {
|
|
154
|
+
id: `${pluginId}.settings.section`,
|
|
155
|
+
defaultMessage: "OIDC"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: "configuration",
|
|
160
|
+
to: `/settings/${pluginId}`,
|
|
161
|
+
intlLabel: {
|
|
162
|
+
id: `${pluginId}.settings.configuration`,
|
|
163
|
+
defaultMessage: "Configuration"
|
|
164
|
+
},
|
|
165
|
+
Component: async () => {
|
|
166
|
+
return await import("./index-BuS0wmlA.mjs");
|
|
167
|
+
},
|
|
168
|
+
permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }]
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
app.registerPlugin({
|
|
172
|
+
id: pluginId,
|
|
173
|
+
initializer: Initializer,
|
|
174
|
+
name
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
bootstrap(app) {
|
|
178
|
+
},
|
|
179
|
+
async registerTrads({ locales }) {
|
|
180
|
+
const importedTrads = await Promise.all(
|
|
181
|
+
locales.map((locale) => {
|
|
182
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-AsM8uCFB.mjs"), "./translations/fr.json": () => import("./fr-hkSxFuzl.mjs"), "./translations/ja.json": () => import("./ja-COdupAQd.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
|
183
|
+
const newData = Object.fromEntries(
|
|
184
|
+
Object.entries(data).map(([key, value]) => [getTranslation(key), value])
|
|
185
|
+
);
|
|
186
|
+
return {
|
|
187
|
+
data: newData,
|
|
188
|
+
locale
|
|
189
|
+
};
|
|
190
|
+
}).catch(() => {
|
|
191
|
+
return {
|
|
192
|
+
data: {},
|
|
193
|
+
locale
|
|
194
|
+
};
|
|
195
|
+
});
|
|
196
|
+
})
|
|
197
|
+
);
|
|
198
|
+
return Promise.resolve(importedTrads);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
export {
|
|
202
|
+
index as i,
|
|
203
|
+
pluginId as p
|
|
204
|
+
};
|