@backstage/plugin-auth-backend-module-cloudflare-access-provider 0.4.3-next.1 → 0.4.3
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 +22 -0
- package/config.d.ts +5 -1
- 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 +12 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @backstage/plugin-auth-backend-module-cloudflare-access-provider
|
|
2
2
|
|
|
3
|
+
## 0.4.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5cc1f7f: Introduce `dangerouslyAllowSignInWithoutUserInCatalog` auth resolver config.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/plugin-auth-node@0.6.3
|
|
10
|
+
- @backstage/backend-plugin-api@1.3.1
|
|
11
|
+
- @backstage/config@1.3.2
|
|
12
|
+
- @backstage/errors@1.2.7
|
|
13
|
+
|
|
14
|
+
## 0.4.3-next.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 5cc1f7f: Introduce `dangerouslyAllowSignInWithoutUserInCatalog` auth resolver config.
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @backstage/plugin-auth-node@0.6.3-next.2
|
|
21
|
+
- @backstage/backend-plugin-api@1.3.1-next.2
|
|
22
|
+
- @backstage/config@1.3.2
|
|
23
|
+
- @backstage/errors@1.2.7
|
|
24
|
+
|
|
3
25
|
## 0.4.3-next.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/config.d.ts
CHANGED
|
@@ -34,8 +34,12 @@ export interface Config {
|
|
|
34
34
|
| {
|
|
35
35
|
resolver: 'emailLocalPartMatchingUserEntityName';
|
|
36
36
|
allowedDomains?: string[];
|
|
37
|
+
dangerouslyAllowSignInWithoutUserInCatalog?: boolean;
|
|
38
|
+
}
|
|
39
|
+
| {
|
|
40
|
+
resolver: 'emailMatchingUserEntityProfileEmail';
|
|
41
|
+
dangerouslyAllowSignInWithoutUserInCatalog?: boolean;
|
|
37
42
|
}
|
|
38
|
-
| { resolver: 'emailMatchingUserEntityProfileEmail' }
|
|
39
43
|
>;
|
|
40
44
|
};
|
|
41
45
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -107,7 +107,9 @@ declare namespace cloudflareAccessSignInResolvers {
|
|
|
107
107
|
/**
|
|
108
108
|
* Looks up the user by matching their email to the entity email.
|
|
109
109
|
*/
|
|
110
|
-
const emailMatchingUserEntityProfileEmail: _backstage_plugin_auth_node.SignInResolverFactory<CloudflareAccessResult,
|
|
110
|
+
const emailMatchingUserEntityProfileEmail: _backstage_plugin_auth_node.SignInResolverFactory<CloudflareAccessResult, {
|
|
111
|
+
dangerouslyAllowSignInWithoutUserInCatalog?: boolean | undefined;
|
|
112
|
+
} | undefined>;
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
export { type CloudflareAccessClaims, type CloudflareAccessGroup, type CloudflareAccessIdentityProfile, type CloudflareAccessResult, cloudflareAccessSignInResolvers, createCloudflareAccessAuthenticator, authModuleCloudflareAccessProvider as default };
|
package/dist/resolvers.cjs.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
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.cloudflareAccessSignInResolvers = void 0;
|
|
6
7
|
((cloudflareAccessSignInResolvers2) => {
|
|
7
8
|
cloudflareAccessSignInResolvers2.emailMatchingUserEntityProfileEmail = 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) {
|
|
@@ -13,11 +17,16 @@ exports.cloudflareAccessSignInResolvers = void 0;
|
|
|
13
17
|
"Login failed, user profile does not contain an email"
|
|
14
18
|
);
|
|
15
19
|
}
|
|
16
|
-
return ctx.signInWithCatalogUser(
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
return ctx.signInWithCatalogUser(
|
|
21
|
+
{
|
|
22
|
+
filter: {
|
|
23
|
+
"spec.profile.email": profile.email
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
dangerousEntityRefFallback: options?.dangerouslyAllowSignInWithoutUserInCatalog ? { entityRef: { name: profile.email } } : void 0
|
|
19
28
|
}
|
|
20
|
-
|
|
29
|
+
);
|
|
21
30
|
};
|
|
22
31
|
}
|
|
23
32
|
});
|
|
@@ -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 { CloudflareAccessResult } from './types';\n\n/**\n * Available sign-in resolvers for the Cloudflare Access auth provider.\n *\n * @public\n */\nexport namespace cloudflareAccessSignInResolvers {\n /**\n * Looks up the user by matching their email to the entity email.\n */\n export const emailMatchingUserEntityProfileEmail =\n createSignInResolverFactory({\n create() {\n return async (info: SignInInfo<CloudflareAccessResult>, ctx) => {\n const { profile } = info;\n\n if (!profile.email) {\n throw new Error(\n 'Login failed, user profile does not contain an email',\n );\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 SignInInfo,\n} from '@backstage/plugin-auth-node';\nimport { CloudflareAccessResult } from './types';\nimport { z } from 'zod';\n\n/**\n * Available sign-in resolvers for the Cloudflare Access auth provider.\n *\n * @public\n */\nexport namespace cloudflareAccessSignInResolvers {\n /**\n * Looks up the user by matching their email to the entity email.\n */\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<CloudflareAccessResult>, ctx) => {\n const { profile } = info;\n\n if (!profile.email) {\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 'spec.profile.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":["cloudflareAccessSignInResolvers","createSignInResolverFactory","z"],"mappings":";;;;;AA4BiBA;AAAA,CAAV,CAAUA,gCAAV,KAAA;AAIE,EAAMA,gCAAAA,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,MAA0C,GAAQ,KAAA;AAC9D,QAAM,MAAA,EAAE,SAAY,GAAA,IAAA;AAEpB,QAAI,IAAA,CAAC,QAAQ,KAAO,EAAA;AAClB,UAAA,MAAM,IAAI,KAAA;AAAA,YACR;AAAA,WACF;AAAA;AAGF,QAAA,OAAO,GAAI,CAAA,qBAAA;AAAA,UACT;AAAA,YACE,MAAQ,EAAA;AAAA,cACN,sBAAsB,OAAQ,CAAA;AAAA;AAChC,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,CApCY,EAAAF,uCAAA,KAAAA,uCAAA,GAAA,EAAA,CAAA,CAAA;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-auth-backend-module-cloudflare-access-provider",
|
|
3
|
-
"version": "0.4.3
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "The cloudflare-access-provider backend module for the auth plugin.",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -37,19 +37,20 @@
|
|
|
37
37
|
"test": "backstage-cli package test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@backstage/backend-plugin-api": "1.3.1
|
|
41
|
-
"@backstage/config": "1.3.2",
|
|
42
|
-
"@backstage/errors": "1.2.7",
|
|
43
|
-
"@backstage/plugin-auth-node": "0.6.3
|
|
40
|
+
"@backstage/backend-plugin-api": "^1.3.1",
|
|
41
|
+
"@backstage/config": "^1.3.2",
|
|
42
|
+
"@backstage/errors": "^1.2.7",
|
|
43
|
+
"@backstage/plugin-auth-node": "^0.6.3",
|
|
44
44
|
"express": "^4.18.2",
|
|
45
|
-
"jose": "^5.0.0"
|
|
45
|
+
"jose": "^5.0.0",
|
|
46
|
+
"zod": "^3.22.4"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
|
-
"@backstage/backend-defaults": "0.10.0
|
|
49
|
-
"@backstage/backend-test-utils": "1.5.0
|
|
50
|
-
"@backstage/cli": "0.32.1
|
|
51
|
-
"@backstage/plugin-auth-backend": "0.25.0
|
|
52
|
-
"@backstage/types": "1.2.1",
|
|
49
|
+
"@backstage/backend-defaults": "^0.10.0",
|
|
50
|
+
"@backstage/backend-test-utils": "^1.5.0",
|
|
51
|
+
"@backstage/cli": "^0.32.1",
|
|
52
|
+
"@backstage/plugin-auth-backend": "^0.25.0",
|
|
53
|
+
"@backstage/types": "^1.2.1",
|
|
53
54
|
"msw": "^2.0.0",
|
|
54
55
|
"node-mocks-http": "^1.0.0",
|
|
55
56
|
"uuid": "^11.0.0"
|