@backstage/plugin-auth-backend-module-aws-alb-provider 0.4.3-next.1 → 0.4.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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @backstage/plugin-auth-backend-module-aws-alb-provider
2
2
 
3
+ ## 0.4.3-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 5cc1f7f: Introduce `dangerouslyAllowSignInWithoutUserInCatalog` auth resolver config.
8
+ - Updated dependencies
9
+ - @backstage/plugin-auth-backend@0.25.0-next.2
10
+ - @backstage/plugin-auth-node@0.6.3-next.2
11
+ - @backstage/backend-plugin-api@1.3.1-next.2
12
+ - @backstage/errors@1.2.7
13
+
3
14
  ## 0.4.3-next.1
4
15
 
5
16
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -35,7 +35,9 @@ declare const authModuleAwsAlbProvider: _backstage_backend_plugin_api.BackendFea
35
35
  * @public
36
36
  */
37
37
  declare namespace awsAlbSignInResolvers {
38
- const emailMatchingUserEntityProfileEmail: _backstage_plugin_auth_node.SignInResolverFactory<AwsAlbResult, unknown>;
38
+ const emailMatchingUserEntityProfileEmail: _backstage_plugin_auth_node.SignInResolverFactory<AwsAlbResult, {
39
+ dangerouslyAllowSignInWithoutUserInCatalog?: boolean | undefined;
40
+ } | undefined>;
39
41
  }
40
42
 
41
43
  export { type AwsAlbResult, authModuleAwsAlbProvider, awsAlbAuthenticator, awsAlbSignInResolvers, authModuleAwsAlbProvider as default };
@@ -1,23 +1,36 @@
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.awsAlbSignInResolvers = void 0;
6
7
  ((awsAlbSignInResolvers2) => {
7
8
  awsAlbSignInResolvers2.emailMatchingUserEntityProfileEmail = pluginAuthNode.createSignInResolverFactory({
8
- create() {
9
+ optionsSchema: zod.z.object({
10
+ dangerouslyAllowSignInWithoutUserInCatalog: zod.z.boolean().optional()
11
+ }).optional(),
12
+ create(options = {}) {
9
13
  return async (info, ctx) => {
10
14
  if (!info.result.fullProfile.emails) {
11
15
  throw new Error(
12
16
  "Login failed, user profile does not contain an email"
13
17
  );
14
18
  }
15
- return ctx.signInWithCatalogUser({
16
- filter: {
17
- kind: ["User"],
18
- "spec.profile.email": info.result.fullProfile.emails[0].value
19
+ return ctx.signInWithCatalogUser(
20
+ {
21
+ filter: {
22
+ kind: ["User"],
23
+ "spec.profile.email": info.result.fullProfile.emails[0].value
24
+ }
25
+ },
26
+ {
27
+ dangerousEntityRefFallback: options?.dangerouslyAllowSignInWithoutUserInCatalog ? {
28
+ entityRef: {
29
+ name: info.result.fullProfile.emails[0].value
30
+ }
31
+ } : void 0
19
32
  }
20
- });
33
+ );
21
34
  };
22
35
  }
23
36
  });
@@ -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 SignInInfo,\n} from '@backstage/plugin-auth-node';\nimport { AwsAlbResult } from './types';\n/**\n * Available sign-in resolvers for the AWS ALB auth provider.\n *\n * @public\n */\nexport namespace awsAlbSignInResolvers {\n export const emailMatchingUserEntityProfileEmail =\n createSignInResolverFactory({\n create() {\n return async (info: SignInInfo<AwsAlbResult>, ctx) => {\n if (!info.result.fullProfile.emails) {\n throw new Error(\n 'Login failed, user profile does not contain an email',\n );\n }\n return ctx.signInWithCatalogUser({\n filter: {\n kind: ['User'],\n 'spec.profile.email': info.result.fullProfile.emails[0].value,\n },\n });\n };\n },\n });\n}\n"],"names":["awsAlbSignInResolvers","createSignInResolverFactory"],"mappings":";;;;AA0BiBA;AAAA,CAAV,CAAUA,sBAAV,KAAA;AACE,EAAMA,sBAAAA,CAAA,sCACXC,0CAA4B,CAAA;AAAA,IAC1B,MAAS,GAAA;AACP,MAAO,OAAA,OAAO,MAAgC,GAAQ,KAAA;AACpD,QAAA,IAAI,CAAC,IAAA,CAAK,MAAO,CAAA,WAAA,CAAY,MAAQ,EAAA;AACnC,UAAA,MAAM,IAAI,KAAA;AAAA,YACR;AAAA,WACF;AAAA;AAEF,QAAA,OAAO,IAAI,qBAAsB,CAAA;AAAA,UAC/B,MAAQ,EAAA;AAAA,YACN,IAAA,EAAM,CAAC,MAAM,CAAA;AAAA,YACb,sBAAsB,IAAK,CAAA,MAAA,CAAO,WAAY,CAAA,MAAA,CAAO,CAAC,CAAE,CAAA;AAAA;AAC1D,SACD,CAAA;AAAA,OACH;AAAA;AACF,GACD,CAAA;AAAA,CAlBY,EAAAD,6BAAA,KAAAA,6BAAA,GAAA,EAAA,CAAA,CAAA;;"}
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 SignInInfo,\n} from '@backstage/plugin-auth-node';\nimport { AwsAlbResult } from './types';\nimport { z } from 'zod';\n\n/**\n * Available sign-in resolvers for the AWS ALB auth provider.\n *\n * @public\n */\nexport namespace awsAlbSignInResolvers {\n export const emailMatchingUserEntityProfileEmail =\n createSignInResolverFactory({\n optionsSchema: z\n .object({\n dangerouslyAllowSignInWithoutUserInCatalog: z.boolean().optional(),\n })\n .optional(),\n create(options = {}) {\n return async (info: SignInInfo<AwsAlbResult>, ctx) => {\n if (!info.result.fullProfile.emails) {\n throw new Error(\n 'Login failed, user profile does not contain an email',\n );\n }\n\n return ctx.signInWithCatalogUser(\n {\n filter: {\n kind: ['User'],\n 'spec.profile.email': info.result.fullProfile.emails[0].value,\n },\n },\n {\n dangerousEntityRefFallback:\n options?.dangerouslyAllowSignInWithoutUserInCatalog\n ? {\n entityRef: {\n name: info.result.fullProfile.emails[0].value,\n },\n }\n : undefined,\n },\n );\n };\n },\n });\n}\n"],"names":["awsAlbSignInResolvers","createSignInResolverFactory","z"],"mappings":";;;;;AA4BiBA;AAAA,CAAV,CAAUA,sBAAV,KAAA;AACE,EAAMA,sBAAAA,CAAA,sCACXC,0CAA4B,CAAA;AAAA,IAC1B,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,OAAO,MAAgC,GAAQ,KAAA;AACpD,QAAA,IAAI,CAAC,IAAA,CAAK,MAAO,CAAA,WAAA,CAAY,MAAQ,EAAA;AACnC,UAAA,MAAM,IAAI,KAAA;AAAA,YACR;AAAA,WACF;AAAA;AAGF,QAAA,OAAO,GAAI,CAAA,qBAAA;AAAA,UACT;AAAA,YACE,MAAQ,EAAA;AAAA,cACN,IAAA,EAAM,CAAC,MAAM,CAAA;AAAA,cACb,sBAAsB,IAAK,CAAA,MAAA,CAAO,WAAY,CAAA,MAAA,CAAO,CAAC,CAAE,CAAA;AAAA;AAC1D,WACF;AAAA,UACA;AAAA,YACE,0BAAA,EACE,SAAS,0CACL,GAAA;AAAA,cACE,SAAW,EAAA;AAAA,gBACT,MAAM,IAAK,CAAA,MAAA,CAAO,WAAY,CAAA,MAAA,CAAO,CAAC,CAAE,CAAA;AAAA;AAC1C,aAEF,GAAA,KAAA;AAAA;AACR,SACF;AAAA,OACF;AAAA;AACF,GACD,CAAA;AAAA,CApCY,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-aws-alb-provider",
3
- "version": "0.4.3-next.1",
3
+ "version": "0.4.3-next.2",
4
4
  "description": "The aws-alb provider module for the Backstage auth backend.",
5
5
  "backstage": {
6
6
  "role": "backend-plugin-module",
@@ -40,16 +40,17 @@
40
40
  "test": "backstage-cli package test"
41
41
  },
42
42
  "dependencies": {
43
- "@backstage/backend-plugin-api": "1.3.1-next.1",
43
+ "@backstage/backend-plugin-api": "1.3.1-next.2",
44
44
  "@backstage/errors": "1.2.7",
45
- "@backstage/plugin-auth-backend": "0.25.0-next.1",
46
- "@backstage/plugin-auth-node": "0.6.3-next.1",
45
+ "@backstage/plugin-auth-backend": "0.25.0-next.2",
46
+ "@backstage/plugin-auth-node": "0.6.3-next.2",
47
47
  "jose": "^5.0.0",
48
- "node-cache": "^5.1.2"
48
+ "node-cache": "^5.1.2",
49
+ "zod": "^3.22.4"
49
50
  },
50
51
  "devDependencies": {
51
- "@backstage/backend-test-utils": "1.5.0-next.1",
52
- "@backstage/cli": "0.32.1-next.1",
52
+ "@backstage/backend-test-utils": "1.5.0-next.3",
53
+ "@backstage/cli": "0.32.1-next.3",
53
54
  "@backstage/config": "1.3.2",
54
55
  "@backstage/types": "1.2.1",
55
56
  "express": "^4.18.2",