@backstage/plugin-auth-backend 0.18.8-next.0 → 0.18.8

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/dist/index.d.ts CHANGED
@@ -1,31 +1,43 @@
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';
4
2
  import express from 'express';
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';
3
+ import { Logger } from 'winston';
4
+ import { GetEntitiesRequest, CatalogApi } from '@backstage/catalog-client';
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';
7
9
  import { Profile } from 'passport';
8
10
  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 _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';
13
+ import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
16
14
 
17
15
  /**
18
- * Auth plugin
16
+ * Parameters used to issue new ID Tokens
19
17
  *
20
18
  * @public
21
19
  */
22
- declare const authPlugin: () => _backstage_backend_plugin_api.BackendFeature;
20
+ type TokenParams = {
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
+ };
23
36
 
24
37
  /**
25
38
  * Common options for passport.js-based OAuth providers
26
39
  *
27
40
  * @public
28
- * @deprecated No longer in use
29
41
  */
30
42
  type OAuthProviderOptions = {
31
43
  /**
@@ -41,34 +53,28 @@ type OAuthProviderOptions = {
41
53
  */
42
54
  callbackUrl: string;
43
55
  };
44
- /**
45
- * @public
46
- * @deprecated Use `OAuthAuthenticatorResult<PassportProfile>` from `@backstage/plugin-auth-node` instead
47
- */
56
+ /** @public */
48
57
  type OAuthResult = {
49
58
  fullProfile: Profile;
50
59
  params: {
51
60
  id_token?: string;
52
61
  scope: string;
53
- token_type?: string;
54
62
  expires_in: number;
55
63
  };
56
64
  accessToken: string;
57
65
  refreshToken?: string;
58
66
  };
59
67
  /**
68
+ * The expected response from an OAuth flow.
69
+ *
60
70
  * @public
61
- * @deprecated Use `ClientAuthResponse` from `@backstage/plugin-auth-node` instead
62
71
  */
63
72
  type OAuthResponse = {
64
73
  profile: ProfileInfo;
65
74
  providerInfo: OAuthProviderInfo;
66
75
  backstageIdentity?: BackstageSignInResult;
67
76
  };
68
- /**
69
- * @public
70
- * @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
71
- */
77
+ /** @public */
72
78
  type OAuthProviderInfo = {
73
79
  /**
74
80
  * An access token issued for the signed in user.
@@ -87,37 +93,35 @@ type OAuthProviderInfo = {
87
93
  */
88
94
  scope: string;
89
95
  };
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
- */
96
+ /** @public */
97
+ type OAuthState = {
98
+ nonce: string;
99
+ env: string;
100
+ origin?: string;
101
+ scope?: string;
102
+ redirectUrl?: string;
103
+ flow?: string;
104
+ };
105
+ /** @public */
99
106
  type OAuthStartRequest = express.Request<{}> & {
100
107
  scope: string;
101
108
  state: OAuthState;
102
109
  };
103
- /**
104
- * @public
105
- * @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
106
- */
110
+ /** @public */
107
111
  type OAuthRefreshRequest = express.Request<{}> & {
108
112
  scope: string;
109
113
  refreshToken: string;
110
114
  };
111
- /**
112
- * @public
113
- * @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
114
- */
115
+ /** @public */
115
116
  type OAuthLogoutRequest = express.Request<{}> & {
116
117
  refreshToken: string;
117
118
  };
118
119
  /**
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
+ *
119
124
  * @public
120
- * @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
121
125
  */
122
126
  interface OAuthHandlers {
123
127
  /**
@@ -145,24 +149,99 @@ interface OAuthHandlers {
145
149
  }
146
150
 
147
151
  /**
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
+ *
148
164
  * @public
149
- * @deprecated import from `@backstage/plugin-auth-node` instead
150
- */
151
- type AuthResolverCatalogUserQuery = AuthResolverCatalogUserQuery$1;
152
- /**
153
- * @public
154
- * @deprecated import from `@backstage/plugin-auth-node` instead
155
165
  */
156
- type AuthResolverContext = AuthResolverContext$1;
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
+ };
157
177
  /**
178
+ * The context that is used for auth processing.
179
+ *
158
180
  * @public
159
- * @deprecated import from `@backstage/plugin-auth-node` instead
160
181
  */
161
- type CookieConfigurer = CookieConfigurer$1;
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
+ };
162
205
  /**
206
+ * The callback used to resolve the cookie configuration for auth providers that use cookies.
163
207
  * @public
164
- * @deprecated Use `createOAuthAuthenticator` from `@backstage/plugin-auth-node` instead
165
208
  */
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 */
166
245
  type OAuthStartResponse = {
167
246
  /**
168
247
  * URL to redirect to
@@ -174,46 +253,125 @@ type OAuthStartResponse = {
174
253
  status?: number;
175
254
  };
176
255
  /**
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
+ *
177
266
  * @public
178
- * @deprecated import from `@backstage/plugin-auth-node` instead
179
- */
180
- type AuthProviderConfig = AuthProviderConfig$1;
181
- /**
182
- * @public
183
- * @deprecated import from `@backstage/plugin-auth-node` instead
184
- */
185
- type AuthProviderRouteHandlers = AuthProviderRouteHandlers$1;
186
- /**
187
- * @public
188
- * @deprecated import from `@backstage/plugin-auth-node` instead
189
- */
190
- type AuthProviderFactory = AuthProviderFactory$1;
191
- /**
192
- * @public
193
- * @deprecated import `ClientAuthResponse` from `@backstage/plugin-auth-node` instead
194
267
  */
195
- type AuthResponse<TProviderInfo> = ClientAuthResponse<TProviderInfo>;
268
+ interface AuthProviderRouteHandlers {
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
+ };
196
322
  /**
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
+ *
197
329
  * @public
198
- * @deprecated import from `@backstage/plugin-auth-node` instead
199
330
  */
200
- type ProfileInfo = ProfileInfo$1;
331
+ type ProfileInfo = {
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
+ };
201
346
  /**
347
+ * Type of sign in information context. Includes the profile information and
348
+ * authentication result which contains auth related information.
349
+ *
202
350
  * @public
203
- * @deprecated import from `@backstage/plugin-auth-node` instead
204
351
  */
205
- type SignInInfo<TAuthResult> = SignInInfo$1<TAuthResult>;
352
+ type SignInInfo<TAuthResult> = {
353
+ /**
354
+ * The simple profile passed down for use in the frontend.
355
+ */
356
+ profile: ProfileInfo;
357
+ /**
358
+ * The authentication result that was received from the authentication
359
+ * provider.
360
+ */
361
+ result: TAuthResult;
362
+ };
206
363
  /**
364
+ * Describes the function which handles the result of a successful
365
+ * authentication. Must return a valid {@link @backstage/plugin-auth-node#BackstageSignInResult}.
366
+ *
207
367
  * @public
208
- * @deprecated import from `@backstage/plugin-auth-node` instead
209
368
  */
210
- type SignInResolver<TAuthResult> = SignInResolver$1<TAuthResult>;
369
+ type SignInResolver<TAuthResult> = (info: SignInInfo<TAuthResult>, context: AuthResolverContext) => Promise<BackstageSignInResult>;
211
370
  /**
212
371
  * The return type of an authentication handler. Must contain valid profile
213
372
  * information.
214
373
  *
215
374
  * @public
216
- * @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
217
375
  */
218
376
  type AuthHandlerResult = {
219
377
  profile: ProfileInfo;
@@ -230,13 +388,9 @@ type AuthHandlerResult = {
230
388
  * group of users.
231
389
  *
232
390
  * @public
233
- * @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
234
391
  */
235
392
  type AuthHandler<TAuthResult> = (input: TAuthResult, context: AuthResolverContext) => Promise<AuthHandlerResult>;
236
- /**
237
- * @public
238
- * @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
239
- */
393
+ /** @public */
240
394
  type StateEncoder = (req: OAuthStartRequest) => Promise<{
241
395
  encodedState: string;
242
396
  }>;
@@ -254,16 +408,20 @@ type EasyAuthResult = {
254
408
  accessToken?: string;
255
409
  };
256
410
 
257
- /**
258
- * @public
259
- * @deprecated import from `@backstage/plugin-auth-node` instead
260
- */
261
- declare const OAuthEnvironmentHandler: typeof OAuthEnvironmentHandler$1;
411
+ /** @public */
412
+ declare class OAuthEnvironmentHandler implements AuthProviderRouteHandlers {
413
+ private readonly handlers;
414
+ static mapConfig(config: Config, factoryFunc: (envConfig: Config) => AuthProviderRouteHandlers): OAuthEnvironmentHandler;
415
+ constructor(handlers: Map<string, AuthProviderRouteHandlers>);
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
+ }
262
423
 
263
- /**
264
- * @public
265
- * @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
266
- */
424
+ /** @public */
267
425
  type OAuthAdapterOptions = {
268
426
  providerId: string;
269
427
  persistScopes?: boolean;
@@ -273,10 +431,7 @@ type OAuthAdapterOptions = {
273
431
  isOriginAllowed: (origin: string) => boolean;
274
432
  callbackUrl: string;
275
433
  };
276
- /**
277
- * @public
278
- * @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
279
- */
434
+ /** @public */
280
435
  declare class OAuthAdapter implements AuthProviderRouteHandlers {
281
436
  private readonly handlers;
282
437
  private readonly options;
@@ -301,20 +456,11 @@ declare class OAuthAdapter implements AuthProviderRouteHandlers {
301
456
  private getCookieConfig;
302
457
  }
303
458
 
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
- */
459
+ /** @public */
460
+ declare const readState: (stateString: string) => OAuthState;
461
+ /** @public */
462
+ declare const encodeState: (state: OAuthState) => string;
463
+ /** @public */
318
464
  declare const verifyNonce: (req: express.Request, providerId: string) => void;
319
465
 
320
466
  /** @public */
@@ -514,17 +660,33 @@ type SamlAuthResult = {
514
660
  * The data extracted from an IAP token.
515
661
  *
516
662
  * @public
517
- * @deprecated import from `@backstage/plugin-auth-backend-module-gcp-iap-provider` instead
518
663
  */
519
- type GcpIapTokenInfo = GcpIapTokenInfo$1;
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
+ };
520
678
  /**
521
679
  * The result of the initial auth challenge. This is the input to the auth
522
680
  * callbacks.
523
681
  *
524
682
  * @public
525
- * @deprecated import from `@backstage/plugin-auth-backend-module-gcp-iap-provider` instead
526
683
  */
527
- type GcpIapResult = GcpIapResult$1;
684
+ type GcpIapResult = {
685
+ /**
686
+ * The data extracted from the IAP token header.
687
+ */
688
+ iapToken: GcpIapTokenInfo;
689
+ };
528
690
 
529
691
  /**
530
692
  * All built-in auth provider integrations.
@@ -538,7 +700,7 @@ declare const providers: Readonly<{
538
700
  signIn?: {
539
701
  resolver: SignInResolver<OAuthResult>;
540
702
  } | undefined;
541
- } | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
703
+ } | undefined) => AuthProviderFactory;
542
704
  resolvers: never;
543
705
  }>;
544
706
  auth0: Readonly<{
@@ -547,7 +709,7 @@ declare const providers: Readonly<{
547
709
  signIn?: {
548
710
  resolver: SignInResolver<OAuthResult>;
549
711
  } | undefined;
550
- } | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
712
+ } | undefined) => AuthProviderFactory;
551
713
  resolvers: never;
552
714
  }>;
553
715
  awsAlb: Readonly<{
@@ -556,7 +718,7 @@ declare const providers: Readonly<{
556
718
  signIn: {
557
719
  resolver: SignInResolver<AwsAlbResult>;
558
720
  };
559
- } | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
721
+ } | undefined) => AuthProviderFactory;
560
722
  resolvers: never;
561
723
  }>;
562
724
  bitbucket: Readonly<{
@@ -565,7 +727,7 @@ declare const providers: Readonly<{
565
727
  signIn?: {
566
728
  resolver: SignInResolver<OAuthResult>;
567
729
  } | undefined;
568
- } | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
730
+ } | undefined) => AuthProviderFactory;
569
731
  resolvers: Readonly<{
570
732
  usernameMatchingUserEntityAnnotation(): SignInResolver<OAuthResult>;
571
733
  userIdMatchingUserEntityAnnotation(): SignInResolver<OAuthResult>;
@@ -577,7 +739,7 @@ declare const providers: Readonly<{
577
739
  signIn?: {
578
740
  resolver: SignInResolver<BitbucketServerOAuthResult>;
579
741
  } | undefined;
580
- } | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
742
+ } | undefined) => AuthProviderFactory;
581
743
  resolvers: Readonly<{
582
744
  emailMatchingUserEntityProfileEmail: () => SignInResolver<BitbucketServerOAuthResult>;
583
745
  }>;
@@ -589,30 +751,30 @@ declare const providers: Readonly<{
589
751
  resolver: SignInResolver<CloudflareAccessResult>;
590
752
  };
591
753
  cache?: _backstage_backend_plugin_api.CacheService | undefined;
592
- }) => _backstage_plugin_auth_node.AuthProviderFactory;
754
+ }) => AuthProviderFactory;
593
755
  resolvers: Readonly<{
594
756
  emailMatchingUserEntityProfileEmail: () => SignInResolver<unknown>;
595
757
  }>;
596
758
  }>;
597
759
  gcpIap: Readonly<{
598
760
  create: (options: {
599
- authHandler?: AuthHandler<_backstage_plugin_auth_backend_module_gcp_iap_provider.GcpIapResult> | undefined;
761
+ authHandler?: AuthHandler<GcpIapResult> | undefined;
600
762
  signIn: {
601
- resolver: SignInResolver<_backstage_plugin_auth_backend_module_gcp_iap_provider.GcpIapResult>;
763
+ resolver: SignInResolver<GcpIapResult>;
602
764
  };
603
- }) => _backstage_plugin_auth_node.AuthProviderFactory;
765
+ }) => AuthProviderFactory;
604
766
  resolvers: never;
605
767
  }>;
606
768
  github: Readonly<{
607
769
  create: (options?: {
608
770
  authHandler?: AuthHandler<GithubOAuthResult> | undefined;
609
771
  signIn?: {
610
- resolver: _backstage_plugin_auth_node.SignInResolver<GithubOAuthResult>;
772
+ resolver: SignInResolver<GithubOAuthResult>;
611
773
  } | undefined;
612
774
  stateEncoder?: StateEncoder | undefined;
613
- } | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
775
+ } | undefined) => AuthProviderFactory;
614
776
  resolvers: Readonly<{
615
- usernameMatchingUserEntityName: () => _backstage_plugin_auth_node.SignInResolver<GithubOAuthResult>;
777
+ usernameMatchingUserEntityName: () => SignInResolver<GithubOAuthResult>;
616
778
  }>;
617
779
  }>;
618
780
  gitlab: Readonly<{
@@ -621,7 +783,7 @@ declare const providers: Readonly<{
621
783
  signIn?: {
622
784
  resolver: SignInResolver<OAuthResult>;
623
785
  } | undefined;
624
- } | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
786
+ } | undefined) => AuthProviderFactory;
625
787
  resolvers: never;
626
788
  }>;
627
789
  google: Readonly<{
@@ -630,11 +792,11 @@ declare const providers: Readonly<{
630
792
  signIn?: {
631
793
  resolver: SignInResolver<OAuthResult>;
632
794
  } | undefined;
633
- } | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
795
+ } | undefined) => AuthProviderFactory;
634
796
  resolvers: Readonly<{
635
- emailMatchingUserEntityProfileEmail: () => _backstage_plugin_auth_node.SignInResolver<OAuthResult>;
636
- emailLocalPartMatchingUserEntityName: () => _backstage_plugin_auth_node.SignInResolver<OAuthResult>;
637
- emailMatchingUserEntityAnnotation: () => _backstage_plugin_auth_node.SignInResolver<OAuthResult>;
797
+ emailLocalPartMatchingUserEntityName: () => SignInResolver<unknown>;
798
+ emailMatchingUserEntityProfileEmail: () => SignInResolver<unknown>;
799
+ emailMatchingUserEntityAnnotation(): SignInResolver<OAuthResult>;
638
800
  }>;
639
801
  }>;
640
802
  microsoft: Readonly<{
@@ -643,7 +805,7 @@ declare const providers: Readonly<{
643
805
  signIn?: {
644
806
  resolver: SignInResolver<OAuthResult>;
645
807
  } | undefined;
646
- } | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
808
+ } | undefined) => AuthProviderFactory;
647
809
  resolvers: Readonly<{
648
810
  emailLocalPartMatchingUserEntityName: () => SignInResolver<unknown>;
649
811
  emailMatchingUserEntityProfileEmail: () => SignInResolver<unknown>;
@@ -656,7 +818,7 @@ declare const providers: Readonly<{
656
818
  signIn?: {
657
819
  resolver: SignInResolver<OAuthResult>;
658
820
  } | undefined;
659
- } | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
821
+ } | undefined) => AuthProviderFactory;
660
822
  resolvers: never;
661
823
  }>;
662
824
  oauth2Proxy: Readonly<{
@@ -665,7 +827,7 @@ declare const providers: Readonly<{
665
827
  signIn: {
666
828
  resolver: SignInResolver<OAuth2ProxyResult<unknown>>;
667
829
  };
668
- }) => _backstage_plugin_auth_node.AuthProviderFactory;
830
+ }) => AuthProviderFactory;
669
831
  resolvers: never;
670
832
  }>;
671
833
  oidc: Readonly<{
@@ -674,7 +836,7 @@ declare const providers: Readonly<{
674
836
  signIn?: {
675
837
  resolver: SignInResolver<OidcAuthResult>;
676
838
  } | undefined;
677
- } | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
839
+ } | undefined) => AuthProviderFactory;
678
840
  resolvers: Readonly<{
679
841
  emailLocalPartMatchingUserEntityName: () => SignInResolver<unknown>;
680
842
  emailMatchingUserEntityProfileEmail: () => SignInResolver<unknown>;
@@ -686,7 +848,7 @@ declare const providers: Readonly<{
686
848
  signIn?: {
687
849
  resolver: SignInResolver<OAuthResult>;
688
850
  } | undefined;
689
- } | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
851
+ } | undefined) => AuthProviderFactory;
690
852
  resolvers: Readonly<{
691
853
  emailLocalPartMatchingUserEntityName: () => SignInResolver<unknown>;
692
854
  emailMatchingUserEntityProfileEmail: () => SignInResolver<unknown>;
@@ -699,7 +861,7 @@ declare const providers: Readonly<{
699
861
  signIn?: {
700
862
  resolver: SignInResolver<OAuthResult>;
701
863
  } | undefined;
702
- } | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
864
+ } | undefined) => AuthProviderFactory;
703
865
  resolvers: never;
704
866
  }>;
705
867
  saml: Readonly<{
@@ -708,7 +870,7 @@ declare const providers: Readonly<{
708
870
  signIn?: {
709
871
  resolver: SignInResolver<SamlAuthResult>;
710
872
  } | undefined;
711
- } | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
873
+ } | undefined) => AuthProviderFactory;
712
874
  resolvers: Readonly<{
713
875
  nameIdMatchingUserEntityName(): SignInResolver<SamlAuthResult>;
714
876
  }>;
@@ -719,7 +881,7 @@ declare const providers: Readonly<{
719
881
  signIn: {
720
882
  resolver: SignInResolver<EasyAuthResult>;
721
883
  };
722
- } | undefined) => _backstage_plugin_auth_node.AuthProviderFactory;
884
+ } | undefined) => AuthProviderFactory;
723
885
  resolvers: never;
724
886
  }>;
725
887
  }>;
@@ -752,10 +914,13 @@ declare function createAuthProviderIntegration<TCreateOptions extends unknown[],
752
914
  }>;
753
915
 
754
916
  /**
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
+ *
755
921
  * @public
756
- * @deprecated import from `@backstage/plugin-auth-node` instead
757
922
  */
758
- declare const prepareBackstageIdentityResponse: typeof prepareBackstageIdentityResponse$1;
923
+ declare function prepareBackstageIdentityResponse(result: BackstageSignInResult): BackstageIdentityResponse;
759
924
 
760
925
  /** @public */
761
926
  type ProviderFactories = {
@@ -763,14 +928,13 @@ type ProviderFactories = {
763
928
  };
764
929
  /** @public */
765
930
  interface RouterOptions {
766
- logger: LoggerService;
931
+ logger: Logger;
767
932
  database: PluginDatabaseManager;
768
933
  config: Config;
769
934
  discovery: PluginEndpointDiscovery;
770
935
  tokenManager: TokenManager;
771
936
  tokenFactoryAlgorithm?: string;
772
937
  providerFactories?: ProviderFactories;
773
- disableDefaultProviderFactories?: boolean;
774
938
  catalogApi?: CatalogApi;
775
939
  }
776
940
  /** @public */
@@ -779,26 +943,22 @@ declare function createRouter(options: RouterOptions): Promise<express.Router>;
779
943
  declare function createOriginFilter(config: Config): (origin: string) => boolean;
780
944
 
781
945
  /**
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
+ *
782
949
  * @public
783
- * @deprecated import from `@backstage/plugin-auth-node` instead
784
- */
785
- type TokenParams = TokenParams$1;
786
-
787
- /**
788
- * @public
789
- * @deprecated import from `@backstage/plugin-auth-node` instead
790
950
  */
791
- type WebMessageResponse = WebMessageResponse$1;
951
+ type WebMessageResponse = {
952
+ type: 'authorization_response';
953
+ response: AuthResponse<unknown>;
954
+ } | {
955
+ type: 'authorization_response';
956
+ error: Error;
957
+ };
792
958
 
793
- /**
794
- * @public
795
- * @deprecated Use `sendWebMessageResponse` from `@backstage/plugin-auth-node` instead
796
- */
959
+ /** @public */
797
960
  declare const postMessageResponse: (res: express.Response, appOrigin: string, response: WebMessageResponse) => void;
798
- /**
799
- * @public
800
- * @deprecated Use inline logic to check that the `X-Requested-With` header is set to `'XMLHttpRequest'` instead.
801
- */
961
+ /** @public */
802
962
  declare const ensuresXRequestedWith: (req: express.Request) => boolean;
803
963
 
804
964
  /**
@@ -830,7 +990,7 @@ declare class CatalogIdentityClient {
830
990
  */
831
991
  resolveCatalogMembership(query: {
832
992
  entityRefs: string[];
833
- logger?: LoggerService;
993
+ logger?: Logger;
834
994
  }): Promise<string[]>;
835
995
  }
836
996
 
@@ -844,4 +1004,4 @@ declare class CatalogIdentityClient {
844
1004
  */
845
1005
  declare function getDefaultOwnershipEntityRefs(entity: Entity): string[];
846
1006
 
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 };
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 };