@backstage/plugin-auth-backend 0.18.7 → 0.18.8-next.0
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 +12 -3
- package/config.d.ts +10 -0
- package/dist/index.cjs.js +253 -577
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +157 -317
- package/package.json +11 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,43 +1,31 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
3
|
+
import { LoggerService } from '@backstage/backend-plugin-api';
|
|
2
4
|
import express from 'express';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { Entity, UserEntity } from '@backstage/catalog-model';
|
|
6
|
-
import { Config } from '@backstage/config';
|
|
7
|
-
import { BackstageSignInResult, BackstageIdentityResponse } from '@backstage/plugin-auth-node';
|
|
8
|
-
import { JsonValue } from '@backstage/types';
|
|
5
|
+
import * as _backstage_plugin_auth_node from '@backstage/plugin-auth-node';
|
|
6
|
+
import { BackstageSignInResult, OAuthState as OAuthState$1, AuthResolverCatalogUserQuery as AuthResolverCatalogUserQuery$1, AuthResolverContext as AuthResolverContext$1, CookieConfigurer as CookieConfigurer$1, AuthProviderConfig as AuthProviderConfig$1, AuthProviderRouteHandlers as AuthProviderRouteHandlers$1, AuthProviderFactory as AuthProviderFactory$1, ClientAuthResponse, ProfileInfo as ProfileInfo$1, SignInInfo as SignInInfo$1, SignInResolver as SignInResolver$1, OAuthEnvironmentHandler as OAuthEnvironmentHandler$1, decodeOAuthState, encodeOAuthState, prepareBackstageIdentityResponse as prepareBackstageIdentityResponse$1, TokenParams as TokenParams$1, WebMessageResponse as WebMessageResponse$1 } from '@backstage/plugin-auth-node';
|
|
9
7
|
import { Profile } from 'passport';
|
|
10
8
|
import { PluginDatabaseManager, PluginEndpointDiscovery, TokenManager } from '@backstage/backend-common';
|
|
9
|
+
import { CatalogApi } from '@backstage/catalog-client';
|
|
10
|
+
import { Config } from '@backstage/config';
|
|
11
11
|
import { IncomingHttpHeaders } from 'http';
|
|
12
12
|
import { TokenSet, UserinfoResponse } from 'openid-client';
|
|
13
|
-
import * as
|
|
13
|
+
import * as _backstage_plugin_auth_backend_module_gcp_iap_provider from '@backstage/plugin-auth-backend-module-gcp-iap-provider';
|
|
14
|
+
import { GcpIapTokenInfo as GcpIapTokenInfo$1, GcpIapResult as GcpIapResult$1 } from '@backstage/plugin-auth-backend-module-gcp-iap-provider';
|
|
15
|
+
import { UserEntity, Entity } from '@backstage/catalog-model';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
|
-
*
|
|
18
|
+
* Auth plugin
|
|
17
19
|
*
|
|
18
20
|
* @public
|
|
19
21
|
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* The claims that will be embedded within the token. At a minimum, this should include
|
|
23
|
-
* the subject claim, `sub`. It is common to also list entity ownership relations in the
|
|
24
|
-
* `ent` list. Additional claims may also be added at the developer's discretion except
|
|
25
|
-
* for the following list, which will be overwritten by the TokenIssuer: `iss`, `aud`,
|
|
26
|
-
* `iat`, and `exp`. The Backstage team also maintains the right add new claims in the future
|
|
27
|
-
* without listing the change as a "breaking change".
|
|
28
|
-
*/
|
|
29
|
-
claims: {
|
|
30
|
-
/** The token subject, i.e. User ID */
|
|
31
|
-
sub: string;
|
|
32
|
-
/** A list of entity references that the user claims ownership through */
|
|
33
|
-
ent?: string[];
|
|
34
|
-
} & Record<string, JsonValue>;
|
|
35
|
-
};
|
|
22
|
+
declare const authPlugin: () => _backstage_backend_plugin_api.BackendFeature;
|
|
36
23
|
|
|
37
24
|
/**
|
|
38
25
|
* Common options for passport.js-based OAuth providers
|
|
39
26
|
*
|
|
40
27
|
* @public
|
|
28
|
+
* @deprecated No longer in use
|
|
41
29
|
*/
|
|
42
30
|
type OAuthProviderOptions = {
|
|
43
31
|
/**
|
|
@@ -53,28 +41,34 @@ type OAuthProviderOptions = {
|
|
|
53
41
|
*/
|
|
54
42
|
callbackUrl: string;
|
|
55
43
|
};
|
|
56
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* @public
|
|
46
|
+
* @deprecated Use `OAuthAuthenticatorResult<PassportProfile>` from `@backstage/plugin-auth-node` instead
|
|
47
|
+
*/
|
|
57
48
|
type OAuthResult = {
|
|
58
49
|
fullProfile: Profile;
|
|
59
50
|
params: {
|
|
60
51
|
id_token?: string;
|
|
61
52
|
scope: string;
|
|
53
|
+
token_type?: string;
|
|
62
54
|
expires_in: number;
|
|
63
55
|
};
|
|
64
56
|
accessToken: string;
|
|
65
57
|
refreshToken?: string;
|
|
66
58
|
};
|
|
67
59
|
/**
|
|
68
|
-
* The expected response from an OAuth flow.
|
|
69
|
-
*
|
|
70
60
|
* @public
|
|
61
|
+
* @deprecated Use `ClientAuthResponse` from `@backstage/plugin-auth-node` instead
|
|
71
62
|
*/
|
|
72
63
|
type OAuthResponse = {
|
|
73
64
|
profile: ProfileInfo;
|
|
74
65
|
providerInfo: OAuthProviderInfo;
|
|
75
66
|
backstageIdentity?: BackstageSignInResult;
|
|
76
67
|
};
|
|
77
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* @public
|
|
70
|
+
* @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
|
|
71
|
+
*/
|
|
78
72
|
type OAuthProviderInfo = {
|
|
79
73
|
/**
|
|
80
74
|
* An access token issued for the signed in user.
|
|
@@ -93,35 +87,37 @@ type OAuthProviderInfo = {
|
|
|
93
87
|
*/
|
|
94
88
|
scope: string;
|
|
95
89
|
};
|
|
96
|
-
/**
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
/** @public */
|
|
90
|
+
/**
|
|
91
|
+
* @public
|
|
92
|
+
* @deprecated import from `@backstage/plugin-auth-node` instead
|
|
93
|
+
*/
|
|
94
|
+
type OAuthState = OAuthState$1;
|
|
95
|
+
/**
|
|
96
|
+
* @public
|
|
97
|
+
* @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
|
|
98
|
+
*/
|
|
106
99
|
type OAuthStartRequest = express.Request<{}> & {
|
|
107
100
|
scope: string;
|
|
108
101
|
state: OAuthState;
|
|
109
102
|
};
|
|
110
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* @public
|
|
105
|
+
* @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
|
|
106
|
+
*/
|
|
111
107
|
type OAuthRefreshRequest = express.Request<{}> & {
|
|
112
108
|
scope: string;
|
|
113
109
|
refreshToken: string;
|
|
114
110
|
};
|
|
115
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* @public
|
|
113
|
+
* @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
|
|
114
|
+
*/
|
|
116
115
|
type OAuthLogoutRequest = express.Request<{}> & {
|
|
117
116
|
refreshToken: string;
|
|
118
117
|
};
|
|
119
118
|
/**
|
|
120
|
-
* Any OAuth provider needs to implement this interface which has provider specific
|
|
121
|
-
* handlers for different methods to perform authentication, get access tokens,
|
|
122
|
-
* refresh tokens and perform sign out.
|
|
123
|
-
*
|
|
124
119
|
* @public
|
|
120
|
+
* @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
|
|
125
121
|
*/
|
|
126
122
|
interface OAuthHandlers {
|
|
127
123
|
/**
|
|
@@ -149,99 +145,24 @@ interface OAuthHandlers {
|
|
|
149
145
|
}
|
|
150
146
|
|
|
151
147
|
/**
|
|
152
|
-
* A query for a single user in the catalog.
|
|
153
|
-
*
|
|
154
|
-
* If `entityRef` is used, the default kind is `'User'`.
|
|
155
|
-
*
|
|
156
|
-
* If `annotations` are used, all annotations must be present and
|
|
157
|
-
* match the provided value exactly. Only entities of kind `'User'` will be considered.
|
|
158
|
-
*
|
|
159
|
-
* If `filter` are used they are passed on as they are to the `CatalogApi`.
|
|
160
|
-
*
|
|
161
|
-
* Regardless of the query method, the query must match exactly one entity
|
|
162
|
-
* in the catalog, or an error will be thrown.
|
|
163
|
-
*
|
|
164
148
|
* @public
|
|
149
|
+
* @deprecated import from `@backstage/plugin-auth-node` instead
|
|
165
150
|
*/
|
|
166
|
-
type AuthResolverCatalogUserQuery =
|
|
167
|
-
entityRef: string | {
|
|
168
|
-
kind?: string;
|
|
169
|
-
namespace?: string;
|
|
170
|
-
name: string;
|
|
171
|
-
};
|
|
172
|
-
} | {
|
|
173
|
-
annotations: Record<string, string>;
|
|
174
|
-
} | {
|
|
175
|
-
filter: Exclude<GetEntitiesRequest['filter'], undefined>;
|
|
176
|
-
};
|
|
151
|
+
type AuthResolverCatalogUserQuery = AuthResolverCatalogUserQuery$1;
|
|
177
152
|
/**
|
|
178
|
-
* The context that is used for auth processing.
|
|
179
|
-
*
|
|
180
153
|
* @public
|
|
154
|
+
* @deprecated import from `@backstage/plugin-auth-node` instead
|
|
181
155
|
*/
|
|
182
|
-
type AuthResolverContext =
|
|
183
|
-
/**
|
|
184
|
-
* Issues a Backstage token using the provided parameters.
|
|
185
|
-
*/
|
|
186
|
-
issueToken(params: TokenParams): Promise<{
|
|
187
|
-
token: string;
|
|
188
|
-
}>;
|
|
189
|
-
/**
|
|
190
|
-
* Finds a single user in the catalog using the provided query.
|
|
191
|
-
*
|
|
192
|
-
* See {@link AuthResolverCatalogUserQuery} for details.
|
|
193
|
-
*/
|
|
194
|
-
findCatalogUser(query: AuthResolverCatalogUserQuery): Promise<{
|
|
195
|
-
entity: Entity;
|
|
196
|
-
}>;
|
|
197
|
-
/**
|
|
198
|
-
* Finds a single user in the catalog using the provided query, and then
|
|
199
|
-
* issues an identity for that user using default ownership resolution.
|
|
200
|
-
*
|
|
201
|
-
* See {@link AuthResolverCatalogUserQuery} for details.
|
|
202
|
-
*/
|
|
203
|
-
signInWithCatalogUser(query: AuthResolverCatalogUserQuery): Promise<BackstageSignInResult>;
|
|
204
|
-
};
|
|
156
|
+
type AuthResolverContext = AuthResolverContext$1;
|
|
205
157
|
/**
|
|
206
|
-
* The callback used to resolve the cookie configuration for auth providers that use cookies.
|
|
207
158
|
* @public
|
|
159
|
+
* @deprecated import from `@backstage/plugin-auth-node` instead
|
|
160
|
+
*/
|
|
161
|
+
type CookieConfigurer = CookieConfigurer$1;
|
|
162
|
+
/**
|
|
163
|
+
* @public
|
|
164
|
+
* @deprecated Use `createOAuthAuthenticator` from `@backstage/plugin-auth-node` instead
|
|
208
165
|
*/
|
|
209
|
-
type CookieConfigurer = (ctx: {
|
|
210
|
-
/** ID of the auth provider that this configuration applies to */
|
|
211
|
-
providerId: string;
|
|
212
|
-
/** The externally reachable base URL of the auth-backend plugin */
|
|
213
|
-
baseUrl: string;
|
|
214
|
-
/** The configured callback URL of the auth provider */
|
|
215
|
-
callbackUrl: string;
|
|
216
|
-
/** The origin URL of the app */
|
|
217
|
-
appOrigin: string;
|
|
218
|
-
}) => {
|
|
219
|
-
domain: string;
|
|
220
|
-
path: string;
|
|
221
|
-
secure: boolean;
|
|
222
|
-
sameSite?: 'none' | 'lax' | 'strict';
|
|
223
|
-
};
|
|
224
|
-
/** @public */
|
|
225
|
-
type AuthProviderConfig = {
|
|
226
|
-
/**
|
|
227
|
-
* The protocol://domain[:port] where the app is hosted. This is used to construct the
|
|
228
|
-
* callbackURL to redirect to once the user signs in to the auth provider.
|
|
229
|
-
*/
|
|
230
|
-
baseUrl: string;
|
|
231
|
-
/**
|
|
232
|
-
* The base URL of the app as provided by app.baseUrl
|
|
233
|
-
*/
|
|
234
|
-
appUrl: string;
|
|
235
|
-
/**
|
|
236
|
-
* A function that is called to check whether an origin is allowed to receive the authentication result.
|
|
237
|
-
*/
|
|
238
|
-
isOriginAllowed: (origin: string) => boolean;
|
|
239
|
-
/**
|
|
240
|
-
* The function used to resolve cookie configuration based on the auth provider options.
|
|
241
|
-
*/
|
|
242
|
-
cookieConfigurer?: CookieConfigurer;
|
|
243
|
-
};
|
|
244
|
-
/** @public */
|
|
245
166
|
type OAuthStartResponse = {
|
|
246
167
|
/**
|
|
247
168
|
* URL to redirect to
|
|
@@ -253,125 +174,46 @@ type OAuthStartResponse = {
|
|
|
253
174
|
status?: number;
|
|
254
175
|
};
|
|
255
176
|
/**
|
|
256
|
-
* Any Auth provider needs to implement this interface which handles the routes in the
|
|
257
|
-
* auth backend. Any auth API requests from the frontend reaches these methods.
|
|
258
|
-
*
|
|
259
|
-
* The routes in the auth backend API are tied to these methods like below
|
|
260
|
-
*
|
|
261
|
-
* `/auth/[provider]/start -> start`
|
|
262
|
-
* `/auth/[provider]/handler/frame -> frameHandler`
|
|
263
|
-
* `/auth/[provider]/refresh -> refresh`
|
|
264
|
-
* `/auth/[provider]/logout -> logout`
|
|
265
|
-
*
|
|
266
177
|
* @public
|
|
178
|
+
* @deprecated import from `@backstage/plugin-auth-node` instead
|
|
267
179
|
*/
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Handles the start route of the API. This initiates a sign in request with an auth provider.
|
|
271
|
-
*
|
|
272
|
-
* Request
|
|
273
|
-
* - scopes for the auth request (Optional)
|
|
274
|
-
* Response
|
|
275
|
-
* - redirect to the auth provider for the user to sign in or consent.
|
|
276
|
-
* - sets a nonce cookie and also pass the nonce as 'state' query parameter in the redirect request
|
|
277
|
-
*/
|
|
278
|
-
start(req: express.Request, res: express.Response): Promise<void>;
|
|
279
|
-
/**
|
|
280
|
-
* Once the user signs in or consents in the OAuth screen, the auth provider redirects to the
|
|
281
|
-
* callbackURL which is handled by this method.
|
|
282
|
-
*
|
|
283
|
-
* Request
|
|
284
|
-
* - to contain a nonce cookie and a 'state' query parameter
|
|
285
|
-
* Response
|
|
286
|
-
* - postMessage to the window with a payload that contains accessToken, expiryInSeconds?, idToken? and scope.
|
|
287
|
-
* - sets a refresh token cookie if the auth provider supports refresh tokens
|
|
288
|
-
*/
|
|
289
|
-
frameHandler(req: express.Request, res: express.Response): Promise<void>;
|
|
290
|
-
/**
|
|
291
|
-
* (Optional) If the auth provider supports refresh tokens then this method handles
|
|
292
|
-
* requests to get a new access token.
|
|
293
|
-
*
|
|
294
|
-
* Request
|
|
295
|
-
* - to contain a refresh token cookie and scope (Optional) query parameter.
|
|
296
|
-
* Response
|
|
297
|
-
* - payload with accessToken, expiryInSeconds?, idToken?, scope and user profile information.
|
|
298
|
-
*/
|
|
299
|
-
refresh?(req: express.Request, res: express.Response): Promise<void>;
|
|
300
|
-
/**
|
|
301
|
-
* (Optional) Handles sign out requests
|
|
302
|
-
*
|
|
303
|
-
* Response
|
|
304
|
-
* - removes the refresh token cookie
|
|
305
|
-
*/
|
|
306
|
-
logout?(req: express.Request, res: express.Response): Promise<void>;
|
|
307
|
-
}
|
|
308
|
-
/** @public */
|
|
309
|
-
type AuthProviderFactory = (options: {
|
|
310
|
-
providerId: string;
|
|
311
|
-
globalConfig: AuthProviderConfig;
|
|
312
|
-
config: Config;
|
|
313
|
-
logger: Logger;
|
|
314
|
-
resolverContext: AuthResolverContext;
|
|
315
|
-
}) => AuthProviderRouteHandlers;
|
|
316
|
-
/** @public */
|
|
317
|
-
type AuthResponse<ProviderInfo> = {
|
|
318
|
-
providerInfo: ProviderInfo;
|
|
319
|
-
profile: ProfileInfo;
|
|
320
|
-
backstageIdentity?: BackstageIdentityResponse;
|
|
321
|
-
};
|
|
180
|
+
type AuthProviderConfig = AuthProviderConfig$1;
|
|
322
181
|
/**
|
|
323
|
-
* Used to display login information to user, i.e. sidebar popup.
|
|
324
|
-
*
|
|
325
|
-
* It is also temporarily used as the profile of the signed-in user's Backstage
|
|
326
|
-
* identity, but we want to replace that with data from identity and/org catalog
|
|
327
|
-
* service
|
|
328
|
-
*
|
|
329
182
|
* @public
|
|
183
|
+
* @deprecated import from `@backstage/plugin-auth-node` instead
|
|
330
184
|
*/
|
|
331
|
-
type
|
|
332
|
-
/**
|
|
333
|
-
* Email ID of the signed in user.
|
|
334
|
-
*/
|
|
335
|
-
email?: string;
|
|
336
|
-
/**
|
|
337
|
-
* Display name that can be presented to the signed in user.
|
|
338
|
-
*/
|
|
339
|
-
displayName?: string;
|
|
340
|
-
/**
|
|
341
|
-
* URL to an image that can be used as the display image or avatar of the
|
|
342
|
-
* signed in user.
|
|
343
|
-
*/
|
|
344
|
-
picture?: string;
|
|
345
|
-
};
|
|
185
|
+
type AuthProviderRouteHandlers = AuthProviderRouteHandlers$1;
|
|
346
186
|
/**
|
|
347
|
-
* Type of sign in information context. Includes the profile information and
|
|
348
|
-
* authentication result which contains auth related information.
|
|
349
|
-
*
|
|
350
187
|
* @public
|
|
188
|
+
* @deprecated import from `@backstage/plugin-auth-node` instead
|
|
351
189
|
*/
|
|
352
|
-
type
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
190
|
+
type AuthProviderFactory = AuthProviderFactory$1;
|
|
191
|
+
/**
|
|
192
|
+
* @public
|
|
193
|
+
* @deprecated import `ClientAuthResponse` from `@backstage/plugin-auth-node` instead
|
|
194
|
+
*/
|
|
195
|
+
type AuthResponse<TProviderInfo> = ClientAuthResponse<TProviderInfo>;
|
|
196
|
+
/**
|
|
197
|
+
* @public
|
|
198
|
+
* @deprecated import from `@backstage/plugin-auth-node` instead
|
|
199
|
+
*/
|
|
200
|
+
type ProfileInfo = ProfileInfo$1;
|
|
201
|
+
/**
|
|
202
|
+
* @public
|
|
203
|
+
* @deprecated import from `@backstage/plugin-auth-node` instead
|
|
204
|
+
*/
|
|
205
|
+
type SignInInfo<TAuthResult> = SignInInfo$1<TAuthResult>;
|
|
363
206
|
/**
|
|
364
|
-
* Describes the function which handles the result of a successful
|
|
365
|
-
* authentication. Must return a valid {@link @backstage/plugin-auth-node#BackstageSignInResult}.
|
|
366
|
-
*
|
|
367
207
|
* @public
|
|
208
|
+
* @deprecated import from `@backstage/plugin-auth-node` instead
|
|
368
209
|
*/
|
|
369
|
-
type SignInResolver<TAuthResult> =
|
|
210
|
+
type SignInResolver<TAuthResult> = SignInResolver$1<TAuthResult>;
|
|
370
211
|
/**
|
|
371
212
|
* The return type of an authentication handler. Must contain valid profile
|
|
372
213
|
* information.
|
|
373
214
|
*
|
|
374
215
|
* @public
|
|
216
|
+
* @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
|
|
375
217
|
*/
|
|
376
218
|
type AuthHandlerResult = {
|
|
377
219
|
profile: ProfileInfo;
|
|
@@ -388,9 +230,13 @@ type AuthHandlerResult = {
|
|
|
388
230
|
* group of users.
|
|
389
231
|
*
|
|
390
232
|
* @public
|
|
233
|
+
* @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
|
|
391
234
|
*/
|
|
392
235
|
type AuthHandler<TAuthResult> = (input: TAuthResult, context: AuthResolverContext) => Promise<AuthHandlerResult>;
|
|
393
|
-
/**
|
|
236
|
+
/**
|
|
237
|
+
* @public
|
|
238
|
+
* @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
|
|
239
|
+
*/
|
|
394
240
|
type StateEncoder = (req: OAuthStartRequest) => Promise<{
|
|
395
241
|
encodedState: string;
|
|
396
242
|
}>;
|
|
@@ -408,20 +254,16 @@ type EasyAuthResult = {
|
|
|
408
254
|
accessToken?: string;
|
|
409
255
|
};
|
|
410
256
|
|
|
411
|
-
/**
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
start(req: express.Request, res: express.Response): Promise<void>;
|
|
417
|
-
frameHandler(req: express.Request, res: express.Response): Promise<void>;
|
|
418
|
-
refresh(req: express.Request, res: express.Response): Promise<void>;
|
|
419
|
-
logout(req: express.Request, res: express.Response): Promise<void>;
|
|
420
|
-
private getRequestFromEnv;
|
|
421
|
-
private getProviderForEnv;
|
|
422
|
-
}
|
|
257
|
+
/**
|
|
258
|
+
* @public
|
|
259
|
+
* @deprecated import from `@backstage/plugin-auth-node` instead
|
|
260
|
+
*/
|
|
261
|
+
declare const OAuthEnvironmentHandler: typeof OAuthEnvironmentHandler$1;
|
|
423
262
|
|
|
424
|
-
/**
|
|
263
|
+
/**
|
|
264
|
+
* @public
|
|
265
|
+
* @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
|
|
266
|
+
*/
|
|
425
267
|
type OAuthAdapterOptions = {
|
|
426
268
|
providerId: string;
|
|
427
269
|
persistScopes?: boolean;
|
|
@@ -431,7 +273,10 @@ type OAuthAdapterOptions = {
|
|
|
431
273
|
isOriginAllowed: (origin: string) => boolean;
|
|
432
274
|
callbackUrl: string;
|
|
433
275
|
};
|
|
434
|
-
/**
|
|
276
|
+
/**
|
|
277
|
+
* @public
|
|
278
|
+
* @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
|
|
279
|
+
*/
|
|
435
280
|
declare class OAuthAdapter implements AuthProviderRouteHandlers {
|
|
436
281
|
private readonly handlers;
|
|
437
282
|
private readonly options;
|
|
@@ -456,11 +301,20 @@ declare class OAuthAdapter implements AuthProviderRouteHandlers {
|
|
|
456
301
|
private getCookieConfig;
|
|
457
302
|
}
|
|
458
303
|
|
|
459
|
-
/**
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
304
|
+
/**
|
|
305
|
+
* @public
|
|
306
|
+
* @deprecated Use `decodeOAuthState` from `@backstage/plugin-auth-node` instead
|
|
307
|
+
*/
|
|
308
|
+
declare const readState: typeof decodeOAuthState;
|
|
309
|
+
/**
|
|
310
|
+
* @public
|
|
311
|
+
* @deprecated Use `encodeOAuthState` from `@backstage/plugin-auth-node` instead
|
|
312
|
+
*/
|
|
313
|
+
declare const encodeState: typeof encodeOAuthState;
|
|
314
|
+
/**
|
|
315
|
+
* @public
|
|
316
|
+
* @deprecated Use inline logic to make sure the session and state nonce matches instead.
|
|
317
|
+
*/
|
|
464
318
|
declare const verifyNonce: (req: express.Request, providerId: string) => void;
|
|
465
319
|
|
|
466
320
|
/** @public */
|
|
@@ -660,33 +514,17 @@ type SamlAuthResult = {
|
|
|
660
514
|
* The data extracted from an IAP token.
|
|
661
515
|
*
|
|
662
516
|
* @public
|
|
517
|
+
* @deprecated import from `@backstage/plugin-auth-backend-module-gcp-iap-provider` instead
|
|
663
518
|
*/
|
|
664
|
-
type GcpIapTokenInfo =
|
|
665
|
-
/**
|
|
666
|
-
* The unique, stable identifier for the user.
|
|
667
|
-
*/
|
|
668
|
-
sub: string;
|
|
669
|
-
/**
|
|
670
|
-
* User email address.
|
|
671
|
-
*/
|
|
672
|
-
email: string;
|
|
673
|
-
/**
|
|
674
|
-
* Other fields.
|
|
675
|
-
*/
|
|
676
|
-
[key: string]: JsonValue;
|
|
677
|
-
};
|
|
519
|
+
type GcpIapTokenInfo = GcpIapTokenInfo$1;
|
|
678
520
|
/**
|
|
679
521
|
* The result of the initial auth challenge. This is the input to the auth
|
|
680
522
|
* callbacks.
|
|
681
523
|
*
|
|
682
524
|
* @public
|
|
525
|
+
* @deprecated import from `@backstage/plugin-auth-backend-module-gcp-iap-provider` instead
|
|
683
526
|
*/
|
|
684
|
-
type GcpIapResult =
|
|
685
|
-
/**
|
|
686
|
-
* The data extracted from the IAP token header.
|
|
687
|
-
*/
|
|
688
|
-
iapToken: GcpIapTokenInfo;
|
|
689
|
-
};
|
|
527
|
+
type GcpIapResult = GcpIapResult$1;
|
|
690
528
|
|
|
691
529
|
/**
|
|
692
530
|
* All built-in auth provider integrations.
|
|
@@ -700,7 +538,7 @@ declare const providers: Readonly<{
|
|
|
700
538
|
signIn?: {
|
|
701
539
|
resolver: SignInResolver<OAuthResult>;
|
|
702
540
|
} | undefined;
|
|
703
|
-
} | undefined) => AuthProviderFactory;
|
|
541
|
+
} | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
704
542
|
resolvers: never;
|
|
705
543
|
}>;
|
|
706
544
|
auth0: Readonly<{
|
|
@@ -709,7 +547,7 @@ declare const providers: Readonly<{
|
|
|
709
547
|
signIn?: {
|
|
710
548
|
resolver: SignInResolver<OAuthResult>;
|
|
711
549
|
} | undefined;
|
|
712
|
-
} | undefined) => AuthProviderFactory;
|
|
550
|
+
} | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
713
551
|
resolvers: never;
|
|
714
552
|
}>;
|
|
715
553
|
awsAlb: Readonly<{
|
|
@@ -718,7 +556,7 @@ declare const providers: Readonly<{
|
|
|
718
556
|
signIn: {
|
|
719
557
|
resolver: SignInResolver<AwsAlbResult>;
|
|
720
558
|
};
|
|
721
|
-
} | undefined) => AuthProviderFactory;
|
|
559
|
+
} | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
722
560
|
resolvers: never;
|
|
723
561
|
}>;
|
|
724
562
|
bitbucket: Readonly<{
|
|
@@ -727,7 +565,7 @@ declare const providers: Readonly<{
|
|
|
727
565
|
signIn?: {
|
|
728
566
|
resolver: SignInResolver<OAuthResult>;
|
|
729
567
|
} | undefined;
|
|
730
|
-
} | undefined) => AuthProviderFactory;
|
|
568
|
+
} | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
731
569
|
resolvers: Readonly<{
|
|
732
570
|
usernameMatchingUserEntityAnnotation(): SignInResolver<OAuthResult>;
|
|
733
571
|
userIdMatchingUserEntityAnnotation(): SignInResolver<OAuthResult>;
|
|
@@ -739,7 +577,7 @@ declare const providers: Readonly<{
|
|
|
739
577
|
signIn?: {
|
|
740
578
|
resolver: SignInResolver<BitbucketServerOAuthResult>;
|
|
741
579
|
} | undefined;
|
|
742
|
-
} | undefined) => AuthProviderFactory;
|
|
580
|
+
} | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
743
581
|
resolvers: Readonly<{
|
|
744
582
|
emailMatchingUserEntityProfileEmail: () => SignInResolver<BitbucketServerOAuthResult>;
|
|
745
583
|
}>;
|
|
@@ -751,30 +589,30 @@ declare const providers: Readonly<{
|
|
|
751
589
|
resolver: SignInResolver<CloudflareAccessResult>;
|
|
752
590
|
};
|
|
753
591
|
cache?: _backstage_backend_plugin_api.CacheService | undefined;
|
|
754
|
-
}) => AuthProviderFactory;
|
|
592
|
+
}) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
755
593
|
resolvers: Readonly<{
|
|
756
594
|
emailMatchingUserEntityProfileEmail: () => SignInResolver<unknown>;
|
|
757
595
|
}>;
|
|
758
596
|
}>;
|
|
759
597
|
gcpIap: Readonly<{
|
|
760
598
|
create: (options: {
|
|
761
|
-
authHandler?: AuthHandler<GcpIapResult> | undefined;
|
|
599
|
+
authHandler?: AuthHandler<_backstage_plugin_auth_backend_module_gcp_iap_provider.GcpIapResult> | undefined;
|
|
762
600
|
signIn: {
|
|
763
|
-
resolver: SignInResolver<GcpIapResult>;
|
|
601
|
+
resolver: SignInResolver<_backstage_plugin_auth_backend_module_gcp_iap_provider.GcpIapResult>;
|
|
764
602
|
};
|
|
765
|
-
}) => AuthProviderFactory;
|
|
603
|
+
}) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
766
604
|
resolvers: never;
|
|
767
605
|
}>;
|
|
768
606
|
github: Readonly<{
|
|
769
607
|
create: (options?: {
|
|
770
608
|
authHandler?: AuthHandler<GithubOAuthResult> | undefined;
|
|
771
609
|
signIn?: {
|
|
772
|
-
resolver: SignInResolver<GithubOAuthResult>;
|
|
610
|
+
resolver: _backstage_plugin_auth_node.SignInResolver<GithubOAuthResult>;
|
|
773
611
|
} | undefined;
|
|
774
612
|
stateEncoder?: StateEncoder | undefined;
|
|
775
|
-
} | undefined) => AuthProviderFactory;
|
|
613
|
+
} | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
776
614
|
resolvers: Readonly<{
|
|
777
|
-
usernameMatchingUserEntityName: () => SignInResolver<GithubOAuthResult>;
|
|
615
|
+
usernameMatchingUserEntityName: () => _backstage_plugin_auth_node.SignInResolver<GithubOAuthResult>;
|
|
778
616
|
}>;
|
|
779
617
|
}>;
|
|
780
618
|
gitlab: Readonly<{
|
|
@@ -783,7 +621,7 @@ declare const providers: Readonly<{
|
|
|
783
621
|
signIn?: {
|
|
784
622
|
resolver: SignInResolver<OAuthResult>;
|
|
785
623
|
} | undefined;
|
|
786
|
-
} | undefined) => AuthProviderFactory;
|
|
624
|
+
} | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
787
625
|
resolvers: never;
|
|
788
626
|
}>;
|
|
789
627
|
google: Readonly<{
|
|
@@ -792,11 +630,11 @@ declare const providers: Readonly<{
|
|
|
792
630
|
signIn?: {
|
|
793
631
|
resolver: SignInResolver<OAuthResult>;
|
|
794
632
|
} | undefined;
|
|
795
|
-
} | undefined) => AuthProviderFactory;
|
|
633
|
+
} | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
796
634
|
resolvers: Readonly<{
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
emailMatchingUserEntityAnnotation()
|
|
635
|
+
emailMatchingUserEntityProfileEmail: () => _backstage_plugin_auth_node.SignInResolver<OAuthResult>;
|
|
636
|
+
emailLocalPartMatchingUserEntityName: () => _backstage_plugin_auth_node.SignInResolver<OAuthResult>;
|
|
637
|
+
emailMatchingUserEntityAnnotation: () => _backstage_plugin_auth_node.SignInResolver<OAuthResult>;
|
|
800
638
|
}>;
|
|
801
639
|
}>;
|
|
802
640
|
microsoft: Readonly<{
|
|
@@ -805,7 +643,7 @@ declare const providers: Readonly<{
|
|
|
805
643
|
signIn?: {
|
|
806
644
|
resolver: SignInResolver<OAuthResult>;
|
|
807
645
|
} | undefined;
|
|
808
|
-
} | undefined) => AuthProviderFactory;
|
|
646
|
+
} | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
809
647
|
resolvers: Readonly<{
|
|
810
648
|
emailLocalPartMatchingUserEntityName: () => SignInResolver<unknown>;
|
|
811
649
|
emailMatchingUserEntityProfileEmail: () => SignInResolver<unknown>;
|
|
@@ -818,7 +656,7 @@ declare const providers: Readonly<{
|
|
|
818
656
|
signIn?: {
|
|
819
657
|
resolver: SignInResolver<OAuthResult>;
|
|
820
658
|
} | undefined;
|
|
821
|
-
} | undefined) => AuthProviderFactory;
|
|
659
|
+
} | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
822
660
|
resolvers: never;
|
|
823
661
|
}>;
|
|
824
662
|
oauth2Proxy: Readonly<{
|
|
@@ -827,7 +665,7 @@ declare const providers: Readonly<{
|
|
|
827
665
|
signIn: {
|
|
828
666
|
resolver: SignInResolver<OAuth2ProxyResult<unknown>>;
|
|
829
667
|
};
|
|
830
|
-
}) => AuthProviderFactory;
|
|
668
|
+
}) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
831
669
|
resolvers: never;
|
|
832
670
|
}>;
|
|
833
671
|
oidc: Readonly<{
|
|
@@ -836,7 +674,7 @@ declare const providers: Readonly<{
|
|
|
836
674
|
signIn?: {
|
|
837
675
|
resolver: SignInResolver<OidcAuthResult>;
|
|
838
676
|
} | undefined;
|
|
839
|
-
} | undefined) => AuthProviderFactory;
|
|
677
|
+
} | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
840
678
|
resolvers: Readonly<{
|
|
841
679
|
emailLocalPartMatchingUserEntityName: () => SignInResolver<unknown>;
|
|
842
680
|
emailMatchingUserEntityProfileEmail: () => SignInResolver<unknown>;
|
|
@@ -848,7 +686,7 @@ declare const providers: Readonly<{
|
|
|
848
686
|
signIn?: {
|
|
849
687
|
resolver: SignInResolver<OAuthResult>;
|
|
850
688
|
} | undefined;
|
|
851
|
-
} | undefined) => AuthProviderFactory;
|
|
689
|
+
} | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
852
690
|
resolvers: Readonly<{
|
|
853
691
|
emailLocalPartMatchingUserEntityName: () => SignInResolver<unknown>;
|
|
854
692
|
emailMatchingUserEntityProfileEmail: () => SignInResolver<unknown>;
|
|
@@ -861,7 +699,7 @@ declare const providers: Readonly<{
|
|
|
861
699
|
signIn?: {
|
|
862
700
|
resolver: SignInResolver<OAuthResult>;
|
|
863
701
|
} | undefined;
|
|
864
|
-
} | undefined) => AuthProviderFactory;
|
|
702
|
+
} | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
865
703
|
resolvers: never;
|
|
866
704
|
}>;
|
|
867
705
|
saml: Readonly<{
|
|
@@ -870,7 +708,7 @@ declare const providers: Readonly<{
|
|
|
870
708
|
signIn?: {
|
|
871
709
|
resolver: SignInResolver<SamlAuthResult>;
|
|
872
710
|
} | undefined;
|
|
873
|
-
} | undefined) => AuthProviderFactory;
|
|
711
|
+
} | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
874
712
|
resolvers: Readonly<{
|
|
875
713
|
nameIdMatchingUserEntityName(): SignInResolver<SamlAuthResult>;
|
|
876
714
|
}>;
|
|
@@ -881,7 +719,7 @@ declare const providers: Readonly<{
|
|
|
881
719
|
signIn: {
|
|
882
720
|
resolver: SignInResolver<EasyAuthResult>;
|
|
883
721
|
};
|
|
884
|
-
} | undefined) => AuthProviderFactory;
|
|
722
|
+
} | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
|
|
885
723
|
resolvers: never;
|
|
886
724
|
}>;
|
|
887
725
|
}>;
|
|
@@ -914,13 +752,10 @@ declare function createAuthProviderIntegration<TCreateOptions extends unknown[],
|
|
|
914
752
|
}>;
|
|
915
753
|
|
|
916
754
|
/**
|
|
917
|
-
* Parses a Backstage-issued token and decorates the
|
|
918
|
-
* {@link @backstage/plugin-auth-node#BackstageIdentityResponse} with identity information sourced from the
|
|
919
|
-
* token.
|
|
920
|
-
*
|
|
921
755
|
* @public
|
|
756
|
+
* @deprecated import from `@backstage/plugin-auth-node` instead
|
|
922
757
|
*/
|
|
923
|
-
declare
|
|
758
|
+
declare const prepareBackstageIdentityResponse: typeof prepareBackstageIdentityResponse$1;
|
|
924
759
|
|
|
925
760
|
/** @public */
|
|
926
761
|
type ProviderFactories = {
|
|
@@ -928,13 +763,14 @@ type ProviderFactories = {
|
|
|
928
763
|
};
|
|
929
764
|
/** @public */
|
|
930
765
|
interface RouterOptions {
|
|
931
|
-
logger:
|
|
766
|
+
logger: LoggerService;
|
|
932
767
|
database: PluginDatabaseManager;
|
|
933
768
|
config: Config;
|
|
934
769
|
discovery: PluginEndpointDiscovery;
|
|
935
770
|
tokenManager: TokenManager;
|
|
936
771
|
tokenFactoryAlgorithm?: string;
|
|
937
772
|
providerFactories?: ProviderFactories;
|
|
773
|
+
disableDefaultProviderFactories?: boolean;
|
|
938
774
|
catalogApi?: CatalogApi;
|
|
939
775
|
}
|
|
940
776
|
/** @public */
|
|
@@ -943,22 +779,26 @@ declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
|
|
943
779
|
declare function createOriginFilter(config: Config): (origin: string) => boolean;
|
|
944
780
|
|
|
945
781
|
/**
|
|
946
|
-
* Payload sent as a post message after the auth request is complete.
|
|
947
|
-
* If successful then has a valid payload with Auth information else contains an error.
|
|
948
|
-
*
|
|
949
782
|
* @public
|
|
783
|
+
* @deprecated import from `@backstage/plugin-auth-node` instead
|
|
950
784
|
*/
|
|
951
|
-
type
|
|
952
|
-
type: 'authorization_response';
|
|
953
|
-
response: AuthResponse<unknown>;
|
|
954
|
-
} | {
|
|
955
|
-
type: 'authorization_response';
|
|
956
|
-
error: Error;
|
|
957
|
-
};
|
|
785
|
+
type TokenParams = TokenParams$1;
|
|
958
786
|
|
|
959
|
-
/**
|
|
787
|
+
/**
|
|
788
|
+
* @public
|
|
789
|
+
* @deprecated import from `@backstage/plugin-auth-node` instead
|
|
790
|
+
*/
|
|
791
|
+
type WebMessageResponse = WebMessageResponse$1;
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* @public
|
|
795
|
+
* @deprecated Use `sendWebMessageResponse` from `@backstage/plugin-auth-node` instead
|
|
796
|
+
*/
|
|
960
797
|
declare const postMessageResponse: (res: express.Response, appOrigin: string, response: WebMessageResponse) => void;
|
|
961
|
-
/**
|
|
798
|
+
/**
|
|
799
|
+
* @public
|
|
800
|
+
* @deprecated Use inline logic to check that the `X-Requested-With` header is set to `'XMLHttpRequest'` instead.
|
|
801
|
+
*/
|
|
962
802
|
declare const ensuresXRequestedWith: (req: express.Request) => boolean;
|
|
963
803
|
|
|
964
804
|
/**
|
|
@@ -990,7 +830,7 @@ declare class CatalogIdentityClient {
|
|
|
990
830
|
*/
|
|
991
831
|
resolveCatalogMembership(query: {
|
|
992
832
|
entityRefs: string[];
|
|
993
|
-
logger?:
|
|
833
|
+
logger?: LoggerService;
|
|
994
834
|
}): Promise<string[]>;
|
|
995
835
|
}
|
|
996
836
|
|
|
@@ -1004,4 +844,4 @@ declare class CatalogIdentityClient {
|
|
|
1004
844
|
*/
|
|
1005
845
|
declare function getDefaultOwnershipEntityRefs(entity: Entity): string[];
|
|
1006
846
|
|
|
1007
|
-
export { AuthHandler, AuthHandlerResult, AuthProviderConfig, AuthProviderFactory, AuthProviderRouteHandlers, AuthResolverCatalogUserQuery, AuthResolverContext, AuthResponse, AwsAlbResult, BitbucketOAuthResult, BitbucketPassportProfile, BitbucketServerOAuthResult, CatalogIdentityClient, CloudflareAccessClaims, CloudflareAccessGroup, CloudflareAccessIdentityProfile, CloudflareAccessResult, CookieConfigurer, EasyAuthResult, GcpIapResult, GcpIapTokenInfo, GithubOAuthResult, OAuth2ProxyResult, OAuthAdapter, OAuthAdapterOptions, OAuthEnvironmentHandler, OAuthHandlers, OAuthLogoutRequest, OAuthProviderInfo, OAuthProviderOptions, OAuthRefreshRequest, OAuthResponse, OAuthResult, OAuthStartRequest, OAuthStartResponse, OAuthState, OidcAuthResult, ProfileInfo, ProviderFactories, RouterOptions, SamlAuthResult, SignInInfo, SignInResolver, StateEncoder, TokenParams, WebMessageResponse, createAuthProviderIntegration, createOriginFilter, createRouter, defaultAuthProviderFactories, encodeState, ensuresXRequestedWith, getDefaultOwnershipEntityRefs, postMessageResponse, prepareBackstageIdentityResponse, providers, readState, verifyNonce };
|
|
847
|
+
export { AuthHandler, AuthHandlerResult, AuthProviderConfig, AuthProviderFactory, AuthProviderRouteHandlers, AuthResolverCatalogUserQuery, AuthResolverContext, AuthResponse, AwsAlbResult, BitbucketOAuthResult, BitbucketPassportProfile, BitbucketServerOAuthResult, CatalogIdentityClient, CloudflareAccessClaims, CloudflareAccessGroup, CloudflareAccessIdentityProfile, CloudflareAccessResult, CookieConfigurer, EasyAuthResult, GcpIapResult, GcpIapTokenInfo, GithubOAuthResult, OAuth2ProxyResult, OAuthAdapter, OAuthAdapterOptions, OAuthEnvironmentHandler, OAuthHandlers, OAuthLogoutRequest, OAuthProviderInfo, OAuthProviderOptions, OAuthRefreshRequest, OAuthResponse, OAuthResult, OAuthStartRequest, OAuthStartResponse, OAuthState, OidcAuthResult, ProfileInfo, ProviderFactories, RouterOptions, SamlAuthResult, SignInInfo, SignInResolver, StateEncoder, TokenParams, WebMessageResponse, authPlugin, createAuthProviderIntegration, createOriginFilter, createRouter, defaultAuthProviderFactories, encodeState, ensuresXRequestedWith, getDefaultOwnershipEntityRefs, postMessageResponse, prepareBackstageIdentityResponse, providers, readState, verifyNonce };
|