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