@backstage/plugin-auth-backend-module-gitlab-provider 0.3.3-next.1 → 0.3.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 +18 -0
- package/config.d.ts +9 -2
- package/dist/index.d.ts +3 -1
- package/dist/resolvers.cjs.js +13 -2
- package/dist/resolvers.cjs.js.map +1 -1
- package/package.json +10 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @backstage/plugin-auth-backend-module-gitlab-provider
|
|
2
2
|
|
|
3
|
+
## 0.3.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
|
+
|
|
12
|
+
## 0.3.3-next.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 5cc1f7f: Introduce `dangerouslyAllowSignInWithoutUserInCatalog` auth resolver config.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @backstage/plugin-auth-node@0.6.3-next.2
|
|
19
|
+
- @backstage/backend-plugin-api@1.3.1-next.2
|
|
20
|
+
|
|
3
21
|
## 0.3.3-next.1
|
|
4
22
|
|
|
5
23
|
### 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: 'usernameMatchingUserEntityName';
|
|
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 gitlabSignInResolvers {
|
|
|
17
17
|
/**
|
|
18
18
|
* Looks up the user by matching their GitLab username to the entity name.
|
|
19
19
|
*/
|
|
20
|
-
const usernameMatchingUserEntityName: _backstage_plugin_auth_node.SignInResolverFactory<OAuthAuthenticatorResult<PassportProfile>,
|
|
20
|
+
const usernameMatchingUserEntityName: _backstage_plugin_auth_node.SignInResolverFactory<OAuthAuthenticatorResult<PassportProfile>, {
|
|
21
|
+
dangerouslyAllowSignInWithoutUserInCatalog?: boolean | undefined;
|
|
22
|
+
} | undefined>;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export { authModuleGitlabProvider as default, gitlabAuthenticator, gitlabSignInResolvers };
|
package/dist/resolvers.cjs.js
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
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.gitlabSignInResolvers = void 0;
|
|
6
7
|
((gitlabSignInResolvers2) => {
|
|
7
8
|
gitlabSignInResolvers2.usernameMatchingUserEntityName = 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 { result } = info;
|
|
11
15
|
const id = result.fullProfile.username;
|
|
12
16
|
if (!id) {
|
|
13
17
|
throw new Error(`GitLab user profile does not contain a username`);
|
|
14
18
|
}
|
|
15
|
-
return ctx.signInWithCatalogUser(
|
|
19
|
+
return ctx.signInWithCatalogUser(
|
|
20
|
+
{
|
|
21
|
+
entityRef: { name: id }
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
dangerousEntityRefFallback: options?.dangerouslyAllowSignInWithoutUserInCatalog ? { entityRef: { name: id } } : void 0
|
|
25
|
+
}
|
|
26
|
+
);
|
|
16
27
|
};
|
|
17
28
|
}
|
|
18
29
|
});
|
|
@@ -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 GitLab auth provider.\n *\n * @public\n */\nexport namespace gitlabSignInResolvers {\n /**\n * Looks up the user by matching their GitLab username to the entity name.\n */\n export const usernameMatchingUserEntityName = createSignInResolverFactory({\n create() {\n return async (\n info: SignInInfo<OAuthAuthenticatorResult<PassportProfile>>,\n ctx,\n ) => {\n const { result } = info;\n\n const id = result.fullProfile.username;\n if (!id) {\n throw new Error(`GitLab user profile does not contain a username`);\n }\n\n return ctx.signInWithCatalogUser({ entityRef: { name: id } });\n };\n },\n });\n}\n"],"names":["gitlabSignInResolvers","createSignInResolverFactory"],"mappings":"
|
|
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 GitLab auth provider.\n *\n * @public\n */\nexport namespace gitlabSignInResolvers {\n /**\n * Looks up the user by matching their GitLab username to the entity name.\n */\n export const usernameMatchingUserEntityName = 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 { result } = info;\n\n const id = result.fullProfile.username;\n if (!id) {\n throw new Error(`GitLab user profile does not contain a username`);\n }\n\n return ctx.signInWithCatalogUser(\n {\n entityRef: { name: id },\n },\n {\n dangerousEntityRefFallback:\n options?.dangerouslyAllowSignInWithoutUserInCatalog\n ? { entityRef: { name: id } }\n : undefined,\n },\n );\n };\n },\n });\n}\n"],"names":["gitlabSignInResolvers","createSignInResolverFactory","z"],"mappings":";;;;;AA6BiBA;AAAA,CAAV,CAAUA,sBAAV,KAAA;AAIE,EAAMA,sBAAAA,CAAA,iCAAiCC,0CAA4B,CAAA;AAAA,IACxE,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,QAAW,GAAA,IAAA;AAEnB,QAAM,MAAA,EAAA,GAAK,OAAO,WAAY,CAAA,QAAA;AAC9B,QAAA,IAAI,CAAC,EAAI,EAAA;AACP,UAAM,MAAA,IAAI,MAAM,CAAiD,+CAAA,CAAA,CAAA;AAAA;AAGnE,QAAA,OAAO,GAAI,CAAA,qBAAA;AAAA,UACT;AAAA,YACE,SAAA,EAAW,EAAE,IAAA,EAAM,EAAG;AAAA,WACxB;AAAA,UACA;AAAA,YACE,0BAAA,EACE,SAAS,0CACL,GAAA,EAAE,WAAW,EAAE,IAAA,EAAM,EAAG,EAAA,EACxB,GAAA,KAAA;AAAA;AACR,SACF;AAAA,OACF;AAAA;AACF,GACD,CAAA;AAAA,CAnCc,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-gitlab-provider",
|
|
3
|
-
"version": "0.3.3
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "The gitlab-provider backend module for the auth plugin.",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -37,18 +37,19 @@
|
|
|
37
37
|
"test": "backstage-cli package test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@backstage/backend-plugin-api": "1.3.1
|
|
41
|
-
"@backstage/plugin-auth-node": "0.6.3
|
|
40
|
+
"@backstage/backend-plugin-api": "^1.3.1",
|
|
41
|
+
"@backstage/plugin-auth-node": "^0.6.3",
|
|
42
42
|
"express": "^4.18.2",
|
|
43
43
|
"passport": "^0.7.0",
|
|
44
|
-
"passport-gitlab2": "^5.0.0"
|
|
44
|
+
"passport-gitlab2": "^5.0.0",
|
|
45
|
+
"zod": "^3.22.4"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@backstage/backend-defaults": "0.10.0
|
|
48
|
-
"@backstage/backend-test-utils": "1.5.0
|
|
49
|
-
"@backstage/cli": "0.32.1
|
|
50
|
-
"@backstage/plugin-auth-backend": "0.25.0
|
|
51
|
-
"@backstage/types": "1.2.1",
|
|
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",
|
|
52
53
|
"supertest": "^7.0.0"
|
|
53
54
|
},
|
|
54
55
|
"configSchema": "config.d.ts",
|