@strapi/plugin-users-permissions 5.50.1 → 5.51.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/admin/src/pages/Roles/pages/EditPage.jsx +1 -1
- package/admin/src/translations/en.json +2 -0
- package/admin/src/translations/ko.json +2 -1
- package/dist/admin/pages/Roles/pages/EditPage.js +1 -1
- package/dist/admin/pages/Roles/pages/EditPage.js.map +1 -1
- package/dist/admin/pages/Roles/pages/EditPage.mjs +1 -1
- package/dist/admin/pages/Roles/pages/EditPage.mjs.map +1 -1
- package/dist/admin/translations/en.json.js +1 -0
- package/dist/admin/translations/en.json.js.map +1 -1
- package/dist/admin/translations/en.json.mjs +1 -0
- package/dist/admin/translations/en.json.mjs.map +1 -1
- package/dist/admin/translations/ko.json.js +2 -1
- package/dist/admin/translations/ko.json.js.map +1 -1
- package/dist/admin/translations/ko.json.mjs +2 -1
- package/dist/admin/translations/ko.json.mjs.map +1 -1
- package/dist/server/_virtual/_node_crypto.js +10 -0
- package/dist/server/_virtual/_node_crypto.js.map +1 -0
- package/dist/server/_virtual/_node_crypto.mjs +7 -0
- package/dist/server/_virtual/_node_crypto.mjs.map +1 -0
- package/dist/server/_virtual/_node_url.js +10 -0
- package/dist/server/_virtual/_node_url.js.map +1 -0
- package/dist/server/_virtual/_node_url.mjs +7 -0
- package/dist/server/_virtual/_node_url.mjs.map +1 -0
- package/dist/server/controllers/auth.js +19 -19
- package/dist/server/controllers/auth.js.map +1 -1
- package/dist/server/controllers/auth.mjs +19 -18
- package/dist/server/controllers/auth.mjs.map +1 -1
- package/dist/server/services/providers-registry.js +121 -242
- package/dist/server/services/providers-registry.js.map +1 -1
- package/dist/server/services/providers-registry.mjs +121 -239
- package/dist/server/services/providers-registry.mjs.map +1 -1
- package/dist/server/utils/oauth-connect/index.js +236 -0
- package/dist/server/utils/oauth-connect/index.js.map +1 -0
- package/dist/server/utils/oauth-connect/index.mjs +230 -0
- package/dist/server/utils/oauth-connect/index.mjs.map +1 -0
- package/dist/server/utils/oauth-connect/oauth1.js +138 -0
- package/dist/server/utils/oauth-connect/oauth1.js.map +1 -0
- package/dist/server/utils/oauth-connect/oauth1.mjs +136 -0
- package/dist/server/utils/oauth-connect/oauth1.mjs.map +1 -0
- package/dist/server/utils/oauth-connect/oauth2.js +117 -0
- package/dist/server/utils/oauth-connect/oauth2.js.map +1 -0
- package/dist/server/utils/oauth-connect/oauth2.mjs +115 -0
- package/dist/server/utils/oauth-connect/oauth2.mjs.map +1 -0
- package/dist/server/utils/oauth-connect/providers.js +109 -0
- package/dist/server/utils/oauth-connect/providers.js.map +1 -0
- package/dist/server/utils/oauth-connect/providers.mjs +107 -0
- package/dist/server/utils/oauth-connect/providers.mjs.map +1 -0
- package/dist/server/utils/provider-http.js +52 -0
- package/dist/server/utils/provider-http.js.map +1 -0
- package/dist/server/utils/provider-http.mjs +50 -0
- package/dist/server/utils/provider-http.mjs.map +1 -0
- package/dist/server/utils/verify-jwt-with-jwks.js +60 -0
- package/dist/server/utils/verify-jwt-with-jwks.js.map +1 -0
- package/dist/server/utils/verify-jwt-with-jwks.mjs +54 -0
- package/dist/server/utils/verify-jwt-with-jwks.mjs.map +1 -0
- package/jsconfig.json +7 -0
- package/package.json +12 -12
- package/server/controllers/auth.js +13 -20
- package/server/services/providers-registry.js +137 -293
- package/server/utils/oauth-connect/index.js +256 -0
- package/server/utils/oauth-connect/oauth1.js +169 -0
- package/server/utils/oauth-connect/oauth2.js +123 -0
- package/server/utils/oauth-connect/providers.js +100 -0
- package/server/utils/provider-http.js +49 -0
- package/server/utils/verify-jwt-with-jwks.js +43 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var providers;
|
|
4
|
+
var hasRequiredProviders;
|
|
5
|
+
function requireProviders() {
|
|
6
|
+
if (hasRequiredProviders) return providers;
|
|
7
|
+
hasRequiredProviders = 1;
|
|
8
|
+
/**
|
|
9
|
+
* OAuth endpoint definitions for built-in users-permissions providers.
|
|
10
|
+
* Derived from grant's oauth.json (MIT) — inlined to drop the grant dependency.
|
|
11
|
+
*/ providers = {
|
|
12
|
+
discord: {
|
|
13
|
+
oauth: 2,
|
|
14
|
+
authorize_url: 'https://discord.com/api/oauth2/authorize',
|
|
15
|
+
access_url: 'https://discord.com/api/oauth2/token',
|
|
16
|
+
scope_delimiter: ' '
|
|
17
|
+
},
|
|
18
|
+
facebook: {
|
|
19
|
+
oauth: 2,
|
|
20
|
+
authorize_url: 'https://www.facebook.com/dialog/oauth',
|
|
21
|
+
access_url: 'https://graph.facebook.com/oauth/access_token'
|
|
22
|
+
},
|
|
23
|
+
google: {
|
|
24
|
+
oauth: 2,
|
|
25
|
+
authorize_url: 'https://accounts.google.com/o/oauth2/v2/auth',
|
|
26
|
+
access_url: 'https://oauth2.googleapis.com/token',
|
|
27
|
+
scope_delimiter: ' '
|
|
28
|
+
},
|
|
29
|
+
github: {
|
|
30
|
+
oauth: 2,
|
|
31
|
+
authorize_url: 'https://github.com/login/oauth/authorize',
|
|
32
|
+
access_url: 'https://github.com/login/oauth/access_token'
|
|
33
|
+
},
|
|
34
|
+
microsoft: {
|
|
35
|
+
oauth: 2,
|
|
36
|
+
authorize_url: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
|
|
37
|
+
access_url: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
|
|
38
|
+
scope_delimiter: ' '
|
|
39
|
+
},
|
|
40
|
+
twitter: {
|
|
41
|
+
oauth: 1,
|
|
42
|
+
request_url: 'https://api.twitter.com/oauth/request_token',
|
|
43
|
+
authorize_url: 'https://api.twitter.com/oauth/authenticate',
|
|
44
|
+
access_url: 'https://api.twitter.com/oauth/access_token'
|
|
45
|
+
},
|
|
46
|
+
instagram: {
|
|
47
|
+
oauth: 2,
|
|
48
|
+
authorize_url: 'https://api.instagram.com/oauth/authorize',
|
|
49
|
+
access_url: 'https://api.instagram.com/oauth/access_token',
|
|
50
|
+
scope_delimiter: ' '
|
|
51
|
+
},
|
|
52
|
+
vk: {
|
|
53
|
+
oauth: 2,
|
|
54
|
+
authorize_url: 'https://oauth.vk.com/authorize',
|
|
55
|
+
access_url: 'https://oauth.vk.com/access_token'
|
|
56
|
+
},
|
|
57
|
+
twitch: {
|
|
58
|
+
oauth: 2,
|
|
59
|
+
authorize_url: 'https://id.twitch.tv/oauth2/authorize',
|
|
60
|
+
access_url: 'https://id.twitch.tv/oauth2/token',
|
|
61
|
+
scope_delimiter: ' '
|
|
62
|
+
},
|
|
63
|
+
linkedin: {
|
|
64
|
+
oauth: 2,
|
|
65
|
+
authorize_url: 'https://www.linkedin.com/oauth/v2/authorization',
|
|
66
|
+
access_url: 'https://www.linkedin.com/oauth/v2/accessToken',
|
|
67
|
+
scope_delimiter: ' '
|
|
68
|
+
},
|
|
69
|
+
cognito: {
|
|
70
|
+
oauth: 2,
|
|
71
|
+
authorize_url: 'https://[subdomain]/oauth2/authorize',
|
|
72
|
+
access_url: 'https://[subdomain]/oauth2/token',
|
|
73
|
+
scope_delimiter: ' '
|
|
74
|
+
},
|
|
75
|
+
reddit: {
|
|
76
|
+
oauth: 2,
|
|
77
|
+
authorize_url: 'https://ssl.reddit.com/api/v1/authorize',
|
|
78
|
+
access_url: 'https://ssl.reddit.com/api/v1/access_token',
|
|
79
|
+
token_endpoint_auth_method: 'client_secret_basic'
|
|
80
|
+
},
|
|
81
|
+
auth0: {
|
|
82
|
+
oauth: 2,
|
|
83
|
+
authorize_url: 'https://[subdomain].auth0.com/authorize',
|
|
84
|
+
access_url: 'https://[subdomain].auth0.com/oauth/token',
|
|
85
|
+
scope_delimiter: ' '
|
|
86
|
+
},
|
|
87
|
+
cas: {
|
|
88
|
+
oauth: 2,
|
|
89
|
+
authorize_url: 'https://[subdomain]/oidc/authorize',
|
|
90
|
+
access_url: 'https://[subdomain]/oidc/token'
|
|
91
|
+
},
|
|
92
|
+
patreon: {
|
|
93
|
+
oauth: 2,
|
|
94
|
+
authorize_url: 'https://www.patreon.com/oauth2/authorize',
|
|
95
|
+
access_url: 'https://www.patreon.com/api/oauth2/token',
|
|
96
|
+
scope_delimiter: ' '
|
|
97
|
+
},
|
|
98
|
+
keycloak: {
|
|
99
|
+
oauth: 2,
|
|
100
|
+
authorize_url: 'https://[subdomain]/protocol/openid-connect/auth',
|
|
101
|
+
access_url: 'https://[subdomain]/protocol/openid-connect/token',
|
|
102
|
+
scope_delimiter: ' '
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return providers;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
exports.__require = requireProviders;
|
|
109
|
+
//# sourceMappingURL=providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.js","sources":["../../../../server/utils/oauth-connect/providers.js"],"sourcesContent":["'use strict';\n\n/**\n * OAuth endpoint definitions for built-in users-permissions providers.\n * Derived from grant's oauth.json (MIT) — inlined to drop the grant dependency.\n */\nmodule.exports = {\n discord: {\n oauth: 2,\n authorize_url: 'https://discord.com/api/oauth2/authorize',\n access_url: 'https://discord.com/api/oauth2/token',\n scope_delimiter: ' ',\n },\n facebook: {\n oauth: 2,\n authorize_url: 'https://www.facebook.com/dialog/oauth',\n access_url: 'https://graph.facebook.com/oauth/access_token',\n },\n google: {\n oauth: 2,\n authorize_url: 'https://accounts.google.com/o/oauth2/v2/auth',\n access_url: 'https://oauth2.googleapis.com/token',\n scope_delimiter: ' ',\n },\n github: {\n oauth: 2,\n authorize_url: 'https://github.com/login/oauth/authorize',\n access_url: 'https://github.com/login/oauth/access_token',\n },\n microsoft: {\n oauth: 2,\n authorize_url: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',\n access_url: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',\n scope_delimiter: ' ',\n },\n twitter: {\n oauth: 1,\n request_url: 'https://api.twitter.com/oauth/request_token',\n authorize_url: 'https://api.twitter.com/oauth/authenticate',\n access_url: 'https://api.twitter.com/oauth/access_token',\n },\n instagram: {\n oauth: 2,\n authorize_url: 'https://api.instagram.com/oauth/authorize',\n access_url: 'https://api.instagram.com/oauth/access_token',\n scope_delimiter: ' ',\n },\n vk: {\n oauth: 2,\n authorize_url: 'https://oauth.vk.com/authorize',\n access_url: 'https://oauth.vk.com/access_token',\n },\n twitch: {\n oauth: 2,\n authorize_url: 'https://id.twitch.tv/oauth2/authorize',\n access_url: 'https://id.twitch.tv/oauth2/token',\n scope_delimiter: ' ',\n },\n linkedin: {\n oauth: 2,\n authorize_url: 'https://www.linkedin.com/oauth/v2/authorization',\n access_url: 'https://www.linkedin.com/oauth/v2/accessToken',\n scope_delimiter: ' ',\n },\n cognito: {\n oauth: 2,\n authorize_url: 'https://[subdomain]/oauth2/authorize',\n access_url: 'https://[subdomain]/oauth2/token',\n scope_delimiter: ' ',\n },\n reddit: {\n oauth: 2,\n authorize_url: 'https://ssl.reddit.com/api/v1/authorize',\n access_url: 'https://ssl.reddit.com/api/v1/access_token',\n token_endpoint_auth_method: 'client_secret_basic',\n },\n auth0: {\n oauth: 2,\n authorize_url: 'https://[subdomain].auth0.com/authorize',\n access_url: 'https://[subdomain].auth0.com/oauth/token',\n scope_delimiter: ' ',\n },\n cas: {\n oauth: 2,\n authorize_url: 'https://[subdomain]/oidc/authorize',\n access_url: 'https://[subdomain]/oidc/token',\n },\n patreon: {\n oauth: 2,\n authorize_url: 'https://www.patreon.com/oauth2/authorize',\n access_url: 'https://www.patreon.com/api/oauth2/token',\n scope_delimiter: ' ',\n },\n keycloak: {\n oauth: 2,\n authorize_url: 'https://[subdomain]/protocol/openid-connect/auth',\n access_url: 'https://[subdomain]/protocol/openid-connect/token',\n scope_delimiter: ' ',\n },\n};\n"],"names":["providers","discord","oauth","authorize_url","access_url","scope_delimiter","facebook","google","github","microsoft","twitter","request_url","instagram","vk","twitch","linkedin","cognito","reddit","token_endpoint_auth_method","auth0","cas","patreon","keycloak"],"mappings":";;;;;;;AAEA;;;AAGA,KACAA,SAAAA,GAAiB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AAAA,EAAS;YACPd,KAAAA,EAAO,CAAA;YACPC,aAAAA,EAAe,sCAAA;YACfC,UAAAA,EAAY,kCAAA;YACZC,eAAAA,EAAiB;AACrB,SAAA;QACEY,MAAAA,EAAQ;YACNf,KAAAA,EAAO,CAAA;YACPC,aAAAA,EAAe,yCAAA;YACfC,UAAAA,EAAY,4CAAA;YACZc,0BAAAA,EAA4B;AAChC,SAAA;QACEC,KAAAA,EAAO;YACLjB,KAAAA,EAAO,CAAA;YACPC,aAAAA,EAAe,yCAAA;YACfC,UAAAA,EAAY,2CAAA;YACZC,eAAAA,EAAiB;AACrB,SAAA;QACEe,GAAAA,EAAK;YACHlB,KAAAA,EAAO,CAAA;YACPC,aAAAA,EAAe,oCAAA;YACfC,UAAAA,EAAY;AAChB,SAAA;QACEiB,OAAAA,EAAS;YACPnB,KAAAA,EAAO,CAAA;YACPC,aAAAA,EAAe,0CAAA;YACfC,UAAAA,EAAY,0CAAA;YACZC,eAAAA,EAAiB;AACrB,SAAA;QACEiB,QAAAA,EAAU;YACRpB,KAAAA,EAAO,CAAA;YACPC,aAAAA,EAAe,kDAAA;YACfC,UAAAA,EAAY,mDAAA;YACZC,eAAAA,EAAiB;AACrB;AACA,KAAA;;;;;;"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var providers;
|
|
2
|
+
var hasRequiredProviders;
|
|
3
|
+
function requireProviders() {
|
|
4
|
+
if (hasRequiredProviders) return providers;
|
|
5
|
+
hasRequiredProviders = 1;
|
|
6
|
+
/**
|
|
7
|
+
* OAuth endpoint definitions for built-in users-permissions providers.
|
|
8
|
+
* Derived from grant's oauth.json (MIT) — inlined to drop the grant dependency.
|
|
9
|
+
*/ providers = {
|
|
10
|
+
discord: {
|
|
11
|
+
oauth: 2,
|
|
12
|
+
authorize_url: 'https://discord.com/api/oauth2/authorize',
|
|
13
|
+
access_url: 'https://discord.com/api/oauth2/token',
|
|
14
|
+
scope_delimiter: ' '
|
|
15
|
+
},
|
|
16
|
+
facebook: {
|
|
17
|
+
oauth: 2,
|
|
18
|
+
authorize_url: 'https://www.facebook.com/dialog/oauth',
|
|
19
|
+
access_url: 'https://graph.facebook.com/oauth/access_token'
|
|
20
|
+
},
|
|
21
|
+
google: {
|
|
22
|
+
oauth: 2,
|
|
23
|
+
authorize_url: 'https://accounts.google.com/o/oauth2/v2/auth',
|
|
24
|
+
access_url: 'https://oauth2.googleapis.com/token',
|
|
25
|
+
scope_delimiter: ' '
|
|
26
|
+
},
|
|
27
|
+
github: {
|
|
28
|
+
oauth: 2,
|
|
29
|
+
authorize_url: 'https://github.com/login/oauth/authorize',
|
|
30
|
+
access_url: 'https://github.com/login/oauth/access_token'
|
|
31
|
+
},
|
|
32
|
+
microsoft: {
|
|
33
|
+
oauth: 2,
|
|
34
|
+
authorize_url: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
|
|
35
|
+
access_url: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
|
|
36
|
+
scope_delimiter: ' '
|
|
37
|
+
},
|
|
38
|
+
twitter: {
|
|
39
|
+
oauth: 1,
|
|
40
|
+
request_url: 'https://api.twitter.com/oauth/request_token',
|
|
41
|
+
authorize_url: 'https://api.twitter.com/oauth/authenticate',
|
|
42
|
+
access_url: 'https://api.twitter.com/oauth/access_token'
|
|
43
|
+
},
|
|
44
|
+
instagram: {
|
|
45
|
+
oauth: 2,
|
|
46
|
+
authorize_url: 'https://api.instagram.com/oauth/authorize',
|
|
47
|
+
access_url: 'https://api.instagram.com/oauth/access_token',
|
|
48
|
+
scope_delimiter: ' '
|
|
49
|
+
},
|
|
50
|
+
vk: {
|
|
51
|
+
oauth: 2,
|
|
52
|
+
authorize_url: 'https://oauth.vk.com/authorize',
|
|
53
|
+
access_url: 'https://oauth.vk.com/access_token'
|
|
54
|
+
},
|
|
55
|
+
twitch: {
|
|
56
|
+
oauth: 2,
|
|
57
|
+
authorize_url: 'https://id.twitch.tv/oauth2/authorize',
|
|
58
|
+
access_url: 'https://id.twitch.tv/oauth2/token',
|
|
59
|
+
scope_delimiter: ' '
|
|
60
|
+
},
|
|
61
|
+
linkedin: {
|
|
62
|
+
oauth: 2,
|
|
63
|
+
authorize_url: 'https://www.linkedin.com/oauth/v2/authorization',
|
|
64
|
+
access_url: 'https://www.linkedin.com/oauth/v2/accessToken',
|
|
65
|
+
scope_delimiter: ' '
|
|
66
|
+
},
|
|
67
|
+
cognito: {
|
|
68
|
+
oauth: 2,
|
|
69
|
+
authorize_url: 'https://[subdomain]/oauth2/authorize',
|
|
70
|
+
access_url: 'https://[subdomain]/oauth2/token',
|
|
71
|
+
scope_delimiter: ' '
|
|
72
|
+
},
|
|
73
|
+
reddit: {
|
|
74
|
+
oauth: 2,
|
|
75
|
+
authorize_url: 'https://ssl.reddit.com/api/v1/authorize',
|
|
76
|
+
access_url: 'https://ssl.reddit.com/api/v1/access_token',
|
|
77
|
+
token_endpoint_auth_method: 'client_secret_basic'
|
|
78
|
+
},
|
|
79
|
+
auth0: {
|
|
80
|
+
oauth: 2,
|
|
81
|
+
authorize_url: 'https://[subdomain].auth0.com/authorize',
|
|
82
|
+
access_url: 'https://[subdomain].auth0.com/oauth/token',
|
|
83
|
+
scope_delimiter: ' '
|
|
84
|
+
},
|
|
85
|
+
cas: {
|
|
86
|
+
oauth: 2,
|
|
87
|
+
authorize_url: 'https://[subdomain]/oidc/authorize',
|
|
88
|
+
access_url: 'https://[subdomain]/oidc/token'
|
|
89
|
+
},
|
|
90
|
+
patreon: {
|
|
91
|
+
oauth: 2,
|
|
92
|
+
authorize_url: 'https://www.patreon.com/oauth2/authorize',
|
|
93
|
+
access_url: 'https://www.patreon.com/api/oauth2/token',
|
|
94
|
+
scope_delimiter: ' '
|
|
95
|
+
},
|
|
96
|
+
keycloak: {
|
|
97
|
+
oauth: 2,
|
|
98
|
+
authorize_url: 'https://[subdomain]/protocol/openid-connect/auth',
|
|
99
|
+
access_url: 'https://[subdomain]/protocol/openid-connect/token',
|
|
100
|
+
scope_delimiter: ' '
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
return providers;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { requireProviders as __require };
|
|
107
|
+
//# sourceMappingURL=providers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.mjs","sources":["../../../../server/utils/oauth-connect/providers.js"],"sourcesContent":["'use strict';\n\n/**\n * OAuth endpoint definitions for built-in users-permissions providers.\n * Derived from grant's oauth.json (MIT) — inlined to drop the grant dependency.\n */\nmodule.exports = {\n discord: {\n oauth: 2,\n authorize_url: 'https://discord.com/api/oauth2/authorize',\n access_url: 'https://discord.com/api/oauth2/token',\n scope_delimiter: ' ',\n },\n facebook: {\n oauth: 2,\n authorize_url: 'https://www.facebook.com/dialog/oauth',\n access_url: 'https://graph.facebook.com/oauth/access_token',\n },\n google: {\n oauth: 2,\n authorize_url: 'https://accounts.google.com/o/oauth2/v2/auth',\n access_url: 'https://oauth2.googleapis.com/token',\n scope_delimiter: ' ',\n },\n github: {\n oauth: 2,\n authorize_url: 'https://github.com/login/oauth/authorize',\n access_url: 'https://github.com/login/oauth/access_token',\n },\n microsoft: {\n oauth: 2,\n authorize_url: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',\n access_url: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',\n scope_delimiter: ' ',\n },\n twitter: {\n oauth: 1,\n request_url: 'https://api.twitter.com/oauth/request_token',\n authorize_url: 'https://api.twitter.com/oauth/authenticate',\n access_url: 'https://api.twitter.com/oauth/access_token',\n },\n instagram: {\n oauth: 2,\n authorize_url: 'https://api.instagram.com/oauth/authorize',\n access_url: 'https://api.instagram.com/oauth/access_token',\n scope_delimiter: ' ',\n },\n vk: {\n oauth: 2,\n authorize_url: 'https://oauth.vk.com/authorize',\n access_url: 'https://oauth.vk.com/access_token',\n },\n twitch: {\n oauth: 2,\n authorize_url: 'https://id.twitch.tv/oauth2/authorize',\n access_url: 'https://id.twitch.tv/oauth2/token',\n scope_delimiter: ' ',\n },\n linkedin: {\n oauth: 2,\n authorize_url: 'https://www.linkedin.com/oauth/v2/authorization',\n access_url: 'https://www.linkedin.com/oauth/v2/accessToken',\n scope_delimiter: ' ',\n },\n cognito: {\n oauth: 2,\n authorize_url: 'https://[subdomain]/oauth2/authorize',\n access_url: 'https://[subdomain]/oauth2/token',\n scope_delimiter: ' ',\n },\n reddit: {\n oauth: 2,\n authorize_url: 'https://ssl.reddit.com/api/v1/authorize',\n access_url: 'https://ssl.reddit.com/api/v1/access_token',\n token_endpoint_auth_method: 'client_secret_basic',\n },\n auth0: {\n oauth: 2,\n authorize_url: 'https://[subdomain].auth0.com/authorize',\n access_url: 'https://[subdomain].auth0.com/oauth/token',\n scope_delimiter: ' ',\n },\n cas: {\n oauth: 2,\n authorize_url: 'https://[subdomain]/oidc/authorize',\n access_url: 'https://[subdomain]/oidc/token',\n },\n patreon: {\n oauth: 2,\n authorize_url: 'https://www.patreon.com/oauth2/authorize',\n access_url: 'https://www.patreon.com/api/oauth2/token',\n scope_delimiter: ' ',\n },\n keycloak: {\n oauth: 2,\n authorize_url: 'https://[subdomain]/protocol/openid-connect/auth',\n access_url: 'https://[subdomain]/protocol/openid-connect/token',\n scope_delimiter: ' ',\n },\n};\n"],"names":["providers","discord","oauth","authorize_url","access_url","scope_delimiter","facebook","google","github","microsoft","twitter","request_url","instagram","vk","twitch","linkedin","cognito","reddit","token_endpoint_auth_method","auth0","cas","patreon","keycloak"],"mappings":";;;;;AAEA;;;AAGA,KACAA,SAAAA,GAAiB;QACfC,OAAAA,EAAS;YACPC,KAAAA,EAAO,CAAA;YACPC,aAAAA,EAAe,0CAAA;YACfC,UAAAA,EAAY,sCAAA;YACZC,eAAAA,EAAiB;AACrB,SAAA;QACEC,QAAAA,EAAU;YACRJ,KAAAA,EAAO,CAAA;YACPC,aAAAA,EAAe,uCAAA;YACfC,UAAAA,EAAY;AAChB,SAAA;QACEG,MAAAA,EAAQ;YACNL,KAAAA,EAAO,C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ACLjB,KAAAA,EAAO,CAAA;YACPC,aAAAA,EAAe,yCAAA;YACfC,UAAAA,EAAY,2CAAA;YACZC,eAAAA,EAAiB;AACrB,SAAA;QACEe,GAAAA,EAAK;YACHlB,KAAAA,EAAO,CAAA;YACPC,aAAAA,EAAe,oCAAA;YACfC,UAAAA,EAAY;AAChB,SAAA;QACEiB,OAAAA,EAAS;YACPnB,KAAAA,EAAO,CAAA;YACPC,aAAAA,EAAe,0CAAA;YACfC,UAAAA,EAAY,0CAAA;YACZC,eAAAA,EAAiB;AACrB,SAAA;QACEiB,QAAAA,EAAU;YACRpB,KAAAA,EAAO,CAAA;YACPC,aAAAA,EAAe,kDAAA;YACfC,UAAAA,EAAY,mDAAA;YACZC,eAAAA,EAAiB;AACrB;AACA,KAAA;;;;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var providerHttp;
|
|
4
|
+
var hasRequiredProviderHttp;
|
|
5
|
+
function requireProviderHttp() {
|
|
6
|
+
if (hasRequiredProviderHttp) return providerHttp;
|
|
7
|
+
hasRequiredProviderHttp = 1;
|
|
8
|
+
const fetchJson = async (url, options = {})=>{
|
|
9
|
+
const response = await fetch(url, options);
|
|
10
|
+
const contentType = response.headers.get('content-type') || '';
|
|
11
|
+
let body;
|
|
12
|
+
if (contentType.includes('application/json')) {
|
|
13
|
+
body = await response.json();
|
|
14
|
+
} else {
|
|
15
|
+
const text = await response.text();
|
|
16
|
+
try {
|
|
17
|
+
body = JSON.parse(text);
|
|
18
|
+
} catch {
|
|
19
|
+
body = text;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
const message = typeof body === 'object' && body !== null ? body.error_description || body.error || body.message : body;
|
|
24
|
+
throw new Error(message || `HTTP ${response.status}`);
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
body
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
const bearerGet = (url, accessToken, { headers = {}, qs = {} } = {})=>{
|
|
31
|
+
const target = new URL(url);
|
|
32
|
+
Object.entries(qs).forEach(([key, value])=>{
|
|
33
|
+
if (value !== undefined && value !== null) {
|
|
34
|
+
target.searchParams.set(key, String(value));
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return fetchJson(target, {
|
|
38
|
+
headers: {
|
|
39
|
+
Authorization: `Bearer ${accessToken}`,
|
|
40
|
+
...headers
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
providerHttp = {
|
|
45
|
+
fetchJson,
|
|
46
|
+
bearerGet
|
|
47
|
+
};
|
|
48
|
+
return providerHttp;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
exports.__require = requireProviderHttp;
|
|
52
|
+
//# sourceMappingURL=provider-http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-http.js","sources":["../../../server/utils/provider-http.js"],"sourcesContent":["'use strict';\n\nconst fetchJson = async (url, options = {}) => {\n const response = await fetch(url, options);\n const contentType = response.headers.get('content-type') || '';\n\n let body;\n if (contentType.includes('application/json')) {\n body = await response.json();\n } else {\n const text = await response.text();\n try {\n body = JSON.parse(text);\n } catch {\n body = text;\n }\n }\n\n if (!response.ok) {\n const message =\n typeof body === 'object' && body !== null\n ? body.error_description || body.error || body.message\n : body;\n throw new Error(message || `HTTP ${response.status}`);\n }\n\n return { body };\n};\n\nconst bearerGet = (url, accessToken, { headers = {}, qs = {} } = {}) => {\n const target = new URL(url);\n Object.entries(qs).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n target.searchParams.set(key, String(value));\n }\n });\n\n return fetchJson(target, {\n headers: {\n Authorization: `Bearer ${accessToken}`,\n ...headers,\n },\n });\n};\n\nmodule.exports = {\n fetchJson,\n bearerGet,\n};\n"],"names":["fetchJson","url","options","response","fetch","contentType","headers","get","body","includes","json","text","JSON","parse","ok","message","error_description","error","Error","status","bearerGet","accessToken","qs","target","URL","Object","entries","forEach","key","value","undefined","searchParams","set","String","Authorization","providerHttp"],"mappings":";;;;;;;AAEA,IAAA,MAAMA,SAAAA,GAAY,OAAOC,GAAAA,EAAKC,OAAAA,GAAU,EAAE,GAAA;QACxC,MAAMC,QAAAA,GAAW,MAAMC,KAAAA,CAAMH,GAAAA,EAAKC,OAAAA,CAAAA;AAClC,QAAA,MAAMG,cAAcF,QAAAA,CAASG,OAAO,CAACC,GAAG,CAAC,cAAA,CAAA,IAAmB,EAAA;QAE5D,IAAIC,IAAAA;QACJ,IAAIH,WAAAA,CAAYI,QAAQ,CAAC,kBAAA,CAAA,EAAqB;YAC5CD,IAAAA,GAAO,MAAML,SAASO,IAAI,EAAA;QAC9B,CAAA,MAAS;YACL,MAAMC,IAAAA,GAAO,MAAMR,QAAAA,CAASQ,IAAI,EAAA;YAChC,IAAI;gBACFH,IAAAA,GAAOI,IAAAA,CAAKC,KAAK,CAACF,IAAAA,CAAAA;AACxB,YAAA,CAAA,CAAM,OAAM;gBACNH,IAAAA,GAAOG,IAAAA;AACb,YAAA;AACA,QAAA;QAEE,IAAI,CAACR,QAAAA,CAASW,EAAE,EAAE;AAChB,YAAA,MAAMC,OAAAA,GACJ,OAAOP,IAAAA,KAAS,QAAA,IAAYA,SAAS,IAAA,GACjCA,IAAAA,CAAKQ,iBAAiB,IAAIR,IAAAA,CAAKS,KAAK,IAAIT,IAAAA,CAAKO,OAAO,GACpDP,IAAAA;YACN,MAAM,IAAIU,MAAMH,OAAAA,IAAW,CAAC,KAAK,EAAEZ,QAAAA,CAASgB,MAAM,CAAA,CAAE,CAAA;AACxD,QAAA;QAEE,OAAO;AAAEX,YAAAA;AAAI,SAAA;AACf,IAAA,CAAA;AAEA,IAAA,MAAMY,SAAAA,GAAY,CAACnB,GAAAA,EAAKoB,WAAAA,EAAa,EAAEf,OAAAA,GAAU,EAAE,EAAEgB,KAAK,EAAE,EAAE,GAAG,EAAE,GAAA;QACjE,MAAMC,MAAAA,GAAS,IAAIC,GAAAA,CAAIvB,GAAAA,CAAAA;QACvBwB,MAAAA,CAAOC,OAAO,CAACJ,EAAAA,CAAAA,CAAIK,OAAO,CAAC,CAAC,CAACC,KAAKC,KAAAA,CAAM,GAAA;YACtC,IAAIA,KAAAA,KAAUC,SAAAA,IAAaD,KAAAA,KAAU,IAAA,EAAM;AACzCN,gBAAAA,MAAAA,CAAOQ,YAAY,CAACC,GAAG,CAACJ,KAAKK,MAAAA,CAAOJ,KAAAA,CAAAA,CAAAA;AAC1C,YAAA;AACA,QAAA,CAAA,CAAA;AAEE,QAAA,OAAO7B,UAAUuB,MAAAA,EAAQ;YACvBjB,OAAAA,EAAS;gBACP4B,aAAAA,EAAe,CAAC,OAAO,EAAEb,WAAAA,CAAAA,CAAa;AACtC,gBAAA,GAAGf;AACT;AACA,SAAA,CAAA;AACA,IAAA,CAAA;IAEA6B,YAAAA,GAAiB;AACfnC,QAAAA,SAAAA;AACAoB,QAAAA;AACF,KAAA;;;;;;"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var providerHttp;
|
|
2
|
+
var hasRequiredProviderHttp;
|
|
3
|
+
function requireProviderHttp() {
|
|
4
|
+
if (hasRequiredProviderHttp) return providerHttp;
|
|
5
|
+
hasRequiredProviderHttp = 1;
|
|
6
|
+
const fetchJson = async (url, options = {})=>{
|
|
7
|
+
const response = await fetch(url, options);
|
|
8
|
+
const contentType = response.headers.get('content-type') || '';
|
|
9
|
+
let body;
|
|
10
|
+
if (contentType.includes('application/json')) {
|
|
11
|
+
body = await response.json();
|
|
12
|
+
} else {
|
|
13
|
+
const text = await response.text();
|
|
14
|
+
try {
|
|
15
|
+
body = JSON.parse(text);
|
|
16
|
+
} catch {
|
|
17
|
+
body = text;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (!response.ok) {
|
|
21
|
+
const message = typeof body === 'object' && body !== null ? body.error_description || body.error || body.message : body;
|
|
22
|
+
throw new Error(message || `HTTP ${response.status}`);
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
body
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const bearerGet = (url, accessToken, { headers = {}, qs = {} } = {})=>{
|
|
29
|
+
const target = new URL(url);
|
|
30
|
+
Object.entries(qs).forEach(([key, value])=>{
|
|
31
|
+
if (value !== undefined && value !== null) {
|
|
32
|
+
target.searchParams.set(key, String(value));
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return fetchJson(target, {
|
|
36
|
+
headers: {
|
|
37
|
+
Authorization: `Bearer ${accessToken}`,
|
|
38
|
+
...headers
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
providerHttp = {
|
|
43
|
+
fetchJson,
|
|
44
|
+
bearerGet
|
|
45
|
+
};
|
|
46
|
+
return providerHttp;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { requireProviderHttp as __require };
|
|
50
|
+
//# sourceMappingURL=provider-http.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-http.mjs","sources":["../../../server/utils/provider-http.js"],"sourcesContent":["'use strict';\n\nconst fetchJson = async (url, options = {}) => {\n const response = await fetch(url, options);\n const contentType = response.headers.get('content-type') || '';\n\n let body;\n if (contentType.includes('application/json')) {\n body = await response.json();\n } else {\n const text = await response.text();\n try {\n body = JSON.parse(text);\n } catch {\n body = text;\n }\n }\n\n if (!response.ok) {\n const message =\n typeof body === 'object' && body !== null\n ? body.error_description || body.error || body.message\n : body;\n throw new Error(message || `HTTP ${response.status}`);\n }\n\n return { body };\n};\n\nconst bearerGet = (url, accessToken, { headers = {}, qs = {} } = {}) => {\n const target = new URL(url);\n Object.entries(qs).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n target.searchParams.set(key, String(value));\n }\n });\n\n return fetchJson(target, {\n headers: {\n Authorization: `Bearer ${accessToken}`,\n ...headers,\n },\n });\n};\n\nmodule.exports = {\n fetchJson,\n bearerGet,\n};\n"],"names":["fetchJson","url","options","response","fetch","contentType","headers","get","body","includes","json","text","JSON","parse","ok","message","error_description","error","Error","status","bearerGet","accessToken","qs","target","URL","Object","entries","forEach","key","value","undefined","searchParams","set","String","Authorization","providerHttp"],"mappings":";;;;;AAEA,IAAA,MAAMA,SAAAA,GAAY,OAAOC,GAAAA,EAAKC,OAAAA,GAAU,EAAE,GAAA;QACxC,MAAMC,QAAAA,GAAW,MAAMC,KAAAA,CAAMH,GAAAA,EAAKC,OAAAA,CAAAA;AAClC,QAAA,MAAMG,cAAcF,QAAAA,CAASG,OAAO,CAACC,GAAG,CAAC,cAAA,CAAA,IAAmB,EAAA;QAE5D,IAAIC,IAAAA;QACJ,IAAIH,WAAAA,CAAYI,QAAQ,CAAC,kBAAA,CAAA,EAAqB;YAC5CD,IAAAA,GAAO,MAAML,SAASO,IAAI,EAAA;QAC9B,CAAA,MAAS;YACL,MAAMC,IAAAA,GAAO,MAAMR,QAAAA,CAASQ,IAAI,EAAA;YAChC,IAAI;gBACFH,IAAAA,GAAOI,IAAAA,CAAKC,KAAK,CAACF,IAAAA,CAAAA;AACxB,YAAA,CAAA,CAAM,OAAM;gBACNH,IAAAA,GAAOG,IAAAA;AACb,YAAA;AACA,QAAA;QAEE,IAAI,CAACR,QAAAA,CAASW,EAAE,EAAE;AAChB,YAAA,MAAMC,OAAAA,GACJ,OAAOP,IAAAA,KAAS,QAAA,IAAYA,SAAS,IAAA,GACjCA,IAAAA,CAAKQ,iBAAiB,IAAIR,IAAAA,CAAKS,KAAK,IAAIT,IAAAA,CAAKO,OAAO,GACpDP,IAAAA;YACN,MAAM,IAAIU,MAAMH,OAAAA,IAAW,CAAC,KAAK,EAAEZ,QAAAA,CAASgB,MAAM,CAAA,CAAE,CAAA;AACxD,QAAA;QAEE,OAAO;AAAEX,YAAAA;AAAI,SAAA;AACf,IAAA,CAAA;AAEA,IAAA,MAAMY,SAAAA,GAAY,CAACnB,GAAAA,EAAKoB,WAAAA,EAAa,EAAEf,OAAAA,GAAU,EAAE,EAAEgB,KAAK,EAAE,EAAE,GAAG,EAAE,GAAA;QACjE,MAAMC,MAAAA,GAAS,IAAIC,GAAAA,CAAIvB,GAAAA,CAAAA;QACvBwB,MAAAA,CAAOC,OAAO,CAACJ,EAAAA,CAAAA,CAAIK,OAAO,CAAC,CAAC,CAACC,KAAKC,KAAAA,CAAM,GAAA;YACtC,IAAIA,KAAAA,KAAUC,SAAAA,IAAaD,KAAAA,KAAU,IAAA,EAAM;AACzCN,gBAAAA,MAAAA,CAAOQ,YAAY,CAACC,GAAG,CAACJ,KAAKK,MAAAA,CAAOJ,KAAAA,CAAAA,CAAAA;AAC1C,YAAA;AACA,QAAA,CAAA,CAAA;AAEE,QAAA,OAAO7B,UAAUuB,MAAAA,EAAQ;YACvBjB,OAAAA,EAAS;gBACP4B,aAAAA,EAAe,CAAC,OAAO,EAAEb,WAAAA,CAAAA,CAAa;AACtC,gBAAA,GAAGf;AACT;AACA,SAAA,CAAA;AACA,IAAA,CAAA;IAEA6B,YAAAA,GAAiB;AACfnC,QAAAA,SAAAA;AACAoB,QAAAA;AACF,KAAA;;;;;;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _node_crypto_commonjsExternal = require('../_virtual/_node_crypto.js');
|
|
4
|
+
var require$$1 = require('jsonwebtoken');
|
|
5
|
+
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var require$$1__default = /*#__PURE__*/_interopDefault(require$$1);
|
|
9
|
+
|
|
10
|
+
var verifyJwtWithJwks_1;
|
|
11
|
+
var hasRequiredVerifyJwtWithJwks;
|
|
12
|
+
function requireVerifyJwtWithJwks() {
|
|
13
|
+
if (hasRequiredVerifyJwtWithJwks) return verifyJwtWithJwks_1;
|
|
14
|
+
hasRequiredVerifyJwtWithJwks = 1;
|
|
15
|
+
const crypto = _node_crypto_commonjsExternal.__require();
|
|
16
|
+
const jwt = require$$1__default.default;
|
|
17
|
+
const jwkToKeyObject = (jwk)=>crypto.createPublicKey({
|
|
18
|
+
key: jwk,
|
|
19
|
+
format: 'jwk'
|
|
20
|
+
});
|
|
21
|
+
const verifyJwtWithJwks = async ({ idToken, jwksUrl })=>{
|
|
22
|
+
const decoded = jwt.decode(idToken, {
|
|
23
|
+
complete: true
|
|
24
|
+
});
|
|
25
|
+
if (!decoded?.header?.kid || !decoded.payload) {
|
|
26
|
+
throw new Error('The provided token is not valid');
|
|
27
|
+
}
|
|
28
|
+
const response = await fetch(jwksUrl.toString());
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
throw new Error('There was an error verifying the token');
|
|
31
|
+
}
|
|
32
|
+
const jwk = await response.json();
|
|
33
|
+
const key = jwk.keys?.find(({ kid })=>kid === decoded.header.kid);
|
|
34
|
+
if (!key) {
|
|
35
|
+
throw new Error('There was an error verifying the token');
|
|
36
|
+
}
|
|
37
|
+
const publicKey = jwkToKeyObject(key);
|
|
38
|
+
return new Promise((resolve, reject)=>{
|
|
39
|
+
jwt.verify(idToken, publicKey, {
|
|
40
|
+
algorithms: [
|
|
41
|
+
'RS256'
|
|
42
|
+
]
|
|
43
|
+
}, (err, tokenPayload)=>{
|
|
44
|
+
if (err) {
|
|
45
|
+
reject(new Error('There was an error verifying the token'));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
resolve(tokenPayload);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
verifyJwtWithJwks_1 = {
|
|
53
|
+
jwkToKeyObject,
|
|
54
|
+
verifyJwtWithJwks
|
|
55
|
+
};
|
|
56
|
+
return verifyJwtWithJwks_1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
exports.__require = requireVerifyJwtWithJwks;
|
|
60
|
+
//# sourceMappingURL=verify-jwt-with-jwks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-jwt-with-jwks.js","sources":["../../../server/utils/verify-jwt-with-jwks.js"],"sourcesContent":["'use strict';\n\nconst crypto = require('node:crypto');\nconst jwt = require('jsonwebtoken');\n\nconst jwkToKeyObject = (jwk) => crypto.createPublicKey({ key: jwk, format: 'jwk' });\n\nconst verifyJwtWithJwks = async ({ idToken, jwksUrl }) => {\n const decoded = jwt.decode(idToken, { complete: true });\n\n if (!decoded?.header?.kid || !decoded.payload) {\n throw new Error('The provided token is not valid');\n }\n\n const response = await fetch(jwksUrl.toString());\n if (!response.ok) {\n throw new Error('There was an error verifying the token');\n }\n\n const jwk = await response.json();\n const key = jwk.keys?.find(({ kid }) => kid === decoded.header.kid);\n\n if (!key) {\n throw new Error('There was an error verifying the token');\n }\n\n const publicKey = jwkToKeyObject(key);\n\n return new Promise((resolve, reject) => {\n jwt.verify(idToken, publicKey, { algorithms: ['RS256'] }, (err, tokenPayload) => {\n if (err) {\n reject(new Error('There was an error verifying the token'));\n return;\n }\n resolve(tokenPayload);\n });\n });\n};\n\nmodule.exports = {\n jwkToKeyObject,\n verifyJwtWithJwks,\n};\n"],"names":["crypto","require$$0","jwt","require$$1","jwkToKeyObject","jwk","createPublicKey","key","format","verifyJwtWithJwks","idToken","jwksUrl","decoded","decode","complete","header","kid","payload","Error","response","fetch","toString","ok","json","keys","find","publicKey","Promise","resolve","reject","verify","algorithms","err","tokenPayload","verifyJwtWithJwks_1"],"mappings":";;;;;;;;;;;;;;AAEA,IAAA,MAAMA,MAAAA,GAASC,uCAAAA,EAAAA;AACf,IAAA,MAAMC,GAAAA,GAAMC,2BAAAA;AAEZ,IAAA,MAAMC,cAAAA,GAAiB,CAACC,GAAAA,GAAQL,MAAAA,CAAOM,eAAe,CAAC;YAAEC,GAAAA,EAAKF,GAAAA;YAAKG,MAAAA,EAAQ;AAAK,SAAA,CAAA;AAEhF,IAAA,MAAMC,oBAAoB,OAAO,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAA;AACnD,QAAA,MAAMC,OAAAA,GAAUV,GAAAA,CAAIW,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A,IAAA,CAAA;IAEAC,mBAAAA,GAAiB;AACf9B,QAAAA,cAAAA;AACAK,QAAAA;AACF,KAAA;;;;;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { __require } from '../_virtual/_node_crypto.mjs';
|
|
2
|
+
import require$$1 from 'jsonwebtoken';
|
|
3
|
+
|
|
4
|
+
var verifyJwtWithJwks_1;
|
|
5
|
+
var hasRequiredVerifyJwtWithJwks;
|
|
6
|
+
function requireVerifyJwtWithJwks() {
|
|
7
|
+
if (hasRequiredVerifyJwtWithJwks) return verifyJwtWithJwks_1;
|
|
8
|
+
hasRequiredVerifyJwtWithJwks = 1;
|
|
9
|
+
const crypto = __require();
|
|
10
|
+
const jwt = require$$1;
|
|
11
|
+
const jwkToKeyObject = (jwk)=>crypto.createPublicKey({
|
|
12
|
+
key: jwk,
|
|
13
|
+
format: 'jwk'
|
|
14
|
+
});
|
|
15
|
+
const verifyJwtWithJwks = async ({ idToken, jwksUrl })=>{
|
|
16
|
+
const decoded = jwt.decode(idToken, {
|
|
17
|
+
complete: true
|
|
18
|
+
});
|
|
19
|
+
if (!decoded?.header?.kid || !decoded.payload) {
|
|
20
|
+
throw new Error('The provided token is not valid');
|
|
21
|
+
}
|
|
22
|
+
const response = await fetch(jwksUrl.toString());
|
|
23
|
+
if (!response.ok) {
|
|
24
|
+
throw new Error('There was an error verifying the token');
|
|
25
|
+
}
|
|
26
|
+
const jwk = await response.json();
|
|
27
|
+
const key = jwk.keys?.find(({ kid })=>kid === decoded.header.kid);
|
|
28
|
+
if (!key) {
|
|
29
|
+
throw new Error('There was an error verifying the token');
|
|
30
|
+
}
|
|
31
|
+
const publicKey = jwkToKeyObject(key);
|
|
32
|
+
return new Promise((resolve, reject)=>{
|
|
33
|
+
jwt.verify(idToken, publicKey, {
|
|
34
|
+
algorithms: [
|
|
35
|
+
'RS256'
|
|
36
|
+
]
|
|
37
|
+
}, (err, tokenPayload)=>{
|
|
38
|
+
if (err) {
|
|
39
|
+
reject(new Error('There was an error verifying the token'));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
resolve(tokenPayload);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
verifyJwtWithJwks_1 = {
|
|
47
|
+
jwkToKeyObject,
|
|
48
|
+
verifyJwtWithJwks
|
|
49
|
+
};
|
|
50
|
+
return verifyJwtWithJwks_1;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { requireVerifyJwtWithJwks as __require };
|
|
54
|
+
//# sourceMappingURL=verify-jwt-with-jwks.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-jwt-with-jwks.mjs","sources":["../../../server/utils/verify-jwt-with-jwks.js"],"sourcesContent":["'use strict';\n\nconst crypto = require('node:crypto');\nconst jwt = require('jsonwebtoken');\n\nconst jwkToKeyObject = (jwk) => crypto.createPublicKey({ key: jwk, format: 'jwk' });\n\nconst verifyJwtWithJwks = async ({ idToken, jwksUrl }) => {\n const decoded = jwt.decode(idToken, { complete: true });\n\n if (!decoded?.header?.kid || !decoded.payload) {\n throw new Error('The provided token is not valid');\n }\n\n const response = await fetch(jwksUrl.toString());\n if (!response.ok) {\n throw new Error('There was an error verifying the token');\n }\n\n const jwk = await response.json();\n const key = jwk.keys?.find(({ kid }) => kid === decoded.header.kid);\n\n if (!key) {\n throw new Error('There was an error verifying the token');\n }\n\n const publicKey = jwkToKeyObject(key);\n\n return new Promise((resolve, reject) => {\n jwt.verify(idToken, publicKey, { algorithms: ['RS256'] }, (err, tokenPayload) => {\n if (err) {\n reject(new Error('There was an error verifying the token'));\n return;\n }\n resolve(tokenPayload);\n });\n });\n};\n\nmodule.exports = {\n jwkToKeyObject,\n verifyJwtWithJwks,\n};\n"],"names":["crypto","require$$0","jwt","require$$1","jwkToKeyObject","jwk","createPublicKey","key","format","verifyJwtWithJwks","idToken","jwksUrl","decoded","decode","complete","header","kid","payload","Error","response","fetch","toString","ok","json","keys","find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AAO,IAAIoB,OAAAA,CAAQ,CAACC,OAAAA,EAASC,MAAAA,GAAAA;YAC3B3B,GAAAA,CAAI4B,MAAM,CAACpB,OAAAA,EAASgB,SAAAA,EAAW;gBAAEK,UAAAA,EAAY;AAAC,oBAAA;AAAQ;AAAA,aAAA,EAAI,CAACC,GAAAA,EAAKC,YAAAA,GAAAA;AAC9D,gBAAA,IAAID,GAAAA,EAAK;AACPH,oBAAAA,MAAAA,CAAO,IAAIX,KAAAA,CAAM,wCAAA,CAAA,CAAA;AACjB,oBAAA;AACR,gBAAA;gBACMU,OAAAA,CAAQK,YAAAA,CAAAA;AACd,YAAA,CAAA,CAAA;AACA,QAAA,CAAA,CAAA;AACA,IAAA,CAAA;IAEAC,mBAAAA,GAAiB;AACf9B,QAAAA,cAAAA;AACAK,QAAAA;AACF,KAAA;;;;;;"}
|
package/jsconfig.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/plugin-users-permissions",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.51.0",
|
|
4
4
|
"description": "Protect your API with a full-authentication process based on JWT",
|
|
5
5
|
"homepage": "https://strapi.io",
|
|
6
6
|
"bugs": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"build": "run -T npm-run-all clean build:code",
|
|
44
44
|
"build:code": "run -T rollup -c",
|
|
45
45
|
"clean": "run -T rimraf dist",
|
|
46
|
-
"lint": "run -T eslint .",
|
|
46
|
+
"lint": "run -T eslint . --max-warnings=0",
|
|
47
47
|
"test:front": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js",
|
|
48
48
|
"test:front:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js",
|
|
49
49
|
"test:front:watch": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
|
|
@@ -53,32 +53,32 @@
|
|
|
53
53
|
"watch": "run -T rollup -c -w"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@strapi/design-system": "2.2.
|
|
57
|
-
"@strapi/icons": "2.2.
|
|
58
|
-
"@strapi/utils": "5.
|
|
56
|
+
"@strapi/design-system": "2.2.3",
|
|
57
|
+
"@strapi/icons": "2.2.3",
|
|
58
|
+
"@strapi/utils": "5.51.0",
|
|
59
59
|
"bcryptjs": "2.4.3",
|
|
60
|
-
"formik": "2.4.
|
|
61
|
-
"grant": "5.4.24",
|
|
60
|
+
"formik": "2.4.9",
|
|
62
61
|
"immer": "9.0.21",
|
|
63
|
-
"jsonwebtoken": "9.0.
|
|
64
|
-
"jwk-to-pem": "2.0.7",
|
|
62
|
+
"jsonwebtoken": "9.0.3",
|
|
65
63
|
"koa": "2.16.4",
|
|
66
64
|
"koa2-ratelimit": "^1.1.3",
|
|
67
65
|
"lodash": "4.18.1",
|
|
68
66
|
"prop-types": "^15.8.1",
|
|
69
|
-
"purest": "4.0.2",
|
|
70
67
|
"react-intl": "6.6.2",
|
|
71
68
|
"react-query": "3.39.3",
|
|
72
69
|
"react-redux": "8.1.3",
|
|
73
70
|
"url-join": "4.0.1",
|
|
74
71
|
"yup": "0.32.9",
|
|
75
|
-
"zod": "3.25.
|
|
72
|
+
"zod": "3.25.76"
|
|
76
73
|
},
|
|
77
74
|
"devDependencies": {
|
|
78
|
-
"@strapi/strapi": "5.
|
|
75
|
+
"@strapi/strapi": "5.51.0",
|
|
79
76
|
"@testing-library/dom": "10.4.1",
|
|
77
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
80
78
|
"@testing-library/react": "16.3.2",
|
|
81
79
|
"@testing-library/user-event": "14.6.1",
|
|
80
|
+
"@types/jest": "29.5.2",
|
|
81
|
+
"jest": "29.6.0",
|
|
82
82
|
"msw": "2.13.4",
|
|
83
83
|
"react": "18.3.1",
|
|
84
84
|
"react-dom": "18.3.1",
|
|
@@ -418,24 +418,14 @@ module.exports = ({ strapi }) => ({
|
|
|
418
418
|
return ctx.send({ data: {} });
|
|
419
419
|
},
|
|
420
420
|
async connect(ctx, next) {
|
|
421
|
-
const grant = require('grant').koa();
|
|
422
|
-
|
|
423
421
|
const providers = await strapi
|
|
424
422
|
.store({ type: 'plugin', name: 'users-permissions', key: 'grant' })
|
|
425
423
|
.get();
|
|
426
424
|
|
|
427
|
-
const apiPrefix = strapi.config.get('api.rest.prefix');
|
|
428
|
-
const grantConfig = {
|
|
429
|
-
defaults: {
|
|
430
|
-
prefix: `${apiPrefix}/connect`,
|
|
431
|
-
},
|
|
432
|
-
...providers,
|
|
433
|
-
};
|
|
434
|
-
|
|
435
425
|
const [requestPath] = ctx.request.url.split('?');
|
|
436
426
|
const provider = requestPath.split('/connect/')[1].split('/')[0];
|
|
437
427
|
|
|
438
|
-
if (!_.get(
|
|
428
|
+
if (!_.get(providers, [provider, 'enabled'])) {
|
|
439
429
|
throw new ApplicationError('This provider is disabled');
|
|
440
430
|
}
|
|
441
431
|
|
|
@@ -445,32 +435,35 @@ module.exports = ({ strapi }) => ({
|
|
|
445
435
|
);
|
|
446
436
|
}
|
|
447
437
|
|
|
448
|
-
// Ability to pass OAuth callback dynamically
|
|
449
438
|
const queryCustomCallback = _.get(ctx, 'query.callback');
|
|
450
439
|
const dynamicSessionCallback = _.get(ctx, 'session.grant.dynamic.callback');
|
|
451
|
-
|
|
452
440
|
const customCallback = queryCustomCallback ?? dynamicSessionCallback;
|
|
453
441
|
|
|
454
|
-
// The custom callback is validated to make sure it's not redirecting to an unwanted actor.
|
|
455
442
|
if (customCallback !== undefined) {
|
|
456
443
|
try {
|
|
457
|
-
// We're extracting the callback validator from the plugin config since it can be user-customized
|
|
458
444
|
const { validate: validateCallback } = strapi
|
|
459
445
|
.plugin('users-permissions')
|
|
460
446
|
.config('callback');
|
|
461
447
|
|
|
462
|
-
await validateCallback(customCallback,
|
|
448
|
+
await validateCallback(customCallback, providers[provider]);
|
|
463
449
|
|
|
464
|
-
|
|
450
|
+
// Persist across the provider redirect round-trip (request state alone is lost).
|
|
451
|
+
ctx.session = ctx.session || {};
|
|
452
|
+
ctx.session.grant = ctx.session.grant || {};
|
|
453
|
+
ctx.session.grant.dynamic = {
|
|
454
|
+
...(ctx.session.grant.dynamic || {}),
|
|
455
|
+
callback: customCallback,
|
|
456
|
+
};
|
|
457
|
+
ctx.state.oauthConnect = { callback: customCallback };
|
|
465
458
|
} catch (e) {
|
|
466
459
|
throw new ValidationError('Invalid callback URL provided', { callback: customCallback });
|
|
467
460
|
}
|
|
468
461
|
}
|
|
469
462
|
|
|
470
|
-
|
|
471
|
-
|
|
463
|
+
const { createOAuthConnectMiddleware } = require('../utils/oauth-connect');
|
|
464
|
+
const oauthConnect = createOAuthConnectMiddleware();
|
|
472
465
|
|
|
473
|
-
return
|
|
466
|
+
return oauthConnect(ctx, next);
|
|
474
467
|
},
|
|
475
468
|
|
|
476
469
|
async forgotPassword(ctx) {
|