@backstage/plugin-auth-node 0.6.4-next.0 → 0.6.4
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
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @backstage/plugin-auth-node
|
|
2
2
|
|
|
3
|
+
## 0.6.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0169b23: Internal tweak to avoid circular dependencies
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/catalog-client@1.10.1
|
|
10
|
+
- @backstage/backend-plugin-api@1.4.0
|
|
11
|
+
- @backstage/catalog-model@1.7.4
|
|
12
|
+
- @backstage/config@1.3.2
|
|
13
|
+
- @backstage/errors@1.2.7
|
|
14
|
+
- @backstage/types@1.2.1
|
|
15
|
+
|
|
16
|
+
## 0.6.4-next.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @backstage/catalog-client@1.10.1-next.0
|
|
22
|
+
- @backstage/backend-plugin-api@1.4.0-next.1
|
|
23
|
+
- @backstage/catalog-model@1.7.4
|
|
24
|
+
- @backstage/config@1.3.2
|
|
25
|
+
- @backstage/errors@1.2.7
|
|
26
|
+
- @backstage/types@1.2.1
|
|
27
|
+
|
|
3
28
|
## 0.6.4-next.0
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareBackstageIdentityResponse.cjs.js","sources":["../../src/identity/prepareBackstageIdentityResponse.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { InputError } from '@backstage/errors';\nimport {
|
|
1
|
+
{"version":3,"file":"prepareBackstageIdentityResponse.cjs.js","sources":["../../src/identity/prepareBackstageIdentityResponse.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { InputError } from '@backstage/errors';\nimport { BackstageIdentityResponse, BackstageSignInResult } from '../types';\n\nfunction parseJwtPayload(token: string) {\n const [_header, payload, _signature] = token.split('.');\n return JSON.parse(Buffer.from(payload, 'base64').toString());\n}\n\n/**\n * Parses a Backstage-issued token and decorates the\n * {@link @backstage/plugin-auth-node#BackstageIdentityResponse} with identity information sourced from the\n * token.\n *\n * @public\n */\nexport function prepareBackstageIdentityResponse(\n result: BackstageSignInResult,\n): BackstageIdentityResponse {\n if (!result.token) {\n throw new InputError(`Identity response must return a token`);\n }\n\n const { sub, ent = [], exp: expStr } = parseJwtPayload(result.token);\n if (!sub) {\n throw new InputError(\n `Identity response must return a token with subject claim`,\n );\n }\n\n const expAt = Number(expStr);\n\n // Default to 1 hour if no expiration is set, in particular to make testing simpler\n const exp = expAt ? Math.round(expAt - Date.now() / 1000) : undefined;\n if (exp && exp < 0) {\n throw new InputError(`Identity response must not return an expired token`);\n }\n\n return {\n ...result,\n expiresInSeconds: exp,\n identity: result.identity ?? {\n type: 'user',\n userEntityRef: sub,\n ownershipEntityRefs: ent,\n },\n };\n}\n"],"names":["InputError"],"mappings":";;;;AAmBA,SAAS,gBAA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ue, JsonObject } from '@backstage/types';
|
|
7
7
|
import express, { Request, Response } from 'express';
|
|
8
|
-
import { BackstageSignInResult as BackstageSignInResult$1, BackstageIdentityResponse as BackstageIdentityResponse$1 } from '@backstage/plugin-auth-node';
|
|
9
8
|
import { Profile, Strategy } from 'passport';
|
|
10
9
|
import { ZodSchema, ZodTypeDef } from 'zod';
|
|
11
10
|
|
|
@@ -418,7 +417,7 @@ declare function sendWebMessageResponse(res: Response, appOrigin: string, respon
|
|
|
418
417
|
*
|
|
419
418
|
* @public
|
|
420
419
|
*/
|
|
421
|
-
declare function prepareBackstageIdentityResponse(result: BackstageSignInResult
|
|
420
|
+
declare function prepareBackstageIdentityResponse(result: BackstageSignInResult): BackstageIdentityResponse;
|
|
422
421
|
|
|
423
422
|
/**
|
|
424
423
|
* Parses the given authorization header and returns the bearer token, or
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-auth-node",
|
|
3
|
-
"version": "0.6.4
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "node-library",
|
|
6
6
|
"pluginId": "auth",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"test": "backstage-cli package test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@backstage/backend-plugin-api": "1.4.0
|
|
41
|
-
"@backstage/catalog-client": "1.10.
|
|
42
|
-
"@backstage/catalog-model": "1.7.4",
|
|
43
|
-
"@backstage/config": "1.3.2",
|
|
44
|
-
"@backstage/errors": "1.2.7",
|
|
45
|
-
"@backstage/types": "1.2.1",
|
|
40
|
+
"@backstage/backend-plugin-api": "^1.4.0",
|
|
41
|
+
"@backstage/catalog-client": "^1.10.1",
|
|
42
|
+
"@backstage/catalog-model": "^1.7.4",
|
|
43
|
+
"@backstage/config": "^1.3.2",
|
|
44
|
+
"@backstage/errors": "^1.2.7",
|
|
45
|
+
"@backstage/types": "^1.2.1",
|
|
46
46
|
"@types/express": "^4.17.6",
|
|
47
47
|
"@types/passport": "^1.0.3",
|
|
48
48
|
"express": "^4.17.1",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"zod-validation-error": "^3.4.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@backstage/backend-defaults": "0.
|
|
58
|
-
"@backstage/backend-test-utils": "1.6.0
|
|
59
|
-
"@backstage/cli": "0.
|
|
57
|
+
"@backstage/backend-defaults": "^0.11.0",
|
|
58
|
+
"@backstage/backend-test-utils": "^1.6.0",
|
|
59
|
+
"@backstage/cli": "^0.33.0",
|
|
60
60
|
"cookie-parser": "^1.4.6",
|
|
61
61
|
"express-promise-router": "^4.1.1",
|
|
62
62
|
"lodash": "^4.17.21",
|