@backstage/plugin-auth-backend-module-bitbucket-server-provider 0.2.3-next.1 → 0.2.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 +21 -0
- 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 +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @backstage/plugin-auth-backend-module-bitbucket-server-provider
|
|
2
2
|
|
|
3
|
+
## 0.2.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.2.3-next.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/config.d.ts
CHANGED
|
@@ -29,6 +29,27 @@ export interface Config {
|
|
|
29
29
|
clientSecret: string;
|
|
30
30
|
host: string;
|
|
31
31
|
callbackUrl?: string;
|
|
32
|
+
signIn?: {
|
|
33
|
+
resolvers: Array<
|
|
34
|
+
| {
|
|
35
|
+
resolver: 'userIdMatchingUserEntityAnnotation';
|
|
36
|
+
dangerouslyAllowSignInWithoutUserInCatalog?: boolean;
|
|
37
|
+
}
|
|
38
|
+
| {
|
|
39
|
+
resolver: 'usernameMatchingUserEntityAnnotation';
|
|
40
|
+
dangerouslyAllowSignInWithoutUserInCatalog?: boolean;
|
|
41
|
+
}
|
|
42
|
+
| {
|
|
43
|
+
resolver: 'emailLocalPartMatchingUserEntityName';
|
|
44
|
+
allowedDomains?: string[];
|
|
45
|
+
dangerouslyAllowSignInWithoutUserInCatalog?: boolean;
|
|
46
|
+
}
|
|
47
|
+
| {
|
|
48
|
+
resolver: 'emailMatchingUserEntityProfileEmail';
|
|
49
|
+
dangerouslyAllowSignInWithoutUserInCatalog?: boolean;
|
|
50
|
+
}
|
|
51
|
+
>;
|
|
52
|
+
};
|
|
32
53
|
sessionDuration?: HumanDuration | string;
|
|
33
54
|
};
|
|
34
55
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,9 @@ declare namespace bitbucketServerSignInResolvers {
|
|
|
20
20
|
/**
|
|
21
21
|
* Looks up the user by matching their email to the entity email.
|
|
22
22
|
*/
|
|
23
|
-
const emailMatchingUserEntityProfileEmail: _backstage_plugin_auth_node.SignInResolverFactory<OAuthAuthenticatorResult<PassportProfile>,
|
|
23
|
+
const emailMatchingUserEntityProfileEmail: _backstage_plugin_auth_node.SignInResolverFactory<OAuthAuthenticatorResult<PassportProfile>, {
|
|
24
|
+
dangerouslyAllowSignInWithoutUserInCatalog?: boolean | undefined;
|
|
25
|
+
} | undefined>;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
export { bitbucketServerAuthenticator, bitbucketServerSignInResolvers, authModuleBitbucketServerProvider 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.bitbucketServerSignInResolvers = void 0;
|
|
6
7
|
((bitbucketServerSignInResolvers2) => {
|
|
7
8
|
bitbucketServerSignInResolvers2.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.bitbucketServerSignInResolvers = 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 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 */\nimport {\n createSignInResolverFactory,\n OAuthAuthenticatorResult,\n PassportProfile,\n SignInInfo,\n} from '@backstage/plugin-auth-node';\n\n/**\n * Available sign-in resolvers for the Bitbucket Server auth provider.\n *\n * @public\n */\nexport namespace bitbucketServerSignInResolvers {\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 (\n info: SignInInfo<OAuthAuthenticatorResult<PassportProfile>>,\n ctx,\n ) => {\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 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 */\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 Bitbucket Server auth provider.\n *\n * @public\n */\nexport namespace bitbucketServerSignInResolvers {\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 (\n info: SignInInfo<OAuthAuthenticatorResult<PassportProfile>>,\n ctx,\n ) => {\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":["bitbucketServerSignInResolvers","createSignInResolverFactory","z"],"mappings":";;;;;AA4BiBA;AAAA,CAAV,CAAUA,+BAAV,KAAA;AAIE,EAAMA,+BAAAA,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,OACL,MACA,GACG,KAAA;AACH,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,CAvCY,EAAAF,sCAAA,KAAAA,sCAAA,GAAA,EAAA,CAAA,CAAA;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-auth-backend-module-bitbucket-server-provider",
|
|
3
|
-
"version": "0.2.3-next.
|
|
3
|
+
"version": "0.2.3-next.2",
|
|
4
4
|
"description": "The bitbucket-server-provider backend module for the auth plugin.",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -37,16 +37,17 @@
|
|
|
37
37
|
"test": "backstage-cli package test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@backstage/backend-plugin-api": "1.3.1-next.
|
|
41
|
-
"@backstage/plugin-auth-node": "0.6.3-next.
|
|
40
|
+
"@backstage/backend-plugin-api": "1.3.1-next.2",
|
|
41
|
+
"@backstage/plugin-auth-node": "0.6.3-next.2",
|
|
42
42
|
"passport": "^0.7.0",
|
|
43
|
-
"passport-oauth2": "^1.6.1"
|
|
43
|
+
"passport-oauth2": "^1.6.1",
|
|
44
|
+
"zod": "^3.22.4"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@backstage/backend-defaults": "0.10.0-next.
|
|
47
|
-
"@backstage/backend-test-utils": "1.5.0-next.
|
|
48
|
-
"@backstage/cli": "0.32.1-next.
|
|
49
|
-
"@backstage/plugin-auth-backend": "0.25.0-next.
|
|
47
|
+
"@backstage/backend-defaults": "0.10.0-next.3",
|
|
48
|
+
"@backstage/backend-test-utils": "1.5.0-next.3",
|
|
49
|
+
"@backstage/cli": "0.32.1-next.3",
|
|
50
|
+
"@backstage/plugin-auth-backend": "0.25.0-next.2",
|
|
50
51
|
"@backstage/types": "1.2.1",
|
|
51
52
|
"@types/passport-oauth2": "^1.4.15",
|
|
52
53
|
"supertest": "^7.0.0"
|