@backstage/plugin-auth-backend-module-auth0-provider 0.4.3-next.1 → 0.4.4-next.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/CHANGELOG.md +24 -0
- package/dist/strategy.cjs.js +10 -2
- package/dist/strategy.cjs.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @backstage/plugin-auth-backend-module-auth0-provider
|
|
2
2
|
|
|
3
|
+
## 0.4.4-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/plugin-auth-node@0.7.4-next.0
|
|
9
|
+
- @backstage/backend-plugin-api@1.10.0-next.0
|
|
10
|
+
|
|
11
|
+
## 0.4.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 5446838: Added an optional `prompt` setting for Auth0 authorization requests. Set it to
|
|
16
|
+
`auto` to let Auth0 determine whether the user needs to be prompted. Existing
|
|
17
|
+
configurations continue to use `consent` by default.
|
|
18
|
+
- 9a07306: Added `screen_hint` and `login_hint` parameter forwarding for the Auth0 authentication provider.
|
|
19
|
+
When these parameters are present in the OAuth start request query string, they
|
|
20
|
+
are forwarded to Auth0's `/authorize` endpoint. This allows callers to guide
|
|
21
|
+
users to the signup or login screen (`screen_hint=signup`) and pre-fill the
|
|
22
|
+
email field (`login_hint=user@example.com`) during invitation flows.
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
- @backstage/plugin-auth-node@0.7.3
|
|
25
|
+
- @backstage/backend-plugin-api@1.9.3
|
|
26
|
+
|
|
3
27
|
## 0.4.3-next.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/strategy.cjs.js
CHANGED
|
@@ -21,7 +21,7 @@ class Auth0Strategy extends Auth0InternalStrategy__default.default {
|
|
|
21
21
|
this.organization = options.organization;
|
|
22
22
|
}
|
|
23
23
|
authenticate(req, options) {
|
|
24
|
-
const { organization, invitation } = req.query;
|
|
24
|
+
const { organization, invitation, screen_hint, login_hint } = req.query;
|
|
25
25
|
if (organization && this.organization && organization !== this.organization) {
|
|
26
26
|
throw new errors.InputError(
|
|
27
27
|
"Organization mismatch. The organization provided in the request does not match the organization configured in the strategy."
|
|
@@ -30,7 +30,9 @@ class Auth0Strategy extends Auth0InternalStrategy__default.default {
|
|
|
30
30
|
super.authenticate(req, {
|
|
31
31
|
...options,
|
|
32
32
|
...organization ? { organization } : {},
|
|
33
|
-
...invitation ? { invitation } : {}
|
|
33
|
+
...invitation ? { invitation } : {},
|
|
34
|
+
...screen_hint ? { screen_hint } : {},
|
|
35
|
+
...login_hint ? { login_hint } : {}
|
|
34
36
|
});
|
|
35
37
|
}
|
|
36
38
|
authorizationParams(options) {
|
|
@@ -41,6 +43,12 @@ class Auth0Strategy extends Auth0InternalStrategy__default.default {
|
|
|
41
43
|
if (options.invitation) {
|
|
42
44
|
params.invitation = options.invitation;
|
|
43
45
|
}
|
|
46
|
+
if (options.screen_hint) {
|
|
47
|
+
params.screen_hint = options.screen_hint;
|
|
48
|
+
}
|
|
49
|
+
if (options.login_hint) {
|
|
50
|
+
params.login_hint = options.login_hint;
|
|
51
|
+
}
|
|
44
52
|
return params;
|
|
45
53
|
}
|
|
46
54
|
}
|
package/dist/strategy.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strategy.cjs.js","sources":["../src/strategy.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Auth0InternalStrategy from 'passport-auth0';\nimport type { StateStore } from 'passport-oauth2';\nimport type express from 'express';\nimport { InputError } from '@backstage/errors';\n\n/** @public */\nexport interface Auth0StrategyOptionsWithRequest {\n clientID: string;\n clientSecret: string;\n callbackURL: string;\n domain: string;\n passReqToCallback: true;\n store: StateStore;\n organization?: string;\n}\n\n/** @public */\nexport class Auth0Strategy extends Auth0InternalStrategy {\n private organization: string | undefined;\n\n constructor(\n options: Auth0StrategyOptionsWithRequest,\n verify: Auth0InternalStrategy.VerifyFunction,\n ) {\n const optionsWithURLs = {\n ...options,\n authorizationURL: `https://${options.domain}/authorize`,\n tokenURL: `https://${options.domain}/oauth/token`,\n userInfoURL: `https://${options.domain}/userinfo`,\n apiUrl: `https://${options.domain}/api`,\n };\n super(optionsWithURLs, verify);\n this.organization = options.organization;\n }\n\n authenticate(req: express.Request, options: Record<string, any>): void {\n const { organization, invitation } = req.query;\n\n // Throw an error if the organization in the request does not match the organization configured in the strategy\n if (\n organization &&\n this.organization &&\n organization !== this.organization\n ) {\n throw new InputError(\n 'Organization mismatch. The organization provided in the request does not match the organization configured in the strategy.',\n );\n }\n\n super.authenticate(req, {\n ...options,\n ...(organization ? { organization } : {}),\n ...(invitation ? { invitation } : {}),\n });\n }\n\n authorizationParams(options: Record<string, any>): Record<string, any> {\n const params = super.authorizationParams(options);\n\n if (options.organization || this.organization) {\n params.organization = options.organization || this.organization;\n }\n\n if (options.invitation) {\n params.invitation = options.invitation;\n }\n\n return params;\n }\n}\n"],"names":["Auth0InternalStrategy","InputError"],"mappings":";;;;;;;;;AAiCO,MAAM,sBAAsBA,sCAAA,CAAsB;AAAA,EAC/C,YAAA;AAAA,EAER,WAAA,CACE,SACA,MAAA,EACA;AACA,IAAA,MAAM,eAAA,GAAkB;AAAA,MACtB,GAAG,OAAA;AAAA,MACH,gBAAA,EAAkB,CAAA,QAAA,EAAW,OAAA,CAAQ,MAAM,CAAA,UAAA,CAAA;AAAA,MAC3C,QAAA,EAAU,CAAA,QAAA,EAAW,OAAA,CAAQ,MAAM,CAAA,YAAA,CAAA;AAAA,MACnC,WAAA,EAAa,CAAA,QAAA,EAAW,OAAA,CAAQ,MAAM,CAAA,SAAA,CAAA;AAAA,MACtC,MAAA,EAAQ,CAAA,QAAA,EAAW,OAAA,CAAQ,MAAM,CAAA,IAAA;AAAA,KACnC;AACA,IAAA,KAAA,CAAM,iBAAiB,MAAM,CAAA;AAC7B,IAAA,IAAA,CAAK,eAAe,OAAA,CAAQ,YAAA;AAAA,EAC9B;AAAA,EAEA,YAAA,CAAa,KAAsB,OAAA,EAAoC;AACrE,IAAA,MAAM,EAAE,YAAA,EAAc,UAAA,
|
|
1
|
+
{"version":3,"file":"strategy.cjs.js","sources":["../src/strategy.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Auth0InternalStrategy from 'passport-auth0';\nimport type { StateStore } from 'passport-oauth2';\nimport type express from 'express';\nimport { InputError } from '@backstage/errors';\n\n/** @public */\nexport interface Auth0StrategyOptionsWithRequest {\n clientID: string;\n clientSecret: string;\n callbackURL: string;\n domain: string;\n passReqToCallback: true;\n store: StateStore;\n organization?: string;\n}\n\n/** @public */\nexport class Auth0Strategy extends Auth0InternalStrategy {\n private organization: string | undefined;\n\n constructor(\n options: Auth0StrategyOptionsWithRequest,\n verify: Auth0InternalStrategy.VerifyFunction,\n ) {\n const optionsWithURLs = {\n ...options,\n authorizationURL: `https://${options.domain}/authorize`,\n tokenURL: `https://${options.domain}/oauth/token`,\n userInfoURL: `https://${options.domain}/userinfo`,\n apiUrl: `https://${options.domain}/api`,\n };\n super(optionsWithURLs, verify);\n this.organization = options.organization;\n }\n\n authenticate(req: express.Request, options: Record<string, any>): void {\n const { organization, invitation, screen_hint, login_hint } = req.query;\n\n // Throw an error if the organization in the request does not match the organization configured in the strategy\n if (\n organization &&\n this.organization &&\n organization !== this.organization\n ) {\n throw new InputError(\n 'Organization mismatch. The organization provided in the request does not match the organization configured in the strategy.',\n );\n }\n\n super.authenticate(req, {\n ...options,\n ...(organization ? { organization } : {}),\n ...(invitation ? { invitation } : {}),\n ...(screen_hint ? { screen_hint } : {}),\n ...(login_hint ? { login_hint } : {}),\n });\n }\n\n authorizationParams(options: Record<string, any>): Record<string, any> {\n const params = super.authorizationParams(options);\n\n if (options.organization || this.organization) {\n params.organization = options.organization || this.organization;\n }\n\n if (options.invitation) {\n params.invitation = options.invitation;\n }\n\n if (options.screen_hint) {\n params.screen_hint = options.screen_hint;\n }\n\n if (options.login_hint) {\n params.login_hint = options.login_hint;\n }\n\n return params;\n }\n}\n"],"names":["Auth0InternalStrategy","InputError"],"mappings":";;;;;;;;;AAiCO,MAAM,sBAAsBA,sCAAA,CAAsB;AAAA,EAC/C,YAAA;AAAA,EAER,WAAA,CACE,SACA,MAAA,EACA;AACA,IAAA,MAAM,eAAA,GAAkB;AAAA,MACtB,GAAG,OAAA;AAAA,MACH,gBAAA,EAAkB,CAAA,QAAA,EAAW,OAAA,CAAQ,MAAM,CAAA,UAAA,CAAA;AAAA,MAC3C,QAAA,EAAU,CAAA,QAAA,EAAW,OAAA,CAAQ,MAAM,CAAA,YAAA,CAAA;AAAA,MACnC,WAAA,EAAa,CAAA,QAAA,EAAW,OAAA,CAAQ,MAAM,CAAA,SAAA,CAAA;AAAA,MACtC,MAAA,EAAQ,CAAA,QAAA,EAAW,OAAA,CAAQ,MAAM,CAAA,IAAA;AAAA,KACnC;AACA,IAAA,KAAA,CAAM,iBAAiB,MAAM,CAAA;AAC7B,IAAA,IAAA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T;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-auth-backend-module-auth0-provider",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4-next.0",
|
|
4
4
|
"description": "The auth0-provider backend module for the auth plugin.",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"test": "backstage-cli package test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@backstage/backend-plugin-api": "1.
|
|
40
|
+
"@backstage/backend-plugin-api": "1.10.0-next.0",
|
|
41
41
|
"@backstage/errors": "1.3.1",
|
|
42
|
-
"@backstage/plugin-auth-node": "0.7.
|
|
42
|
+
"@backstage/plugin-auth-node": "0.7.4-next.0",
|
|
43
43
|
"@types/passport": "^1.0.3",
|
|
44
44
|
"express": "^4.22.0",
|
|
45
45
|
"jose": "^5.0.0",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"passport-oauth2": "^1.6.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@backstage/backend-defaults": "0.17.
|
|
52
|
-
"@backstage/backend-test-utils": "1.11.
|
|
53
|
-
"@backstage/cli": "0.36.4
|
|
54
|
-
"@backstage/plugin-auth-backend": "0.
|
|
51
|
+
"@backstage/backend-defaults": "0.17.6-next.0",
|
|
52
|
+
"@backstage/backend-test-utils": "1.11.6-next.0",
|
|
53
|
+
"@backstage/cli": "0.36.4",
|
|
54
|
+
"@backstage/plugin-auth-backend": "0.30.0-next.0",
|
|
55
55
|
"@backstage/types": "1.2.2",
|
|
56
56
|
"@types/passport-auth0": "^1.0.5",
|
|
57
57
|
"@types/passport-oauth2": "^1.4.15",
|