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,203 @@
|
|
|
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;
|
|
@@ -0,0 +1,23 @@
|
|
|
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;
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const en = {
|
|
2
|
+
"global.plugins.strapi-plugin-oidc": "OIDC Plugin",
|
|
3
|
+
"page.title": "Configure OIDC default role(s) and access controls.",
|
|
4
|
+
"roles.notes": "Select the default role(s) assigned to new users upon their first login. This setting does not affect existing users.",
|
|
5
|
+
"page.save": "Save Changes",
|
|
6
|
+
"page.save.success": "Updated settings",
|
|
7
|
+
"page.save.error": "Update failed.",
|
|
8
|
+
"page.add": "Add",
|
|
9
|
+
"page.cancel": "Cancel",
|
|
10
|
+
"page.ok": "OK",
|
|
11
|
+
"roles.title": "Default Role(s)",
|
|
12
|
+
"whitelist.title": "Whitelist",
|
|
13
|
+
"whitelist.error.unique": "Already registered email address.",
|
|
14
|
+
"whitelist.enabled": "Whitelist is currently enabled.",
|
|
15
|
+
"whitelist.disabled": "Whitelist is currently disabled.",
|
|
16
|
+
"whitelist.description": "Restrict OIDC authentication to specific email addresses and optionally assign them custom role(s).",
|
|
17
|
+
"whitelist.user_exists": "User already exists, matching existing role(s)",
|
|
18
|
+
"whitelist.users_exists": "Users already exist, matching existing role(s)",
|
|
19
|
+
"whitelist.table.no": "No.",
|
|
20
|
+
"whitelist.table.email": "Email",
|
|
21
|
+
"whitelist.table.created": "Created At",
|
|
22
|
+
"whitelist.delete.title": "Confirmation",
|
|
23
|
+
"whitelist.delete.description": "Are you sure you want to delete:",
|
|
24
|
+
"whitelist.delete.note": "This will not delete the user account in Strapi.",
|
|
25
|
+
"whitelist.toggle.enabled": "Enabled",
|
|
26
|
+
"whitelist.toggle.disabled": "Disabled",
|
|
27
|
+
"whitelist.email.placeholder": "Email address",
|
|
28
|
+
"whitelist.roles.placeholder": "Select specific role(s)",
|
|
29
|
+
"whitelist.table.roles": "Role(s)",
|
|
30
|
+
"whitelist.table.roles.default": "Default",
|
|
31
|
+
"whitelist.table.empty": "No email addresses",
|
|
32
|
+
"whitelist.delete.label": "Delete",
|
|
33
|
+
"page.title.oidc": "OIDC",
|
|
34
|
+
"enforce.title": "Enforce OIDC Login",
|
|
35
|
+
"enforce.toggle.enabled": "Enabled",
|
|
36
|
+
"enforce.toggle.disabled": "Disabled",
|
|
37
|
+
"enforce.warning": "Make sure OIDC is setup correctly before saving changes, you won't be able to login normally."
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
en as default
|
|
41
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const en = {
|
|
4
|
+
"global.plugins.strapi-plugin-oidc": "OIDC Plugin",
|
|
5
|
+
"page.title": "Configure OIDC default role(s) and access controls.",
|
|
6
|
+
"roles.notes": "Select the default role(s) assigned to new users upon their first login. This setting does not affect existing users.",
|
|
7
|
+
"page.save": "Save Changes",
|
|
8
|
+
"page.save.success": "Updated settings",
|
|
9
|
+
"page.save.error": "Update failed.",
|
|
10
|
+
"page.add": "Add",
|
|
11
|
+
"page.cancel": "Cancel",
|
|
12
|
+
"page.ok": "OK",
|
|
13
|
+
"roles.title": "Default Role(s)",
|
|
14
|
+
"whitelist.title": "Whitelist",
|
|
15
|
+
"whitelist.error.unique": "Already registered email address.",
|
|
16
|
+
"whitelist.enabled": "Whitelist is currently enabled.",
|
|
17
|
+
"whitelist.disabled": "Whitelist is currently disabled.",
|
|
18
|
+
"whitelist.description": "Restrict OIDC authentication to specific email addresses and optionally assign them custom role(s).",
|
|
19
|
+
"whitelist.user_exists": "User already exists, matching existing role(s)",
|
|
20
|
+
"whitelist.users_exists": "Users already exist, matching existing role(s)",
|
|
21
|
+
"whitelist.table.no": "No.",
|
|
22
|
+
"whitelist.table.email": "Email",
|
|
23
|
+
"whitelist.table.created": "Created At",
|
|
24
|
+
"whitelist.delete.title": "Confirmation",
|
|
25
|
+
"whitelist.delete.description": "Are you sure you want to delete:",
|
|
26
|
+
"whitelist.delete.note": "This will not delete the user account in Strapi.",
|
|
27
|
+
"whitelist.toggle.enabled": "Enabled",
|
|
28
|
+
"whitelist.toggle.disabled": "Disabled",
|
|
29
|
+
"whitelist.email.placeholder": "Email address",
|
|
30
|
+
"whitelist.roles.placeholder": "Select specific role(s)",
|
|
31
|
+
"whitelist.table.roles": "Role(s)",
|
|
32
|
+
"whitelist.table.roles.default": "Default",
|
|
33
|
+
"whitelist.table.empty": "No email addresses",
|
|
34
|
+
"whitelist.delete.label": "Delete",
|
|
35
|
+
"page.title.oidc": "OIDC",
|
|
36
|
+
"enforce.title": "Enforce OIDC Login",
|
|
37
|
+
"enforce.toggle.enabled": "Enabled",
|
|
38
|
+
"enforce.toggle.disabled": "Disabled",
|
|
39
|
+
"enforce.warning": "Make sure OIDC is setup correctly before saving changes, you won't be able to login normally."
|
|
40
|
+
};
|
|
41
|
+
exports.default = en;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
3
|
+
const v = glob[path];
|
|
4
|
+
if (v) {
|
|
5
|
+
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
6
|
+
}
|
|
7
|
+
return new Promise((_, reject) => {
|
|
8
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
|
9
|
+
reject.bind(
|
|
10
|
+
null,
|
|
11
|
+
new Error(
|
|
12
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
|
13
|
+
)
|
|
14
|
+
)
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const name$1 = "strapi-plugin-oidc";
|
|
19
|
+
const strapi = { "displayName": "OIDC Plugin" };
|
|
20
|
+
const pluginPkg = {
|
|
21
|
+
name: name$1,
|
|
22
|
+
strapi
|
|
23
|
+
};
|
|
24
|
+
const pluginId = pluginPkg.name.replace(/^@strapi\/plugin-/i, "");
|
|
25
|
+
function getTranslation(id) {
|
|
26
|
+
return `${pluginId}.${id}`;
|
|
27
|
+
}
|
|
28
|
+
function Initializer({ setPlugin }) {
|
|
29
|
+
const ref = useRef();
|
|
30
|
+
ref.current = setPlugin;
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (ref.current) {
|
|
33
|
+
ref.current(pluginId);
|
|
34
|
+
}
|
|
35
|
+
}, []);
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const name = pluginPkg.strapi.displayName;
|
|
39
|
+
const index = {
|
|
40
|
+
register(app) {
|
|
41
|
+
app.addSettingsLink(
|
|
42
|
+
{
|
|
43
|
+
id: "oidc",
|
|
44
|
+
intlLabel: {
|
|
45
|
+
id: `${pluginId}.settings.section`,
|
|
46
|
+
defaultMessage: "OIDC"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "configuration",
|
|
51
|
+
to: `/settings/${pluginId}`,
|
|
52
|
+
intlLabel: {
|
|
53
|
+
id: `${pluginId}.settings.configuration`,
|
|
54
|
+
defaultMessage: "Configuration"
|
|
55
|
+
},
|
|
56
|
+
Component: async () => {
|
|
57
|
+
return await import("./index-DwpTg1-J.mjs");
|
|
58
|
+
},
|
|
59
|
+
permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }]
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
app.registerPlugin({
|
|
63
|
+
id: pluginId,
|
|
64
|
+
initializer: Initializer,
|
|
65
|
+
name
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
bootstrap() {
|
|
69
|
+
const checkEnforceOIDC = async () => {
|
|
70
|
+
try {
|
|
71
|
+
const response = await window.fetch("/strapi-plugin-oidc/settings/public");
|
|
72
|
+
if (response.ok) {
|
|
73
|
+
const data = await response.json();
|
|
74
|
+
if (data.enforceOIDC) {
|
|
75
|
+
const currentPath = window.location.pathname;
|
|
76
|
+
if (currentPath.endsWith("/auth/login")) {
|
|
77
|
+
window.location.href = "/strapi-plugin-oidc/oidc";
|
|
78
|
+
}
|
|
79
|
+
const originalPushState = window.history.pushState;
|
|
80
|
+
window.history.pushState = 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 originalPushState.apply(window.history, args);
|
|
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);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error("Failed to check OIDC enforcement setting:", error);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
checkEnforceOIDC();
|
|
104
|
+
const originalFetch = window.fetch;
|
|
105
|
+
window.fetch = async (...args) => {
|
|
106
|
+
const url = typeof args[0] === "string" ? args[0] : args[0].url;
|
|
107
|
+
const isLogout = url && url.endsWith("/admin/logout") && args[1]?.method?.toUpperCase() === "POST";
|
|
108
|
+
const response = await originalFetch(...args);
|
|
109
|
+
if (isLogout && response.ok) {
|
|
110
|
+
window.location.href = "/strapi-plugin-oidc/logout";
|
|
111
|
+
}
|
|
112
|
+
return response;
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
async registerTrads({ locales }) {
|
|
116
|
+
const importedTrads = await Promise.all(
|
|
117
|
+
locales.map((locale) => {
|
|
118
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-f0TxVfx7.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
|
119
|
+
const newData = Object.fromEntries(
|
|
120
|
+
Object.entries(data).map(([key, value]) => [
|
|
121
|
+
key.startsWith("global.") ? key : getTranslation(key),
|
|
122
|
+
value
|
|
123
|
+
])
|
|
124
|
+
);
|
|
125
|
+
return {
|
|
126
|
+
data: newData,
|
|
127
|
+
locale
|
|
128
|
+
};
|
|
129
|
+
}).catch(() => {
|
|
130
|
+
return {
|
|
131
|
+
data: {},
|
|
132
|
+
locale
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
})
|
|
136
|
+
);
|
|
137
|
+
return Promise.resolve(importedTrads);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
export {
|
|
141
|
+
index as i,
|
|
142
|
+
pluginId as p
|
|
143
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const react = require("react");
|
|
3
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
4
|
+
const v = glob[path];
|
|
5
|
+
if (v) {
|
|
6
|
+
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
7
|
+
}
|
|
8
|
+
return new Promise((_, reject) => {
|
|
9
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
|
10
|
+
reject.bind(
|
|
11
|
+
null,
|
|
12
|
+
new Error(
|
|
13
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
|
14
|
+
)
|
|
15
|
+
)
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
const name$1 = "strapi-plugin-oidc";
|
|
20
|
+
const strapi = { "displayName": "OIDC Plugin" };
|
|
21
|
+
const pluginPkg = {
|
|
22
|
+
name: name$1,
|
|
23
|
+
strapi
|
|
24
|
+
};
|
|
25
|
+
const pluginId = pluginPkg.name.replace(/^@strapi\/plugin-/i, "");
|
|
26
|
+
function getTranslation(id) {
|
|
27
|
+
return `${pluginId}.${id}`;
|
|
28
|
+
}
|
|
29
|
+
function Initializer({ setPlugin }) {
|
|
30
|
+
const ref = react.useRef();
|
|
31
|
+
ref.current = setPlugin;
|
|
32
|
+
react.useEffect(() => {
|
|
33
|
+
if (ref.current) {
|
|
34
|
+
ref.current(pluginId);
|
|
35
|
+
}
|
|
36
|
+
}, []);
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const name = pluginPkg.strapi.displayName;
|
|
40
|
+
const index = {
|
|
41
|
+
register(app) {
|
|
42
|
+
app.addSettingsLink(
|
|
43
|
+
{
|
|
44
|
+
id: "oidc",
|
|
45
|
+
intlLabel: {
|
|
46
|
+
id: `${pluginId}.settings.section`,
|
|
47
|
+
defaultMessage: "OIDC"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "configuration",
|
|
52
|
+
to: `/settings/${pluginId}`,
|
|
53
|
+
intlLabel: {
|
|
54
|
+
id: `${pluginId}.settings.configuration`,
|
|
55
|
+
defaultMessage: "Configuration"
|
|
56
|
+
},
|
|
57
|
+
Component: async () => {
|
|
58
|
+
return await Promise.resolve().then(() => require("./index-D_0jCOLk.js"));
|
|
59
|
+
},
|
|
60
|
+
permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }]
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
app.registerPlugin({
|
|
64
|
+
id: pluginId,
|
|
65
|
+
initializer: Initializer,
|
|
66
|
+
name
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
bootstrap() {
|
|
70
|
+
const checkEnforceOIDC = async () => {
|
|
71
|
+
try {
|
|
72
|
+
const response = await window.fetch("/strapi-plugin-oidc/settings/public");
|
|
73
|
+
if (response.ok) {
|
|
74
|
+
const data = await response.json();
|
|
75
|
+
if (data.enforceOIDC) {
|
|
76
|
+
const currentPath = window.location.pathname;
|
|
77
|
+
if (currentPath.endsWith("/auth/login")) {
|
|
78
|
+
window.location.href = "/strapi-plugin-oidc/oidc";
|
|
79
|
+
}
|
|
80
|
+
const originalPushState = window.history.pushState;
|
|
81
|
+
window.history.pushState = 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 originalPushState.apply(window.history, args);
|
|
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);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
} catch (error) {
|
|
101
|
+
console.error("Failed to check OIDC enforcement setting:", error);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
checkEnforceOIDC();
|
|
105
|
+
const originalFetch = window.fetch;
|
|
106
|
+
window.fetch = async (...args) => {
|
|
107
|
+
const url = typeof args[0] === "string" ? args[0] : args[0].url;
|
|
108
|
+
const isLogout = url && url.endsWith("/admin/logout") && args[1]?.method?.toUpperCase() === "POST";
|
|
109
|
+
const response = await originalFetch(...args);
|
|
110
|
+
if (isLogout && response.ok) {
|
|
111
|
+
window.location.href = "/strapi-plugin-oidc/logout";
|
|
112
|
+
}
|
|
113
|
+
return response;
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
async registerTrads({ locales }) {
|
|
117
|
+
const importedTrads = await Promise.all(
|
|
118
|
+
locales.map((locale) => {
|
|
119
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-jFPbEFeK.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
|
120
|
+
const newData = Object.fromEntries(
|
|
121
|
+
Object.entries(data).map(([key, value]) => [
|
|
122
|
+
key.startsWith("global.") ? key : getTranslation(key),
|
|
123
|
+
value
|
|
124
|
+
])
|
|
125
|
+
);
|
|
126
|
+
return {
|
|
127
|
+
data: newData,
|
|
128
|
+
locale
|
|
129
|
+
};
|
|
130
|
+
}).catch(() => {
|
|
131
|
+
return {
|
|
132
|
+
data: {},
|
|
133
|
+
locale
|
|
134
|
+
};
|
|
135
|
+
});
|
|
136
|
+
})
|
|
137
|
+
);
|
|
138
|
+
return Promise.resolve(importedTrads);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
exports.index = index;
|
|
142
|
+
exports.pluginId = pluginId;
|