@backstage/plugin-auth-node 0.1.1 → 0.1.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 +27 -0
- package/dist/index.d.ts +124 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @backstage/plugin-auth-node
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/catalog-model@0.12.0
|
|
9
|
+
- @backstage/backend-common@0.12.0
|
|
10
|
+
|
|
11
|
+
## 0.1.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
- @backstage/backend-common@0.11.0
|
|
17
|
+
- @backstage/catalog-model@0.11.0
|
|
18
|
+
|
|
19
|
+
## 0.1.2
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Fix for the previous release with missing type declarations.
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
- @backstage/backend-common@0.10.9
|
|
26
|
+
- @backstage/catalog-model@0.10.1
|
|
27
|
+
- @backstage/config@0.1.15
|
|
28
|
+
- @backstage/errors@0.2.2
|
|
29
|
+
|
|
3
30
|
## 0.1.1
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
|
2
|
+
import { Entity } from '@backstage/catalog-model';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Parses the given authorization header and returns the bearer token, or
|
|
6
|
+
* undefined if no bearer token is given.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
*
|
|
10
|
+
* This function is explicitly built to tolerate bad inputs safely, so you may
|
|
11
|
+
* call it directly with e.g. the output of `req.header('authorization')`
|
|
12
|
+
* without first checking that it exists.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
declare function getBearerTokenFromAuthorizationHeader(authorizationHeader: unknown): string | undefined;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A representation of a successful Backstage sign-in.
|
|
20
|
+
*
|
|
21
|
+
* Compared to the {@link BackstageIdentityResponse} this type omits
|
|
22
|
+
* the decoded identity information embedded in the token.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
interface BackstageSignInResult {
|
|
27
|
+
/**
|
|
28
|
+
* An opaque ID that uniquely identifies the user within Backstage.
|
|
29
|
+
*
|
|
30
|
+
* This is typically the same as the user entity `metadata.name`.
|
|
31
|
+
*
|
|
32
|
+
* @deprecated Use the `identity` field instead
|
|
33
|
+
*/
|
|
34
|
+
id: string;
|
|
35
|
+
/**
|
|
36
|
+
* The entity that the user is represented by within Backstage.
|
|
37
|
+
*
|
|
38
|
+
* This entity may or may not exist within the Catalog, and it can be used
|
|
39
|
+
* to read and store additional metadata about the user.
|
|
40
|
+
*
|
|
41
|
+
* @deprecated Use the `identity` field instead.
|
|
42
|
+
*/
|
|
43
|
+
entity?: Entity;
|
|
44
|
+
/**
|
|
45
|
+
* The token used to authenticate the user within Backstage.
|
|
46
|
+
*/
|
|
47
|
+
token: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Response object containing the {@link BackstageUserIdentity} and the token
|
|
51
|
+
* from the authentication provider.
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
interface BackstageIdentityResponse extends BackstageSignInResult {
|
|
56
|
+
/**
|
|
57
|
+
* A plaintext description of the identity that is encapsulated within the token.
|
|
58
|
+
*/
|
|
59
|
+
identity: BackstageUserIdentity;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* User identity information within Backstage.
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
declare type BackstageUserIdentity = {
|
|
67
|
+
/**
|
|
68
|
+
* The type of identity that this structure represents. In the frontend app
|
|
69
|
+
* this will currently always be 'user'.
|
|
70
|
+
*/
|
|
71
|
+
type: 'user';
|
|
72
|
+
/**
|
|
73
|
+
* The entityRef of the user in the catalog.
|
|
74
|
+
* For example User:default/sandra
|
|
75
|
+
*/
|
|
76
|
+
userEntityRef: string;
|
|
77
|
+
/**
|
|
78
|
+
* The user and group entities that the user claims ownership through
|
|
79
|
+
*/
|
|
80
|
+
ownershipEntityRefs: string[];
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* An identity client to interact with auth-backend and authenticate Backstage
|
|
85
|
+
* tokens
|
|
86
|
+
*
|
|
87
|
+
* @experimental This is not a stable API yet
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
declare class IdentityClient {
|
|
91
|
+
private readonly discovery;
|
|
92
|
+
private readonly issuer;
|
|
93
|
+
private keyStore;
|
|
94
|
+
private keyStoreUpdated;
|
|
95
|
+
/**
|
|
96
|
+
* Create a new {@link IdentityClient} instance.
|
|
97
|
+
*/
|
|
98
|
+
static create(options: {
|
|
99
|
+
discovery: PluginEndpointDiscovery;
|
|
100
|
+
issuer: string;
|
|
101
|
+
}): IdentityClient;
|
|
102
|
+
private constructor();
|
|
103
|
+
/**
|
|
104
|
+
* Verifies the given backstage identity token
|
|
105
|
+
* Returns a BackstageIdentity (user) matching the token.
|
|
106
|
+
* The method throws an error if verification fails.
|
|
107
|
+
*/
|
|
108
|
+
authenticate(token: string | undefined): Promise<BackstageIdentityResponse>;
|
|
109
|
+
/**
|
|
110
|
+
* Returns the public signing key matching the given jwt token,
|
|
111
|
+
* or null if no matching key was found
|
|
112
|
+
*/
|
|
113
|
+
private getKey;
|
|
114
|
+
/**
|
|
115
|
+
* Lists public part of keys used to sign Backstage Identity tokens
|
|
116
|
+
*/
|
|
117
|
+
private listPublicKeys;
|
|
118
|
+
/**
|
|
119
|
+
* Fetches public keys and caches them locally
|
|
120
|
+
*/
|
|
121
|
+
private refreshKeyStore;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { BackstageIdentityResponse, BackstageSignInResult, BackstageUserIdentity, IdentityClient, getBearerTokenFromAuthorizationHeader };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-auth-node",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"main": "dist/index.cjs.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,21 +23,21 @@
|
|
|
23
23
|
"start": "backstage-cli package start"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@backstage/backend-common": "^0.
|
|
27
|
-
"@backstage/catalog-model": "^0.
|
|
28
|
-
"@backstage/config": "^0.1.
|
|
29
|
-
"@backstage/errors": "^0.2.
|
|
26
|
+
"@backstage/backend-common": "^0.12.0",
|
|
27
|
+
"@backstage/catalog-model": "^0.12.0",
|
|
28
|
+
"@backstage/config": "^0.1.15",
|
|
29
|
+
"@backstage/errors": "^0.2.2",
|
|
30
30
|
"jose": "^1.27.1",
|
|
31
31
|
"node-fetch": "^2.6.7",
|
|
32
32
|
"winston": "^3.2.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@backstage/cli": "^0.
|
|
35
|
+
"@backstage/cli": "^0.15.0",
|
|
36
36
|
"msw": "^0.35.0",
|
|
37
37
|
"uuid": "^8.0.0"
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
40
|
"dist"
|
|
41
41
|
],
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "04bb0dd824b78f6b57dac62c3015e681f094045c"
|
|
43
43
|
}
|