@backstage/plugin-auth-backend-module-gitlab-provider 0.4.1-next.0 → 0.4.1
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 +17 -0
- package/dist/resolvers.cjs.js +5 -5
- package/dist/resolvers.cjs.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @backstage/plugin-auth-backend-module-gitlab-provider
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a49a40d: Updated dependency `zod` to `^3.25.76 || ^4.0.0` & migrated to `/v3` or `/v4` imports.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/backend-plugin-api@1.8.0
|
|
10
|
+
- @backstage/plugin-auth-node@0.6.14
|
|
11
|
+
|
|
12
|
+
## 0.4.1-next.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @backstage/backend-plugin-api@1.8.0-next.1
|
|
18
|
+
- @backstage/plugin-auth-node@0.6.14-next.2
|
|
19
|
+
|
|
3
20
|
## 0.4.1-next.0
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/resolvers.cjs.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var pluginAuthNode = require('@backstage/plugin-auth-node');
|
|
4
|
-
var
|
|
4
|
+
var v3 = require('zod/v3');
|
|
5
5
|
|
|
6
6
|
exports.gitlabSignInResolvers = void 0;
|
|
7
7
|
((gitlabSignInResolvers2) => {
|
|
8
8
|
gitlabSignInResolvers2.usernameMatchingUserEntityName = pluginAuthNode.createSignInResolverFactory({
|
|
9
|
-
optionsSchema:
|
|
10
|
-
dangerouslyAllowSignInWithoutUserInCatalog:
|
|
9
|
+
optionsSchema: v3.z.object({
|
|
10
|
+
dangerouslyAllowSignInWithoutUserInCatalog: v3.z.boolean().optional()
|
|
11
11
|
}).optional(),
|
|
12
12
|
create(options = {}) {
|
|
13
13
|
return async (info, ctx) => {
|
|
@@ -29,8 +29,8 @@ exports.gitlabSignInResolvers = void 0;
|
|
|
29
29
|
});
|
|
30
30
|
gitlabSignInResolvers2.userIdMatchingUserEntityAnnotation = pluginAuthNode.createSignInResolverFactory(
|
|
31
31
|
{
|
|
32
|
-
optionsSchema:
|
|
33
|
-
dangerouslyAllowSignInWithoutUserInCatalog:
|
|
32
|
+
optionsSchema: v3.z.object({
|
|
33
|
+
dangerouslyAllowSignInWithoutUserInCatalog: v3.z.boolean().optional()
|
|
34
34
|
}).optional(),
|
|
35
35
|
create(options = {}) {
|
|
36
36
|
return async (info, ctx) => {
|
|
@@ -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 SignInInfo,\n} from '@backstage/plugin-auth-node';\nimport { z } from 'zod';\n\nimport { GitlabProfile } from './authenticator';\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<GitlabProfile>>,\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 /**\n * Looks up the user by matching their GitLab user ID to the user-id annotation.\n */\n export const userIdMatchingUserEntityAnnotation = createSignInResolverFactory(\n {\n optionsSchema: z\n .object({\n dangerouslyAllowSignInWithoutUserInCatalog: z.boolean().optional(),\n })\n .optional(),\n create(options = {}) {\n return async (\n info: SignInInfo<OAuthAuthenticatorResult<GitlabProfile>>,\n ctx,\n ) => {\n const { fullProfile } = info.result;\n\n const userId = fullProfile.id;\n if (!userId) {\n throw new Error(`GitLab user profile does not contain a user ID`);\n }\n\n if (!fullProfile.profileUrl) {\n throw new Error(\n `GitLab user profile does not contain a profile URL`,\n );\n }\n const host = new URL(fullProfile.profileUrl).hostname;\n\n return ctx.signInWithCatalogUser(\n {\n annotations: {\n [`${host}/user-id`]: userId,\n },\n },\n {\n dangerousEntityRefFallback:\n options?.dangerouslyAllowSignInWithoutUserInCatalog\n ? { entityRef: { name: userId } }\n : undefined,\n },\n );\n };\n },\n },\n );\n}\n"],"names":["gitlabSignInResolvers","createSignInResolverFactory","z"],"mappings":";;;;;AA8BiBA;AAAA,CAAV,CAAUA,sBAAAA,KAAV;AAIE,EAAMA,sBAAAA,CAAA,iCAAiCC,0CAAA,CAA4B;AAAA,IACxE,aAAA,EAAeC,
|
|
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 SignInInfo,\n} from '@backstage/plugin-auth-node';\nimport { z } from 'zod/v3';\n\nimport { GitlabProfile } from './authenticator';\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<GitlabProfile>>,\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 /**\n * Looks up the user by matching their GitLab user ID to the user-id annotation.\n */\n export const userIdMatchingUserEntityAnnotation = createSignInResolverFactory(\n {\n optionsSchema: z\n .object({\n dangerouslyAllowSignInWithoutUserInCatalog: z.boolean().optional(),\n })\n .optional(),\n create(options = {}) {\n return async (\n info: SignInInfo<OAuthAuthenticatorResult<GitlabProfile>>,\n ctx,\n ) => {\n const { fullProfile } = info.result;\n\n const userId = fullProfile.id;\n if (!userId) {\n throw new Error(`GitLab user profile does not contain a user ID`);\n }\n\n if (!fullProfile.profileUrl) {\n throw new Error(\n `GitLab user profile does not contain a profile URL`,\n );\n }\n const host = new URL(fullProfile.profileUrl).hostname;\n\n return ctx.signInWithCatalogUser(\n {\n annotations: {\n [`${host}/user-id`]: userId,\n },\n },\n {\n dangerousEntityRefFallback:\n options?.dangerouslyAllowSignInWithoutUserInCatalog\n ? { entityRef: { name: userId } }\n : undefined,\n },\n );\n };\n },\n },\n );\n}\n"],"names":["gitlabSignInResolvers","createSignInResolverFactory","z"],"mappings":";;;;;AA8BiBA;AAAA,CAAV,CAAUA,sBAAAA,KAAV;AAIE,EAAMA,sBAAAA,CAAA,iCAAiCC,0CAAA,CAA4B;AAAA,IACxE,aAAA,EAAeC,KACZ,MAAA,CAAO;AAAA,MACN,0CAAA,EAA4CA,IAAA,CAAE,OAAA,EAAQ,CAAE,QAAA;AAAS,KAClE,EACA,QAAA,EAAS;AAAA,IACZ,MAAA,CAAO,OAAA,GAAU,EAAC,EAAG;AACnB,MAAA,OAAO,OACL,MACA,GAAA,KACG;AACH,QAAA,MAAM,EAAE,QAAO,GAAI,IAAA;AAEnB,QAAA,MAAM,EAAA,GAAK,OAAO,WAAA,CAAY,QAAA;AAC9B,QAAA,IAAI,CAAC,EAAA,EAAI;AACP,UAAA,MAAM,IAAI,MAAM,CAAA,+CAAA,CAAiD,CAAA;AAAA,QACnE;AAEA,QAAA,OAAO,GAAA,CAAI,qBAAA;AAAA,UACT;AAAA,YACE,SAAA,EAAW,EAAE,IAAA,EAAM,EAAA;AAAG,WACxB;AAAA,UACA;AAAA,YACE,0BAAA,EACE,SAAS,0CAAA,GACL,EAAE,WAAW,EAAE,IAAA,EAAM,EAAA,EAAG,EAAE,GAC1B;AAAA;AACR,SACF;AAAA,MACF,CAAA;AAAA,IACF;AAAA,GACD,CAAA;AAKM,EAAMF,uBAAA,kCAAA,GAAqCC,0CAAA;AAAA,IAChD;AAAA,MACE,aAAA,EAAeC,KACZ,MAAA,CAAO;AAAA,QACN,0CAAA,EAA4CA,IAAA,CAAE,OAAA,EAAQ,CAAE,QAAA;AAAS,OAClE,EACA,QAAA,EAAS;AAAA,MACZ,MAAA,CAAO,OAAA,GAAU,EAAC,EAAG;AACnB,QAAA,OAAO,OACL,MACA,GAAA,KACG;AACH,UAAA,MAAM,EAAE,WAAA,EAAY,GAAI,IAAA,CAAK,MAAA;AAE7B,UAAA,MAAM,SAAS,WAAA,CAAY,EAAA;AAC3B,UAAA,IAAI,CAAC,MAAA,EAAQ;AACX,YAAA,MAAM,IAAI,MAAM,CAAA,8CAAA,CAAgD,CAAA;AAAA,UAClE;AAEA,UAAA,IAAI,CAAC,YAAY,UAAA,EAAY;AAC3B,YAAA,MAAM,IAAI,KAAA;AAAA,cACR,CAAA,kDAAA;AAAA,aACF;AAAA,UACF;AACA,UAAA,MAAM,IAAA,GAAO,IAAI,GAAA,CAAI,WAAA,CAAY,UAAU,CAAA,CAAE,QAAA;AAE7C,UAAA,OAAO,GAAA,CAAI,qBAAA;AAAA,YACT;AAAA,cACE,WAAA,EAAa;AAAA,gBACX,CAAC,CAAA,EAAG,IAAI,CAAA,QAAA,CAAU,GAAG;AAAA;AACvB,aACF;AAAA,YACA;AAAA,cACE,0BAAA,EACE,SAAS,0CAAA,GACL,EAAE,WAAW,EAAE,IAAA,EAAM,MAAA,EAAO,EAAE,GAC9B;AAAA;AACR,WACF;AAAA,QACF,CAAA;AAAA,MACF;AAAA;AACF,GACF;AAAA,CAAA,EAlFeF,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.4.1
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "The gitlab-provider backend module for the auth plugin.",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
"test": "backstage-cli package test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@backstage/backend-plugin-api": "1.
|
|
41
|
-
"@backstage/plugin-auth-node": "0.6.14
|
|
40
|
+
"@backstage/backend-plugin-api": "^1.8.0",
|
|
41
|
+
"@backstage/plugin-auth-node": "^0.6.14",
|
|
42
42
|
"express": "^4.22.0",
|
|
43
43
|
"passport": "^0.7.0",
|
|
44
44
|
"passport-gitlab2": "^5.0.0",
|
|
45
|
-
"zod": "^3.25.76"
|
|
45
|
+
"zod": "^3.25.76 || ^4.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@backstage/backend-defaults": "0.
|
|
49
|
-
"@backstage/backend-test-utils": "1.11.1
|
|
50
|
-
"@backstage/cli": "0.
|
|
51
|
-
"@backstage/plugin-auth-backend": "0.27.
|
|
52
|
-
"@backstage/types": "1.2.2",
|
|
48
|
+
"@backstage/backend-defaults": "^0.16.0",
|
|
49
|
+
"@backstage/backend-test-utils": "^1.11.1",
|
|
50
|
+
"@backstage/cli": "^0.36.0",
|
|
51
|
+
"@backstage/plugin-auth-backend": "^0.27.2",
|
|
52
|
+
"@backstage/types": "^1.2.2",
|
|
53
53
|
"supertest": "^7.0.0"
|
|
54
54
|
},
|
|
55
55
|
"configSchema": "config.d.ts",
|