@backstage/plugin-auth-backend-module-guest-provider 0.2.11-next.0 → 0.2.12-next.0
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 +16 -0
- package/dist/authenticator.cjs.js.map +1 -1
- package/dist/module.cjs.js.map +1 -1
- package/dist/resolvers.cjs.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @backstage/plugin-auth-backend-module-guest-provider
|
|
2
2
|
|
|
3
|
+
## 0.2.12-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/plugin-auth-node@0.6.7-next.0
|
|
9
|
+
- @backstage/backend-plugin-api@1.4.3-next.0
|
|
10
|
+
|
|
11
|
+
## 0.2.11
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
- @backstage/plugin-auth-node@0.6.6
|
|
17
|
+
- @backstage/backend-plugin-api@1.4.2
|
|
18
|
+
|
|
3
19
|
## 0.2.11-next.0
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticator.cjs.js","sources":["../src/authenticator.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 */\n\nimport { createProxyAuthenticator } from '@backstage/plugin-auth-node';\nimport { NotAllowedError } from '@backstage/errors';\n\nexport const guestAuthenticator = createProxyAuthenticator({\n defaultProfileTransform: async () => {\n return { profile: {} };\n },\n initialize({ config }) {\n const allowOutsideDev = config.getOptionalBoolean(\n 'dangerouslyAllowOutsideDevelopment',\n );\n return process.env.NODE_ENV !== 'development' && allowOutsideDev !== true;\n },\n async authenticate(_, disabled) {\n if (disabled) {\n throw new NotAllowedError(\n \"The guest provider cannot be used outside of a development environment unless 'auth.providers.guest.dangerouslyAllowOutsideDevelopment' is enabled\",\n );\n }\n return { result: {} };\n },\n});\n"],"names":["createProxyAuthenticator","NotAllowedError"],"mappings":";;;;;AAmBO,MAAM,qBAAqBA,
|
|
1
|
+
{"version":3,"file":"authenticator.cjs.js","sources":["../src/authenticator.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 */\n\nimport { createProxyAuthenticator } from '@backstage/plugin-auth-node';\nimport { NotAllowedError } from '@backstage/errors';\n\nexport const guestAuthenticator = createProxyAuthenticator({\n defaultProfileTransform: async () => {\n return { profile: {} };\n },\n initialize({ config }) {\n const allowOutsideDev = config.getOptionalBoolean(\n 'dangerouslyAllowOutsideDevelopment',\n );\n return process.env.NODE_ENV !== 'development' && allowOutsideDev !== true;\n },\n async authenticate(_, disabled) {\n if (disabled) {\n throw new NotAllowedError(\n \"The guest provider cannot be used outside of a development environment unless 'auth.providers.guest.dangerouslyAllowOutsideDevelopment' is enabled\",\n );\n }\n return { result: {} };\n },\n});\n"],"names":["createProxyAuthenticator","NotAllowedError"],"mappings":";;;;;AAmBO,MAAM,qBAAqBA,uCAAA,CAAyB;AAAA,EACzD,yBAAyB,YAAY;AACnC,IAAA,OAAO,EAAE,OAAA,EAAS,EAAC,EAAE;AAAA,EACvB,CAAA;AAAA,EACA,UAAA,CAAW,EAAE,MAAA,EAAO,EAAG;AACrB,IAAA,MAAM,kBAAkB,MAAA,CAAO,kBAAA;AAAA,MAC7B;AAAA,KACF;AACA,IAAA,OAAO,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,aAAA,IAAiB,eAAA,KAAoB,IAAA;AAAA,EACvE,CAAA;AAAA,EACA,MAAM,YAAA,CAAa,CAAA,EAAG,QAAA,EAAU;AAC9B,IAAA,IAAI,QAAA,EAAU;AACZ,MAAA,MAAM,IAAIC,sBAAA;AAAA,QACR;AAAA,OACF;AAAA,IACF;AACA,IAAA,OAAO,EAAE,MAAA,EAAQ,EAAC,EAAE;AAAA,EACtB;AACF,CAAC;;;;"}
|
package/dist/module.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.cjs.js","sources":["../src/module.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 coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport {\n authProvidersExtensionPoint,\n createProxyAuthProviderFactory,\n} from '@backstage/plugin-auth-node';\nimport { guestAuthenticator } from './authenticator';\nimport { signInAsGuestUser } from './resolvers';\n\n/** @public */\nexport const authModuleGuestProvider = createBackendModule({\n pluginId: 'auth',\n moduleId: 'guest-provider',\n register(reg) {\n reg.registerInit({\n deps: {\n providers: authProvidersExtensionPoint,\n config: coreServices.rootConfig,\n },\n async init({ providers, config }) {\n providers.registerProvider({\n providerId: 'guest',\n factory: createProxyAuthProviderFactory({\n authenticator: guestAuthenticator,\n signInResolver: signInAsGuestUser(\n config.getConfig('auth.providers.guest'),\n ),\n }),\n });\n },\n });\n },\n});\n"],"names":["createBackendModule","authProvidersExtensionPoint","coreServices","createProxyAuthProviderFactory","guestAuthenticator","signInAsGuestUser"],"mappings":";;;;;;;AA2BO,MAAM,0BAA0BA,
|
|
1
|
+
{"version":3,"file":"module.cjs.js","sources":["../src/module.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 coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport {\n authProvidersExtensionPoint,\n createProxyAuthProviderFactory,\n} from '@backstage/plugin-auth-node';\nimport { guestAuthenticator } from './authenticator';\nimport { signInAsGuestUser } from './resolvers';\n\n/** @public */\nexport const authModuleGuestProvider = createBackendModule({\n pluginId: 'auth',\n moduleId: 'guest-provider',\n register(reg) {\n reg.registerInit({\n deps: {\n providers: authProvidersExtensionPoint,\n config: coreServices.rootConfig,\n },\n async init({ providers, config }) {\n providers.registerProvider({\n providerId: 'guest',\n factory: createProxyAuthProviderFactory({\n authenticator: guestAuthenticator,\n signInResolver: signInAsGuestUser(\n config.getConfig('auth.providers.guest'),\n ),\n }),\n });\n },\n });\n },\n});\n"],"names":["createBackendModule","authProvidersExtensionPoint","coreServices","createProxyAuthProviderFactory","guestAuthenticator","signInAsGuestUser"],"mappings":";;;;;;;AA2BO,MAAM,0BAA0BA,oCAAA,CAAoB;AAAA,EACzD,QAAA,EAAU,MAAA;AAAA,EACV,QAAA,EAAU,gBAAA;AAAA,EACV,SAAS,GAAA,EAAK;AACZ,IAAA,GAAA,CAAI,YAAA,CAAa;AAAA,MACf,IAAA,EAAM;AAAA,QACJ,SAAA,EAAWC,0CAAA;AAAA,QACX,QAAQC,6BAAA,CAAa;AAAA,OACvB;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,SAAA,EAAW,QAAO,EAAG;AAChC,QAAA,SAAA,CAAU,gBAAA,CAAiB;AAAA,UACzB,UAAA,EAAY,OAAA;AAAA,UACZ,SAASC,6CAAA,CAA+B;AAAA,YACtC,aAAA,EAAeC,gCAAA;AAAA,YACf,cAAA,EAAgBC,2BAAA;AAAA,cACd,MAAA,CAAO,UAAU,sBAAsB;AAAA;AACzC,WACD;AAAA,SACF,CAAA;AAAA,MACH;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;;;;"}
|
|
@@ -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 */\n\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport type { Config } from '@backstage/config';\nimport { SignInResolver } from '@backstage/plugin-auth-node';\nimport { NotImplementedError } from '@backstage/errors';\n\n/**\n * Provide a default implementation of the user to resolve to. By default, this\n * is `user:development/guest`. We will attempt to get that user if they're in the\n * catalog. If that user doesn't exist in the catalog, we will still create a\n * token for them so they can keep viewing.\n */\nexport const signInAsGuestUser: (config: Config) => SignInResolver<{}> =\n (config: Config) => async (_, ctx) => {\n if (\n process.env.NODE_ENV !== 'development' &&\n config.getOptionalBoolean('dangerouslyAllowOutsideDevelopment') !== true\n ) {\n throw new NotImplementedError(\n 'The guest provider is NOT recommended for use outside of a development environment. If you want to enable this, set `auth.providers.guest.dangerouslyAllowOutsideDevelopment: true` in your app config.',\n );\n }\n const userRef =\n config.getOptionalString('userEntityRef') ??\n stringifyEntityRef({\n kind: 'user',\n namespace: 'development',\n name: 'guest',\n });\n const ownershipRefs = config.getOptionalStringArray(\n 'ownershipEntityRefs',\n ) ?? [userRef];\n try {\n return await ctx.signInWithCatalogUser({ entityRef: userRef });\n } catch (err) {\n // We can't guarantee that a guest user exists in the catalog, so we issue a token directly,\n return ctx.issueToken({\n claims: {\n sub: userRef,\n ent: ownershipRefs,\n },\n });\n }\n };\n"],"names":["NotImplementedError","stringifyEntityRef"],"mappings":";;;;;AA2BO,MAAM,
|
|
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 */\n\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport type { Config } from '@backstage/config';\nimport { SignInResolver } from '@backstage/plugin-auth-node';\nimport { NotImplementedError } from '@backstage/errors';\n\n/**\n * Provide a default implementation of the user to resolve to. By default, this\n * is `user:development/guest`. We will attempt to get that user if they're in the\n * catalog. If that user doesn't exist in the catalog, we will still create a\n * token for them so they can keep viewing.\n */\nexport const signInAsGuestUser: (config: Config) => SignInResolver<{}> =\n (config: Config) => async (_, ctx) => {\n if (\n process.env.NODE_ENV !== 'development' &&\n config.getOptionalBoolean('dangerouslyAllowOutsideDevelopment') !== true\n ) {\n throw new NotImplementedError(\n 'The guest provider is NOT recommended for use outside of a development environment. If you want to enable this, set `auth.providers.guest.dangerouslyAllowOutsideDevelopment: true` in your app config.',\n );\n }\n const userRef =\n config.getOptionalString('userEntityRef') ??\n stringifyEntityRef({\n kind: 'user',\n namespace: 'development',\n name: 'guest',\n });\n const ownershipRefs = config.getOptionalStringArray(\n 'ownershipEntityRefs',\n ) ?? [userRef];\n try {\n return await ctx.signInWithCatalogUser({ entityRef: userRef });\n } catch (err) {\n // We can't guarantee that a guest user exists in the catalog, so we issue a token directly,\n return ctx.issueToken({\n claims: {\n sub: userRef,\n ent: ownershipRefs,\n },\n });\n }\n };\n"],"names":["NotImplementedError","stringifyEntityRef"],"mappings":";;;;;AA2BO,MAAM,iBAAA,GACX,CAAC,MAAA,KAAmB,OAAO,GAAG,GAAA,KAAQ;AACpC,EAAA,IACE,OAAA,CAAQ,IAAI,QAAA,KAAa,aAAA,IACzB,OAAO,kBAAA,CAAmB,oCAAoC,MAAM,IAAA,EACpE;AACA,IAAA,MAAM,IAAIA,0BAAA;AAAA,MACR;AAAA,KACF;AAAA,EACF;AACA,EAAA,MAAM,OAAA,GACJ,MAAA,CAAO,iBAAA,CAAkB,eAAe,KACxCC,+BAAA,CAAmB;AAAA,IACjB,IAAA,EAAM,MAAA;AAAA,IACN,SAAA,EAAW,aAAA;AAAA,IACX,IAAA,EAAM;AAAA,GACP,CAAA;AACH,EAAA,MAAM,gBAAgB,MAAA,CAAO,sBAAA;AAAA,IAC3B;AAAA,GACF,IAAK,CAAC,OAAO,CAAA;AACb,EAAA,IAAI;AACF,IAAA,OAAO,MAAM,GAAA,CAAI,qBAAA,CAAsB,EAAE,SAAA,EAAW,SAAS,CAAA;AAAA,EAC/D,SAAS,GAAA,EAAK;AAEZ,IAAA,OAAO,IAAI,UAAA,CAAW;AAAA,MACpB,MAAA,EAAQ;AAAA,QACN,GAAA,EAAK,OAAA;AAAA,QACL,GAAA,EAAK;AAAA;AACP,KACD,CAAA;AAAA,EACH;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-auth-backend-module-guest-provider",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12-next.0",
|
|
4
4
|
"description": "The guest-provider backend module for the auth plugin.",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
"test": "backstage-cli package test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@backstage/backend-plugin-api": "1.4.
|
|
40
|
+
"@backstage/backend-plugin-api": "1.4.3-next.0",
|
|
41
41
|
"@backstage/catalog-model": "1.7.5",
|
|
42
42
|
"@backstage/errors": "1.2.7",
|
|
43
|
-
"@backstage/plugin-auth-node": "0.6.
|
|
43
|
+
"@backstage/plugin-auth-node": "0.6.7-next.0",
|
|
44
44
|
"passport-oauth2": "^1.7.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@backstage/backend-test-utils": "1.
|
|
48
|
-
"@backstage/cli": "0.
|
|
47
|
+
"@backstage/backend-test-utils": "1.9.0-next.1",
|
|
48
|
+
"@backstage/cli": "0.34.2-next.1",
|
|
49
49
|
"@backstage/config": "1.3.3",
|
|
50
50
|
"express": "^4.18.2"
|
|
51
51
|
},
|