@backstage/plugin-auth-backend-module-google-provider 0.3.3-next.1 → 0.3.3-next.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/CHANGELOG.md +9 -0
- package/config.d.ts +9 -2
- package/dist/index.d.ts +3 -1
- package/dist/resolvers.cjs.js +14 -5
- package/dist/resolvers.cjs.js.map +1 -1
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @backstage/plugin-auth-backend-module-google-provider
|
|
2
2
|
|
|
3
|
+
## 0.3.3-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5cc1f7f: Introduce `dangerouslyAllowSignInWithoutUserInCatalog` auth resolver config.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/plugin-auth-node@0.6.3-next.2
|
|
10
|
+
- @backstage/backend-plugin-api@1.3.1-next.2
|
|
11
|
+
|
|
3
12
|
## 0.3.3-next.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/config.d.ts
CHANGED
|
@@ -32,12 +32,19 @@ export interface Config {
|
|
|
32
32
|
additionalScopes?: string | string[];
|
|
33
33
|
signIn?: {
|
|
34
34
|
resolvers: Array<
|
|
35
|
-
| {
|
|
35
|
+
| {
|
|
36
|
+
resolver: 'emailMatchingUserEntityAnnotation';
|
|
37
|
+
dangerouslyAllowSignInWithoutUserInCatalog?: boolean;
|
|
38
|
+
}
|
|
36
39
|
| {
|
|
37
40
|
resolver: 'emailLocalPartMatchingUserEntityName';
|
|
38
41
|
allowedDomains?: string[];
|
|
42
|
+
dangerouslyAllowSignInWithoutUserInCatalog?: boolean;
|
|
43
|
+
}
|
|
44
|
+
| {
|
|
45
|
+
resolver: 'emailMatchingUserEntityProfileEmail';
|
|
46
|
+
dangerouslyAllowSignInWithoutUserInCatalog?: boolean;
|
|
39
47
|
}
|
|
40
|
-
| { resolver: 'emailMatchingUserEntityProfileEmail' }
|
|
41
48
|
>;
|
|
42
49
|
};
|
|
43
50
|
sessionDuration?: HumanDuration | string;
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,9 @@ declare namespace googleSignInResolvers {
|
|
|
17
17
|
/**
|
|
18
18
|
* Looks up the user by matching their email to the `google.com/email` annotation.
|
|
19
19
|
*/
|
|
20
|
-
const emailMatchingUserEntityAnnotation: _backstage_plugin_auth_node.SignInResolverFactory<OAuthAuthenticatorResult<PassportProfile>,
|
|
20
|
+
const emailMatchingUserEntityAnnotation: _backstage_plugin_auth_node.SignInResolverFactory<OAuthAuthenticatorResult<PassportProfile>, {
|
|
21
|
+
dangerouslyAllowSignInWithoutUserInCatalog?: boolean | undefined;
|
|
22
|
+
} | undefined>;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export { authModuleGoogleProvider as default, googleAuthenticator, googleSignInResolvers };
|
package/dist/resolvers.cjs.js
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var pluginAuthNode = require('@backstage/plugin-auth-node');
|
|
4
|
+
var zod = require('zod');
|
|
4
5
|
|
|
5
6
|
exports.googleSignInResolvers = void 0;
|
|
6
7
|
((googleSignInResolvers2) => {
|
|
7
8
|
googleSignInResolvers2.emailMatchingUserEntityAnnotation = pluginAuthNode.createSignInResolverFactory({
|
|
8
|
-
|
|
9
|
+
optionsSchema: zod.z.object({
|
|
10
|
+
dangerouslyAllowSignInWithoutUserInCatalog: zod.z.boolean().optional()
|
|
11
|
+
}).optional(),
|
|
12
|
+
create(options = {}) {
|
|
9
13
|
return async (info, ctx) => {
|
|
10
14
|
const { profile } = info;
|
|
11
15
|
if (!profile.email) {
|
|
12
16
|
throw new Error("Google profile contained no email");
|
|
13
17
|
}
|
|
14
|
-
return ctx.signInWithCatalogUser(
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
return ctx.signInWithCatalogUser(
|
|
19
|
+
{
|
|
20
|
+
annotations: {
|
|
21
|
+
"google.com/email": profile.email
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
dangerousEntityRefFallback: options?.dangerouslyAllowSignInWithoutUserInCatalog ? { entityRef: { name: profile.email } } : void 0
|
|
17
26
|
}
|
|
18
|
-
|
|
27
|
+
);
|
|
19
28
|
};
|
|
20
29
|
}
|
|
21
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.cjs.js","sources":["../src/resolvers.ts"],"sourcesContent":["/*\n * Copyright 2023 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 {\n createSignInResolverFactory,\n OAuthAuthenticatorResult,\n PassportProfile,\n SignInInfo,\n} from '@backstage/plugin-auth-node';\n\n/**\n * Available sign-in resolvers for the Google auth provider.\n *\n * @public\n */\nexport namespace googleSignInResolvers {\n /**\n * Looks up the user by matching their email to the `google.com/email` annotation.\n */\n export const emailMatchingUserEntityAnnotation = createSignInResolverFactory({\n create() {\n return async (\n info: SignInInfo<OAuthAuthenticatorResult<PassportProfile>>,\n ctx,\n ) => {\n const { profile } = info;\n\n if (!profile.email) {\n throw new Error('Google profile contained no email');\n }\n\n return ctx.signInWithCatalogUser({\n
|
|
1
|
+
{"version":3,"file":"resolvers.cjs.js","sources":["../src/resolvers.ts"],"sourcesContent":["/*\n * Copyright 2023 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 {\n createSignInResolverFactory,\n OAuthAuthenticatorResult,\n PassportProfile,\n SignInInfo,\n} from '@backstage/plugin-auth-node';\nimport { z } from 'zod';\n\n/**\n * Available sign-in resolvers for the Google auth provider.\n *\n * @public\n */\nexport namespace googleSignInResolvers {\n /**\n * Looks up the user by matching their email to the `google.com/email` annotation.\n */\n export const emailMatchingUserEntityAnnotation = createSignInResolverFactory({\n optionsSchema: z\n .object({\n dangerouslyAllowSignInWithoutUserInCatalog: z.boolean().optional(),\n })\n .optional(),\n create(options = {}) {\n return async (\n info: SignInInfo<OAuthAuthenticatorResult<PassportProfile>>,\n ctx,\n ) => {\n const { profile } = info;\n\n if (!profile.email) {\n throw new Error('Google profile contained no email');\n }\n\n return ctx.signInWithCatalogUser(\n {\n annotations: {\n 'google.com/email': profile.email,\n },\n },\n {\n dangerousEntityRefFallback:\n options?.dangerouslyAllowSignInWithoutUserInCatalog\n ? { entityRef: { name: profile.email } }\n : undefined,\n },\n );\n };\n },\n });\n}\n"],"names":["googleSignInResolvers","createSignInResolverFactory","z"],"mappings":";;;;;AA6BiBA;AAAA,CAAV,CAAUA,sBAAV,KAAA;AAIE,EAAMA,sBAAAA,CAAA,oCAAoCC,0CAA4B,CAAA;AAAA,IAC3E,aAAA,EAAeC,MACZ,MAAO,CAAA;AAAA,MACN,0CAA4C,EAAAA,KAAA,CAAE,OAAQ,EAAA,CAAE,QAAS;AAAA,KAClE,EACA,QAAS,EAAA;AAAA,IACZ,MAAA,CAAO,OAAU,GAAA,EAAI,EAAA;AACnB,MAAO,OAAA,OACL,MACA,GACG,KAAA;AACH,QAAM,MAAA,EAAE,SAAY,GAAA,IAAA;AAEpB,QAAI,IAAA,CAAC,QAAQ,KAAO,EAAA;AAClB,UAAM,MAAA,IAAI,MAAM,mCAAmC,CAAA;AAAA;AAGrD,QAAA,OAAO,GAAI,CAAA,qBAAA;AAAA,UACT;AAAA,YACE,WAAa,EAAA;AAAA,cACX,oBAAoB,OAAQ,CAAA;AAAA;AAC9B,WACF;AAAA,UACA;AAAA,YACE,0BAAA,EACE,OAAS,EAAA,0CAAA,GACL,EAAE,SAAA,EAAW,EAAE,IAAM,EAAA,OAAA,CAAQ,KAAM,EAAA,EACnC,GAAA,KAAA;AAAA;AACR,SACF;AAAA,OACF;AAAA;AACF,GACD,CAAA;AAAA,CApCc,EAAAF,6BAAA,KAAAA,6BAAA,GAAA,EAAA,CAAA,CAAA;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-auth-backend-module-google-provider",
|
|
3
|
-
"version": "0.3.3-next.
|
|
3
|
+
"version": "0.3.3-next.2",
|
|
4
4
|
"description": "A Google auth provider module for the Backstage auth backend",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -41,15 +41,16 @@
|
|
|
41
41
|
"test": "backstage-cli package test"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@backstage/backend-plugin-api": "1.3.1-next.
|
|
45
|
-
"@backstage/plugin-auth-node": "0.6.3-next.
|
|
44
|
+
"@backstage/backend-plugin-api": "1.3.1-next.2",
|
|
45
|
+
"@backstage/plugin-auth-node": "0.6.3-next.2",
|
|
46
46
|
"google-auth-library": "^9.0.0",
|
|
47
|
-
"passport-google-oauth20": "^2.0.0"
|
|
47
|
+
"passport-google-oauth20": "^2.0.0",
|
|
48
|
+
"zod": "^3.22.4"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
|
-
"@backstage/backend-test-utils": "1.5.0-next.
|
|
51
|
-
"@backstage/cli": "0.32.1-next.
|
|
52
|
-
"@backstage/plugin-auth-backend": "0.25.0-next.
|
|
51
|
+
"@backstage/backend-test-utils": "1.5.0-next.3",
|
|
52
|
+
"@backstage/cli": "0.32.1-next.3",
|
|
53
|
+
"@backstage/plugin-auth-backend": "0.25.0-next.2",
|
|
53
54
|
"@backstage/types": "1.2.1",
|
|
54
55
|
"@types/passport-google-oauth20": "^2.0.3",
|
|
55
56
|
"supertest": "^7.0.0"
|