@backstage/plugin-auth-backend 0.7.0-next.0 → 0.9.0-next.1
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 +74 -0
- package/dist/index.cjs.js +154 -85
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +42 -37
- package/package.json +10 -10
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import express from 'express';
|
|
3
3
|
import { Logger } from 'winston';
|
|
4
4
|
import { Config } from '@backstage/config';
|
|
5
|
-
import { PluginEndpointDiscovery, PluginDatabaseManager } from '@backstage/backend-common';
|
|
5
|
+
import { TokenManager, PluginEndpointDiscovery, PluginDatabaseManager } from '@backstage/backend-common';
|
|
6
6
|
import { CatalogApi } from '@backstage/catalog-client';
|
|
7
7
|
import { UserEntity, Entity } from '@backstage/catalog-model';
|
|
8
8
|
import { Profile } from 'passport';
|
|
@@ -103,6 +103,7 @@ declare type OAuthState = {
|
|
|
103
103
|
nonce: string;
|
|
104
104
|
env: string;
|
|
105
105
|
origin?: string;
|
|
106
|
+
scope?: string;
|
|
106
107
|
};
|
|
107
108
|
declare type OAuthStartRequest = express.Request<{}> & {
|
|
108
109
|
scope: string;
|
|
@@ -144,6 +145,39 @@ interface OAuthHandlers {
|
|
|
144
145
|
logout?(): Promise<void>;
|
|
145
146
|
}
|
|
146
147
|
|
|
148
|
+
declare type UserQuery = {
|
|
149
|
+
annotations: Record<string, string>;
|
|
150
|
+
};
|
|
151
|
+
declare type MemberClaimQuery = {
|
|
152
|
+
entityRefs: string[];
|
|
153
|
+
logger?: Logger;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* A catalog client tailored for reading out identity data from the catalog.
|
|
157
|
+
*/
|
|
158
|
+
declare class CatalogIdentityClient {
|
|
159
|
+
private readonly catalogApi;
|
|
160
|
+
private readonly tokenManager;
|
|
161
|
+
constructor(options: {
|
|
162
|
+
catalogApi: CatalogApi;
|
|
163
|
+
tokenManager: TokenManager;
|
|
164
|
+
});
|
|
165
|
+
/**
|
|
166
|
+
* Looks up a single user using a query.
|
|
167
|
+
*
|
|
168
|
+
* Throws a NotFoundError or ConflictError if 0 or multiple users are found.
|
|
169
|
+
*/
|
|
170
|
+
findUser(query: UserQuery): Promise<UserEntity>;
|
|
171
|
+
/**
|
|
172
|
+
* Resolve additional entity claims from the catalog, using the passed-in entity names. Designed
|
|
173
|
+
* to be used within a `signInResolver` where additional entity claims might be provided, but
|
|
174
|
+
* group membership and transient group membership lean on imported catalog relations.
|
|
175
|
+
*
|
|
176
|
+
* Returns a superset of the entity names that can be passed directly to `issueToken` as `ent`.
|
|
177
|
+
*/
|
|
178
|
+
resolveCatalogMembership(query: MemberClaimQuery): Promise<string[]>;
|
|
179
|
+
}
|
|
180
|
+
|
|
147
181
|
/**
|
|
148
182
|
* A identity client to interact with auth-backend
|
|
149
183
|
* and authenticate backstage identity tokens
|
|
@@ -187,39 +221,6 @@ declare class IdentityClient {
|
|
|
187
221
|
private refreshKeyStore;
|
|
188
222
|
}
|
|
189
223
|
|
|
190
|
-
declare type UserQuery = {
|
|
191
|
-
annotations: Record<string, string>;
|
|
192
|
-
};
|
|
193
|
-
declare type MemberClaimQuery = {
|
|
194
|
-
entityRefs: string[];
|
|
195
|
-
logger?: Logger;
|
|
196
|
-
};
|
|
197
|
-
/**
|
|
198
|
-
* A catalog client tailored for reading out identity data from the catalog.
|
|
199
|
-
*/
|
|
200
|
-
declare class CatalogIdentityClient {
|
|
201
|
-
private readonly catalogApi;
|
|
202
|
-
private readonly tokenIssuer;
|
|
203
|
-
constructor(options: {
|
|
204
|
-
catalogApi: CatalogApi;
|
|
205
|
-
tokenIssuer: TokenIssuer;
|
|
206
|
-
});
|
|
207
|
-
/**
|
|
208
|
-
* Looks up a single user using a query.
|
|
209
|
-
*
|
|
210
|
-
* Throws a NotFoundError or ConflictError if 0 or multiple users are found.
|
|
211
|
-
*/
|
|
212
|
-
findUser(query: UserQuery): Promise<UserEntity>;
|
|
213
|
-
/**
|
|
214
|
-
* Resolve additional entity claims from the catalog, using the passed-in entity names. Designed
|
|
215
|
-
* to be used within a `signInResolver` where additional entity claims might be provided, but
|
|
216
|
-
* group membership and transient group membership lean on imported catalog relations.
|
|
217
|
-
*
|
|
218
|
-
* Returns a superset of the entity names that can be passed directly to `issueToken` as `ent`.
|
|
219
|
-
*/
|
|
220
|
-
resolveCatalogMembership(query: MemberClaimQuery): Promise<string[]>;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
224
|
declare function getEntityClaims(entity: UserEntity): TokenParams['claims'];
|
|
224
225
|
|
|
225
226
|
/**
|
|
@@ -313,6 +314,7 @@ declare type AuthProviderFactoryOptions = {
|
|
|
313
314
|
globalConfig: AuthProviderConfig;
|
|
314
315
|
config: Config;
|
|
315
316
|
logger: Logger;
|
|
317
|
+
tokenManager: TokenManager;
|
|
316
318
|
tokenIssuer: TokenIssuer;
|
|
317
319
|
discovery: PluginEndpointDiscovery;
|
|
318
320
|
catalogApi: CatalogApi;
|
|
@@ -491,11 +493,13 @@ declare type Options = {
|
|
|
491
493
|
appOrigin: string;
|
|
492
494
|
tokenIssuer: TokenIssuer;
|
|
493
495
|
isOriginAllowed: (origin: string) => boolean;
|
|
496
|
+
callbackUrl?: string;
|
|
494
497
|
};
|
|
495
498
|
declare class OAuthAdapter implements AuthProviderRouteHandlers {
|
|
496
499
|
private readonly handlers;
|
|
497
500
|
private readonly options;
|
|
498
|
-
static fromConfig(config: AuthProviderConfig, handlers: OAuthHandlers, options: Pick<Options, 'providerId' | 'persistScopes' | 'disableRefresh' | 'tokenIssuer'>): OAuthAdapter;
|
|
501
|
+
static fromConfig(config: AuthProviderConfig, handlers: OAuthHandlers, options: Pick<Options, 'providerId' | 'persistScopes' | 'disableRefresh' | 'tokenIssuer' | 'callbackUrl'>): OAuthAdapter;
|
|
502
|
+
private readonly baseCookieOptions;
|
|
499
503
|
constructor(handlers: OAuthHandlers, options: Options);
|
|
500
504
|
start(req: express.Request, res: express.Response): Promise<void>;
|
|
501
505
|
frameHandler(req: express.Request, res: express.Response): Promise<void>;
|
|
@@ -507,8 +511,8 @@ declare class OAuthAdapter implements AuthProviderRouteHandlers {
|
|
|
507
511
|
*/
|
|
508
512
|
private populateIdentity;
|
|
509
513
|
private setNonceCookie;
|
|
510
|
-
private
|
|
511
|
-
private
|
|
514
|
+
private setGrantedScopeCookie;
|
|
515
|
+
private getGrantedScopeFromCookie;
|
|
512
516
|
private setRefreshTokenCookie;
|
|
513
517
|
private removeRefreshTokenCookie;
|
|
514
518
|
}
|
|
@@ -974,6 +978,7 @@ interface RouterOptions {
|
|
|
974
978
|
database: PluginDatabaseManager;
|
|
975
979
|
config: Config;
|
|
976
980
|
discovery: PluginEndpointDiscovery;
|
|
981
|
+
tokenManager: TokenManager;
|
|
977
982
|
providerFactories?: ProviderFactories;
|
|
978
983
|
}
|
|
979
984
|
declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-auth-backend",
|
|
3
3
|
"description": "A Backstage backend plugin that handles authentication",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.0-next.1",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"clean": "backstage-cli clean"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@backstage/backend-common": "^0.10.
|
|
34
|
-
"@backstage/catalog-client": "^0.5.5
|
|
35
|
-
"@backstage/catalog-model": "^0.9.10
|
|
36
|
-
"@backstage/config": "^0.1.13
|
|
33
|
+
"@backstage/backend-common": "^0.10.6-next.0",
|
|
34
|
+
"@backstage/catalog-client": "^0.5.5",
|
|
35
|
+
"@backstage/catalog-model": "^0.9.10",
|
|
36
|
+
"@backstage/config": "^0.1.13",
|
|
37
37
|
"@backstage/errors": "^0.2.0",
|
|
38
38
|
"@backstage/types": "^0.1.1",
|
|
39
|
-
"@google-cloud/firestore": "^
|
|
39
|
+
"@google-cloud/firestore": "^5.0.2",
|
|
40
40
|
"@types/express": "^4.17.6",
|
|
41
41
|
"@types/passport": "^1.0.3",
|
|
42
42
|
"compression": "^1.7.4",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"node-cache": "^5.1.2",
|
|
59
59
|
"node-fetch": "^2.6.1",
|
|
60
60
|
"openid-client": "^4.2.1",
|
|
61
|
-
"passport": "^0.
|
|
61
|
+
"passport": "^0.5.2",
|
|
62
62
|
"passport-bitbucket-oauth2": "^0.1.2",
|
|
63
63
|
"passport-github2": "^0.1.12",
|
|
64
64
|
"passport-gitlab2": "^5.0.0",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"yn": "^4.0.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@backstage/cli": "^0.
|
|
77
|
-
"@backstage/test-utils": "^0.2.
|
|
76
|
+
"@backstage/cli": "^0.13.1-next.1",
|
|
77
|
+
"@backstage/test-utils": "^0.2.4-next.0",
|
|
78
78
|
"@types/body-parser": "^1.19.0",
|
|
79
79
|
"@types/cookie-parser": "^1.4.2",
|
|
80
80
|
"@types/express-session": "^1.17.2",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"config.d.ts"
|
|
95
95
|
],
|
|
96
96
|
"configSchema": "config.d.ts",
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "d6da97a1edeb21fcefc682d91916987ba9f3d89a"
|
|
98
98
|
}
|