@backstage/plugin-auth-backend-module-aws-alb-provider 0.1.15-next.3 → 0.1.16
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 +42 -0
- package/dist/index.cjs.js +7 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# @backstage/plugin-auth-backend-module-aws-alb-provider
|
|
2
2
|
|
|
3
|
+
## 0.1.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 17c9d35: Fix a bug where the signer was checked from the payload instead of the header
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/plugin-auth-backend@0.22.11
|
|
10
|
+
|
|
11
|
+
## 0.1.15
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- c8f1cae: Add `signIn` to authentication provider configuration schema
|
|
16
|
+
- 4ea354f: Added a `signer` configuration option to validate against the token claims. We strongly recommend that you set this value (typically on the format `arn:aws:elasticloadbalancing:us-east-2:123456789012:loadbalancer/app/my-load-balancer/1234567890123456`) to ensure that the auth provider can safely check the authenticity of any incoming tokens.
|
|
17
|
+
|
|
18
|
+
Example:
|
|
19
|
+
|
|
20
|
+
```diff
|
|
21
|
+
auth:
|
|
22
|
+
providers:
|
|
23
|
+
awsalb:
|
|
24
|
+
# this is the URL of the IdP you configured
|
|
25
|
+
issuer: 'https://example.okta.com/oauth2/default'
|
|
26
|
+
# this is the ARN of your ALB instance
|
|
27
|
+
+ signer: 'arn:aws:elasticloadbalancing:us-east-2:123456789012:loadbalancer/app/my-load-balancer/1234567890123456'
|
|
28
|
+
# this is the region where your ALB instance resides
|
|
29
|
+
region: 'us-west-2'
|
|
30
|
+
signIn:
|
|
31
|
+
resolvers:
|
|
32
|
+
# typically you would pick one of these
|
|
33
|
+
- resolver: emailMatchingUserEntityProfileEmail
|
|
34
|
+
- resolver: emailLocalPartMatchingUserEntityName
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- 93095ee: Make sure node-fetch is version 2.7.0 or greater
|
|
38
|
+
- Updated dependencies
|
|
39
|
+
- @backstage/backend-plugin-api@0.8.0
|
|
40
|
+
- @backstage/backend-common@0.24.0
|
|
41
|
+
- @backstage/plugin-auth-backend@0.22.10
|
|
42
|
+
- @backstage/plugin-auth-node@0.5.0
|
|
43
|
+
- @backstage/errors@1.2.4
|
|
44
|
+
|
|
3
45
|
## 0.1.15-next.3
|
|
4
46
|
|
|
5
47
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -108,12 +108,13 @@ const awsAlbAuthenticator = pluginAuthNode.createProxyAuthenticator({
|
|
|
108
108
|
},
|
|
109
109
|
initialize({ config }) {
|
|
110
110
|
const issuer = config.getString("issuer");
|
|
111
|
+
const signer = config.getOptionalString("signer");
|
|
111
112
|
const region = config.getString("region");
|
|
112
113
|
const keyCache = new NodeCache__default.default({ stdTTL: 3600 });
|
|
113
114
|
const getKey = provisionKeyCache(region, keyCache);
|
|
114
|
-
return { issuer, getKey };
|
|
115
|
+
return { issuer, signer, getKey };
|
|
115
116
|
},
|
|
116
|
-
async authenticate({ req }, { issuer, getKey }) {
|
|
117
|
+
async authenticate({ req }, { issuer, signer, getKey }) {
|
|
117
118
|
const jwt = req.header(ALB_JWT_HEADER);
|
|
118
119
|
const accessToken = req.header(ALB_ACCESS_TOKEN_HEADER);
|
|
119
120
|
if (jwt === void 0) {
|
|
@@ -128,9 +129,12 @@ const awsAlbAuthenticator = pluginAuthNode.createProxyAuthenticator({
|
|
|
128
129
|
}
|
|
129
130
|
try {
|
|
130
131
|
const verifyResult = await jose.jwtVerify(jwt, getKey);
|
|
132
|
+
const header = verifyResult.protectedHeader;
|
|
131
133
|
const claims = verifyResult.payload;
|
|
132
|
-
if (
|
|
134
|
+
if (claims?.iss !== issuer) {
|
|
133
135
|
throw new errors.AuthenticationError("Issuer mismatch on JWT token");
|
|
136
|
+
} else if (signer && header?.signer !== signer) {
|
|
137
|
+
throw new errors.AuthenticationError("Signer mismatch on JWT token");
|
|
134
138
|
}
|
|
135
139
|
const fullProfile = {
|
|
136
140
|
provider: "unknown",
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/helpers.ts","../src/authenticator.ts","../src/resolvers.ts","../src/module.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 */\nimport { KeyObject } from 'crypto';\nimport * as crypto from 'crypto';\nimport { JWTHeaderParameters, decodeJwt } from 'jose';\nimport NodeCache from 'node-cache';\nimport fetch from 'node-fetch';\nimport { PassportProfile, ProfileInfo } from '@backstage/plugin-auth-node';\nimport { AuthenticationError } from '@backstage/errors';\n\nexport const makeProfileInfo = (\n profile: PassportProfile,\n idToken?: string,\n): ProfileInfo => {\n let email: string | undefined = undefined;\n if (profile.emails && profile.emails.length > 0) {\n const [firstEmail] = profile.emails;\n email = firstEmail.value;\n }\n\n let picture: string | undefined = undefined;\n if (profile.avatarUrl) {\n picture = profile.avatarUrl;\n } else if (profile.photos && profile.photos.length > 0) {\n const [firstPhoto] = profile.photos;\n picture = firstPhoto.value;\n }\n\n let displayName: string | undefined =\n profile.displayName ?? profile.username ?? profile.id;\n\n if ((!email || !picture || !displayName) && idToken) {\n try {\n const decoded: Record<string, string> = decodeJwt(idToken) as {\n email?: string;\n picture?: string;\n name?: string;\n };\n if (!email && decoded.email) {\n email = decoded.email;\n }\n if (!picture && decoded.picture) {\n picture = decoded.picture;\n }\n if (!displayName && decoded.name) {\n displayName = decoded.name;\n }\n } catch (e) {\n throw new Error(`Failed to parse id token and get profile info, ${e}`);\n }\n }\n\n return {\n email,\n picture,\n displayName,\n };\n};\n\nconst getPublicKeyEndpoint = (region: string) => {\n if (region.startsWith('us-gov')) {\n return `https://s3-${encodeURIComponent(\n region,\n )}.amazonaws.com/aws-elb-public-keys-prod-${encodeURIComponent(region)}`;\n }\n\n return `https://public-keys.auth.elb.${encodeURIComponent(\n region,\n )}.amazonaws.com`;\n};\n\nexport const provisionKeyCache = (region: string, keyCache: NodeCache) => {\n return async (header: JWTHeaderParameters): Promise<KeyObject> => {\n if (!header.kid) {\n throw new AuthenticationError('No key id was specified in header');\n }\n const optionalCacheKey = keyCache.get<KeyObject>(header.kid);\n if (optionalCacheKey) {\n return crypto.createPublicKey(optionalCacheKey);\n }\n\n const keyText: string = await fetch(\n `${getPublicKeyEndpoint(region)}/${encodeURIComponent(header.kid)}`,\n ).then(response => response.text());\n\n const keyValue = crypto.createPublicKey(keyText);\n keyCache.set(header.kid, keyValue.export({ format: 'pem', type: 'spki' }));\n return keyValue;\n };\n};\n","/*\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 { AuthenticationError } from '@backstage/errors';\nimport { AwsAlbClaims, AwsAlbResult } from './types';\nimport { jwtVerify } from 'jose';\nimport {\n PassportProfile,\n createProxyAuthenticator,\n} from '@backstage/plugin-auth-node';\nimport NodeCache from 'node-cache';\nimport { makeProfileInfo, provisionKeyCache } from './helpers';\n\nexport const ALB_JWT_HEADER = 'x-amzn-oidc-data';\nexport const ALB_ACCESS_TOKEN_HEADER = 'x-amzn-oidc-accesstoken';\n\n/** @public */\nexport const awsAlbAuthenticator = createProxyAuthenticator({\n defaultProfileTransform: async (result: AwsAlbResult) => {\n return {\n profile: makeProfileInfo(result.fullProfile, result.accessToken),\n };\n },\n initialize({ config }) {\n const issuer = config.getString('issuer');\n const region = config.getString('region');\n const keyCache = new NodeCache({ stdTTL: 3600 });\n const getKey = provisionKeyCache(region, keyCache);\n return { issuer, getKey };\n },\n async authenticate({ req }, { issuer, getKey }) {\n const jwt = req.header(ALB_JWT_HEADER);\n const accessToken = req.header(ALB_ACCESS_TOKEN_HEADER);\n\n if (jwt === undefined) {\n throw new AuthenticationError(\n `Missing ALB OIDC header: ${ALB_JWT_HEADER}`,\n );\n }\n\n if (accessToken === undefined) {\n throw new AuthenticationError(\n `Missing ALB OIDC header: ${ALB_ACCESS_TOKEN_HEADER}`,\n );\n }\n\n try {\n const verifyResult = await jwtVerify(jwt, getKey);\n const claims = verifyResult.payload as AwsAlbClaims;\n\n if (issuer && claims?.iss !== issuer) {\n throw new AuthenticationError('Issuer mismatch on JWT token');\n }\n\n const fullProfile: PassportProfile = {\n provider: 'unknown',\n id: claims.sub,\n displayName: claims.name,\n username: claims.email.split('@')[0].toLowerCase(),\n name: {\n familyName: claims.family_name,\n givenName: claims.given_name,\n },\n emails: [{ value: claims.email.toLowerCase() }],\n photos: [{ value: claims.picture }],\n };\n\n return {\n result: {\n fullProfile,\n accessToken: accessToken,\n expiresInSeconds: claims.exp,\n },\n providerInfo: {\n accessToken: accessToken,\n expiresInSeconds: claims.exp,\n },\n };\n } catch (e) {\n throw new Error(`Exception occurred during JWT processing: ${e}`);\n }\n },\n});\n","/*\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 { AwsAlbResult } from './types';\n/**\n * Available sign-in resolvers for the AWS ALB auth provider.\n *\n * @public\n */\nexport namespace awsAlbSignInResolvers {\n export const emailMatchingUserEntityProfileEmail =\n createSignInResolverFactory({\n create() {\n return async (info: SignInInfo<AwsAlbResult>, ctx) => {\n if (!info.result.fullProfile.emails) {\n throw new Error(\n 'Login failed, user profile does not contain an email',\n );\n }\n return ctx.signInWithCatalogUser({\n filter: {\n kind: ['User'],\n 'spec.profile.email': info.result.fullProfile.emails[0].value,\n },\n });\n };\n },\n });\n}\n","/*\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 */\nimport { createBackendModule } from '@backstage/backend-plugin-api';\nimport {\n authProvidersExtensionPoint,\n commonSignInResolvers,\n createProxyAuthProviderFactory,\n} from '@backstage/plugin-auth-node';\nimport { awsAlbAuthenticator } from './authenticator';\nimport { awsAlbSignInResolvers } from './resolvers';\n\n/** @public */\nexport const authModuleAwsAlbProvider = createBackendModule({\n pluginId: 'auth',\n moduleId: 'awsAlbProvider',\n register(reg) {\n reg.registerInit({\n deps: {\n providers: authProvidersExtensionPoint,\n },\n async init({ providers }) {\n providers.registerProvider({\n providerId: 'awsalb',\n factory: createProxyAuthProviderFactory({\n authenticator: awsAlbAuthenticator,\n signInResolverFactories: {\n ...commonSignInResolvers,\n ...awsAlbSignInResolvers,\n },\n }),\n });\n },\n });\n },\n});\n"],"names":["decodeJwt","AuthenticationError","crypto","fetch","createProxyAuthenticator","NodeCache","jwtVerify","awsAlbSignInResolvers","createSignInResolverFactory","createBackendModule","authProvidersExtensionPoint","createProxyAuthProviderFactory","commonSignInResolvers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBa,MAAA,eAAA,GAAkB,CAC7B,OAAA,EACA,OACgB,KAAA;AAChB,EAAA,IAAI,KAA4B,GAAA,KAAA,CAAA,CAAA;AAChC,EAAA,IAAI,OAAQ,CAAA,MAAA,IAAU,OAAQ,CAAA,MAAA,CAAO,SAAS,CAAG,EAAA;AAC/C,IAAM,MAAA,CAAC,UAAU,CAAA,GAAI,OAAQ,CAAA,MAAA,CAAA;AAC7B,IAAA,KAAA,GAAQ,UAAW,CAAA,KAAA,CAAA;AAAA,GACrB;AAEA,EAAA,IAAI,OAA8B,GAAA,KAAA,CAAA,CAAA;AAClC,EAAA,IAAI,QAAQ,SAAW,EAAA;AACrB,IAAA,OAAA,GAAU,OAAQ,CAAA,SAAA,CAAA;AAAA,aACT,OAAQ,CAAA,MAAA,IAAU,OAAQ,CAAA,MAAA,CAAO,SAAS,CAAG,EAAA;AACtD,IAAM,MAAA,CAAC,UAAU,CAAA,GAAI,OAAQ,CAAA,MAAA,CAAA;AAC7B,IAAA,OAAA,GAAU,UAAW,CAAA,KAAA,CAAA;AAAA,GACvB;AAEA,EAAA,IAAI,WACF,GAAA,OAAA,CAAQ,WAAe,IAAA,OAAA,CAAQ,YAAY,OAAQ,CAAA,EAAA,CAAA;AAErD,EAAA,IAAA,CAAK,CAAC,KAAS,IAAA,CAAC,OAAW,IAAA,CAAC,gBAAgB,OAAS,EAAA;AACnD,IAAI,IAAA;AACF,MAAM,MAAA,OAAA,GAAkCA,eAAU,OAAO,CAAA,CAAA;AAKzD,MAAI,IAAA,CAAC,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A2BE,oCAAoB,CAAA;AAAA,EAC1D,QAAU,EAAA,MAAA;AAAA,EACV,QAAU,EAAA,gBAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,SAAW,EAAAC,0CAAA;AAAA,OACb;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,SAAA,EAAa,EAAA;AACxB,QAAA,SAAA,CAAU,gBAAiB,CAAA;AAAA,UACzB,UAAY,EAAA,QAAA;AAAA,UACZ,SAASC,6CAA+B,CAAA;AAAA,YACtC,aAAe,EAAA,mBAAA;AAAA,YACf,uBAAyB,EAAA;AAAA,cACvB,GAAGC,oCAAA;AAAA,cACH,GAAGL,6BAAA;AAAA,aACL;AAAA,WACD,CAAA;AAAA,SACF,CAAA,CAAA;AAAA,OACH;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/helpers.ts","../src/authenticator.ts","../src/resolvers.ts","../src/module.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 */\nimport { KeyObject } from 'crypto';\nimport * as crypto from 'crypto';\nimport { JWTHeaderParameters, decodeJwt } from 'jose';\nimport NodeCache from 'node-cache';\nimport fetch from 'node-fetch';\nimport { PassportProfile, ProfileInfo } from '@backstage/plugin-auth-node';\nimport { AuthenticationError } from '@backstage/errors';\n\nexport const makeProfileInfo = (\n profile: PassportProfile,\n idToken?: string,\n): ProfileInfo => {\n let email: string | undefined = undefined;\n if (profile.emails && profile.emails.length > 0) {\n const [firstEmail] = profile.emails;\n email = firstEmail.value;\n }\n\n let picture: string | undefined = undefined;\n if (profile.avatarUrl) {\n picture = profile.avatarUrl;\n } else if (profile.photos && profile.photos.length > 0) {\n const [firstPhoto] = profile.photos;\n picture = firstPhoto.value;\n }\n\n let displayName: string | undefined =\n profile.displayName ?? profile.username ?? profile.id;\n\n if ((!email || !picture || !displayName) && idToken) {\n try {\n const decoded: Record<string, string> = decodeJwt(idToken) as {\n email?: string;\n picture?: string;\n name?: string;\n };\n if (!email && decoded.email) {\n email = decoded.email;\n }\n if (!picture && decoded.picture) {\n picture = decoded.picture;\n }\n if (!displayName && decoded.name) {\n displayName = decoded.name;\n }\n } catch (e) {\n throw new Error(`Failed to parse id token and get profile info, ${e}`);\n }\n }\n\n return {\n email,\n picture,\n displayName,\n };\n};\n\nconst getPublicKeyEndpoint = (region: string) => {\n if (region.startsWith('us-gov')) {\n return `https://s3-${encodeURIComponent(\n region,\n )}.amazonaws.com/aws-elb-public-keys-prod-${encodeURIComponent(region)}`;\n }\n\n return `https://public-keys.auth.elb.${encodeURIComponent(\n region,\n )}.amazonaws.com`;\n};\n\nexport const provisionKeyCache = (region: string, keyCache: NodeCache) => {\n return async (header: JWTHeaderParameters): Promise<KeyObject> => {\n if (!header.kid) {\n throw new AuthenticationError('No key id was specified in header');\n }\n const optionalCacheKey = keyCache.get<KeyObject>(header.kid);\n if (optionalCacheKey) {\n return crypto.createPublicKey(optionalCacheKey);\n }\n\n const keyText: string = await fetch(\n `${getPublicKeyEndpoint(region)}/${encodeURIComponent(header.kid)}`,\n ).then(response => response.text());\n\n const keyValue = crypto.createPublicKey(keyText);\n keyCache.set(header.kid, keyValue.export({ format: 'pem', type: 'spki' }));\n return keyValue;\n };\n};\n","/*\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 { AuthenticationError } from '@backstage/errors';\nimport { AwsAlbClaims, AwsAlbResult, AwsAlbProtectedHeader } from './types';\nimport { jwtVerify } from 'jose';\nimport {\n PassportProfile,\n createProxyAuthenticator,\n} from '@backstage/plugin-auth-node';\nimport NodeCache from 'node-cache';\nimport { makeProfileInfo, provisionKeyCache } from './helpers';\n\nexport const ALB_JWT_HEADER = 'x-amzn-oidc-data';\nexport const ALB_ACCESS_TOKEN_HEADER = 'x-amzn-oidc-accesstoken';\n\n/** @public */\nexport const awsAlbAuthenticator = createProxyAuthenticator({\n defaultProfileTransform: async (result: AwsAlbResult) => {\n return {\n profile: makeProfileInfo(result.fullProfile, result.accessToken),\n };\n },\n initialize({ config }) {\n const issuer = config.getString('issuer');\n const signer = config.getOptionalString('signer');\n const region = config.getString('region');\n const keyCache = new NodeCache({ stdTTL: 3600 });\n const getKey = provisionKeyCache(region, keyCache);\n return { issuer, signer, getKey };\n },\n async authenticate({ req }, { issuer, signer, getKey }) {\n const jwt = req.header(ALB_JWT_HEADER);\n const accessToken = req.header(ALB_ACCESS_TOKEN_HEADER);\n\n if (jwt === undefined) {\n throw new AuthenticationError(\n `Missing ALB OIDC header: ${ALB_JWT_HEADER}`,\n );\n }\n\n if (accessToken === undefined) {\n throw new AuthenticationError(\n `Missing ALB OIDC header: ${ALB_ACCESS_TOKEN_HEADER}`,\n );\n }\n\n try {\n const verifyResult = await jwtVerify(jwt, getKey);\n const header = verifyResult.protectedHeader as AwsAlbProtectedHeader;\n const claims = verifyResult.payload as AwsAlbClaims;\n\n if (claims?.iss !== issuer) {\n throw new AuthenticationError('Issuer mismatch on JWT token');\n } else if (signer && header?.signer !== signer) {\n throw new AuthenticationError('Signer mismatch on JWT token');\n }\n\n const fullProfile: PassportProfile = {\n provider: 'unknown',\n id: claims.sub,\n displayName: claims.name,\n username: claims.email.split('@')[0].toLowerCase(),\n name: {\n familyName: claims.family_name,\n givenName: claims.given_name,\n },\n emails: [{ value: claims.email.toLowerCase() }],\n photos: [{ value: claims.picture }],\n };\n\n return {\n result: {\n fullProfile,\n accessToken: accessToken,\n expiresInSeconds: claims.exp,\n },\n providerInfo: {\n accessToken: accessToken,\n expiresInSeconds: claims.exp,\n },\n };\n } catch (e) {\n throw new Error(`Exception occurred during JWT processing: ${e}`);\n }\n },\n});\n","/*\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 { AwsAlbResult } from './types';\n/**\n * Available sign-in resolvers for the AWS ALB auth provider.\n *\n * @public\n */\nexport namespace awsAlbSignInResolvers {\n export const emailMatchingUserEntityProfileEmail =\n createSignInResolverFactory({\n create() {\n return async (info: SignInInfo<AwsAlbResult>, ctx) => {\n if (!info.result.fullProfile.emails) {\n throw new Error(\n 'Login failed, user profile does not contain an email',\n );\n }\n return ctx.signInWithCatalogUser({\n filter: {\n kind: ['User'],\n 'spec.profile.email': info.result.fullProfile.emails[0].value,\n },\n });\n };\n },\n });\n}\n","/*\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 */\nimport { createBackendModule } from '@backstage/backend-plugin-api';\nimport {\n authProvidersExtensionPoint,\n commonSignInResolvers,\n createProxyAuthProviderFactory,\n} from '@backstage/plugin-auth-node';\nimport { awsAlbAuthenticator } from './authenticator';\nimport { awsAlbSignInResolvers } from './resolvers';\n\n/** @public */\nexport const authModuleAwsAlbProvider = createBackendModule({\n pluginId: 'auth',\n moduleId: 'awsAlbProvider',\n register(reg) {\n reg.registerInit({\n deps: {\n providers: authProvidersExtensionPoint,\n },\n async init({ providers }) {\n providers.registerProvider({\n providerId: 'awsalb',\n factory: createProxyAuthProviderFactory({\n authenticator: awsAlbAuthenticator,\n signInResolverFactories: {\n ...commonSignInResolvers,\n ...awsAlbSignInResolvers,\n },\n }),\n });\n },\n });\n },\n});\n"],"names":["decodeJwt","AuthenticationError","crypto","fetch","createProxyAuthenticator","NodeCache","jwtVerify","awsAlbSignInResolvers","createSignInResolverFactory","createBackendModule","authProvidersExtensionPoint","createProxyAuthProviderFactory","commonSignInResolvers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBa,MAAA,eAAA,GAAkB,CAC7B,OAAA,EACA,OACgB,KAAA;AAChB,EAAA,IAAI,KAA4B,GAAA,KAAA,CAAA,CAAA;AAChC,EAAA,IAAI,OAAQ,CAAA,MAAA,IAAU,OAAQ,CAAA,MAAA,CAAO,SAAS,CAAG,EAAA;AAC/C,IAAM,MAAA,CAAC,UAAU,CAAA,GAAI,OAAQ,CAAA,MAAA,CAAA;AAC7B,IAAA,KAAA,GAAQ,UAAW,CAAA,KAAA,CAAA;AAAA,GACrB;AAEA,EAAA,IAAI,OAA8B,GAAA,KAAA,CAAA,CAAA;AAClC,EAAA,IAAI,QAAQ,SAAW,EAAA;AACrB,IAAA,OAAA,GAAU,OAAQ,CAAA,SAAA,CAAA;AAA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BAAA;AAAA,aACL;AAAA,WACD,CAAA;AAAA,SACF,CAAA,CAAA;AAAA,OACH;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ type AwsAlbResult = {
|
|
|
20
20
|
/** @public */
|
|
21
21
|
declare const awsAlbAuthenticator: _backstage_plugin_auth_node.ProxyAuthenticator<{
|
|
22
22
|
issuer: string;
|
|
23
|
+
signer: string | undefined;
|
|
23
24
|
getKey: (header: jose.JWTHeaderParameters) => Promise<crypto.KeyObject>;
|
|
24
25
|
}, AwsAlbResult, {
|
|
25
26
|
accessToken: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-auth-backend-module-aws-alb-provider",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "The aws-alb provider module for the Backstage auth backend.",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
"test": "backstage-cli package test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@backstage/backend-common": "^0.
|
|
41
|
-
"@backstage/backend-plugin-api": "^0.8.0
|
|
40
|
+
"@backstage/backend-common": "^0.24.0",
|
|
41
|
+
"@backstage/backend-plugin-api": "^0.8.0",
|
|
42
42
|
"@backstage/errors": "^1.2.4",
|
|
43
|
-
"@backstage/plugin-auth-backend": "^0.22.
|
|
44
|
-
"@backstage/plugin-auth-node": "^0.5.0
|
|
43
|
+
"@backstage/plugin-auth-backend": "^0.22.11",
|
|
44
|
+
"@backstage/plugin-auth-node": "^0.5.0",
|
|
45
45
|
"jose": "^5.0.0",
|
|
46
46
|
"node-cache": "^5.1.2",
|
|
47
47
|
"node-fetch": "^2.7.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@backstage/backend-test-utils": "^0.
|
|
51
|
-
"@backstage/cli": "^0.27.0
|
|
50
|
+
"@backstage/backend-test-utils": "^0.5.0",
|
|
51
|
+
"@backstage/cli": "^0.27.0",
|
|
52
52
|
"@backstage/config": "^1.2.0",
|
|
53
53
|
"express": "^4.18.2",
|
|
54
54
|
"msw": "^2.0.8"
|