@backstage/plugin-auth-backend-module-oauth2-proxy-provider 0.2.8-next.1 → 0.2.8-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 +10 -0
- package/dist/index.cjs.js +5 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/resolvers.cjs.js +13 -4
- package/dist/resolvers.cjs.js.map +1 -1
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @backstage/plugin-auth-backend-module-oauth2-proxy-provider
|
|
2
2
|
|
|
3
|
+
## 0.2.8-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
|
+
- @backstage/errors@1.2.7
|
|
12
|
+
|
|
3
13
|
## 0.2.8-next.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -3,11 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var module$1 = require('./module.cjs.js');
|
|
6
|
+
var resolvers = require('./resolvers.cjs.js');
|
|
6
7
|
var authenticator = require('./authenticator.cjs.js');
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
exports.default = module$1.authModuleOauth2ProxyProvider;
|
|
12
|
+
Object.defineProperty(exports, "oauth2ProxySignInResolvers", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return resolvers.oauth2ProxySignInResolvers; }
|
|
15
|
+
});
|
|
11
16
|
exports.OAUTH2_PROXY_JWT_HEADER = authenticator.OAUTH2_PROXY_JWT_HEADER;
|
|
12
17
|
exports.oauth2ProxyAuthenticator = authenticator.oauth2ProxyAuthenticator;
|
|
13
18
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,15 @@ type OAuth2ProxyResult<JWTPayload = {}> = {
|
|
|
45
45
|
getHeader(name: string): string | undefined;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
declare namespace oauth2ProxySignInResolvers {
|
|
52
|
+
const forwardedUserMatchingUserEntityName: _backstage_plugin_auth_node.SignInResolverFactory<OAuth2ProxyResult, {
|
|
53
|
+
dangerouslyAllowSignInWithoutUserInCatalog?: boolean | undefined;
|
|
54
|
+
} | undefined>;
|
|
55
|
+
}
|
|
56
|
+
|
|
48
57
|
/**
|
|
49
58
|
* NOTE: This may come in handy if you're doing work on this provider:
|
|
50
59
|
* plugins/auth-backend/examples/docker-compose.oauth2-proxy.yaml
|
|
@@ -57,4 +66,4 @@ declare const oauth2ProxyAuthenticator: _backstage_plugin_auth_node.ProxyAuthent
|
|
|
57
66
|
accessToken: string;
|
|
58
67
|
}>;
|
|
59
68
|
|
|
60
|
-
export { OAUTH2_PROXY_JWT_HEADER, type OAuth2ProxyResult, authModuleOauth2ProxyProvider as default, oauth2ProxyAuthenticator };
|
|
69
|
+
export { OAUTH2_PROXY_JWT_HEADER, type OAuth2ProxyResult, authModuleOauth2ProxyProvider as default, oauth2ProxyAuthenticator, oauth2ProxySignInResolvers };
|
package/dist/resolvers.cjs.js
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
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.oauth2ProxySignInResolvers = void 0;
|
|
6
7
|
((oauth2ProxySignInResolvers2) => {
|
|
7
8
|
oauth2ProxySignInResolvers2.forwardedUserMatchingUserEntityName = 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 name = info.result.getHeader("x-forwarded-user");
|
|
11
15
|
if (!name) {
|
|
12
16
|
throw new Error("Request did not contain a user");
|
|
13
17
|
}
|
|
14
|
-
return ctx.signInWithCatalogUser(
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
return ctx.signInWithCatalogUser(
|
|
19
|
+
{
|
|
20
|
+
entityRef: { name }
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
dangerousEntityRefFallback: options?.dangerouslyAllowSignInWithoutUserInCatalog ? { entityRef: { name } } : void 0
|
|
24
|
+
}
|
|
25
|
+
);
|
|
17
26
|
};
|
|
18
27
|
}
|
|
19
28
|
});
|
|
@@ -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 { OAuth2ProxyResult } from './types';\n\n/**\n * @public\n */\nexport namespace oauth2ProxySignInResolvers {\n export const forwardedUserMatchingUserEntityName =\n createSignInResolverFactory({\n create() {\n return async (info: SignInInfo<OAuth2ProxyResult>, ctx) => {\n const name = info.result.getHeader('x-forwarded-user');\n if (!name) {\n throw new Error('Request did not contain a user');\n }\n return ctx.signInWithCatalogUser({\n entityRef: { name },\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 { OAuth2ProxyResult } from './types';\nimport { z } from 'zod';\n\n/**\n * @public\n */\nexport namespace oauth2ProxySignInResolvers {\n export const forwardedUserMatchingUserEntityName =\n createSignInResolverFactory({\n optionsSchema: z\n .object({\n dangerouslyAllowSignInWithoutUserInCatalog: z.boolean().optional(),\n })\n .optional(),\n create(options = {}) {\n return async (info: SignInInfo<OAuth2ProxyResult>, ctx) => {\n const name = info.result.getHeader('x-forwarded-user');\n if (!name) {\n throw new Error('Request did not contain a user');\n }\n\n return ctx.signInWithCatalogUser(\n {\n entityRef: { name },\n },\n {\n dangerousEntityRefFallback:\n options?.dangerouslyAllowSignInWithoutUserInCatalog\n ? { entityRef: { name } }\n : undefined,\n },\n );\n };\n },\n });\n}\n"],"names":["oauth2ProxySignInResolvers","createSignInResolverFactory","z"],"mappings":";;;;;AA0BiBA;AAAA,CAAV,CAAUA,2BAAV,KAAA;AACE,EAAMA,2BAAAA,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,MAAqC,GAAQ,KAAA;AACzD,QAAA,MAAM,IAAO,GAAA,IAAA,CAAK,MAAO,CAAA,SAAA,CAAU,kBAAkB,CAAA;AACrD,QAAA,IAAI,CAAC,IAAM,EAAA;AACT,UAAM,MAAA,IAAI,MAAM,gCAAgC,CAAA;AAAA;AAGlD,QAAA,OAAO,GAAI,CAAA,qBAAA;AAAA,UACT;AAAA,YACE,SAAA,EAAW,EAAE,IAAK;AAAA,WACpB;AAAA,UACA;AAAA,YACE,0BAAA,EACE,SAAS,0CACL,GAAA,EAAE,WAAW,EAAE,IAAA,IACf,GAAA,KAAA;AAAA;AACR,SACF;AAAA,OACF;AAAA;AACF,GACD,CAAA;AAAA,CA5BY,EAAAF,kCAAA,KAAAA,kCAAA,GAAA,EAAA,CAAA,CAAA;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-auth-backend-module-oauth2-proxy-provider",
|
|
3
|
-
"version": "0.2.8-next.
|
|
3
|
+
"version": "0.2.8-next.2",
|
|
4
4
|
"description": "The oauth2-proxy-provider backend module for the auth plugin.",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -36,14 +36,15 @@
|
|
|
36
36
|
"test": "backstage-cli package test"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@backstage/backend-plugin-api": "1.3.1-next.
|
|
39
|
+
"@backstage/backend-plugin-api": "1.3.1-next.2",
|
|
40
40
|
"@backstage/errors": "1.2.7",
|
|
41
|
-
"@backstage/plugin-auth-node": "0.6.3-next.
|
|
42
|
-
"jose": "^5.0.0"
|
|
41
|
+
"@backstage/plugin-auth-node": "0.6.3-next.2",
|
|
42
|
+
"jose": "^5.0.0",
|
|
43
|
+
"zod": "^3.22.4"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@backstage/backend-test-utils": "1.5.0-next.
|
|
46
|
-
"@backstage/cli": "0.32.1-next.
|
|
46
|
+
"@backstage/backend-test-utils": "1.5.0-next.3",
|
|
47
|
+
"@backstage/cli": "0.32.1-next.3"
|
|
47
48
|
},
|
|
48
49
|
"typesVersions": {
|
|
49
50
|
"*": {
|