@backstage/plugin-auth-backend 0.5.2 → 0.7.0-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 +82 -0
- package/dist/index.cjs.js +1671 -1418
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +291 -137
- package/package.json +13 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import express from 'express';
|
|
3
3
|
import { Logger } from 'winston';
|
|
4
|
+
import { Config } from '@backstage/config';
|
|
4
5
|
import { PluginEndpointDiscovery, PluginDatabaseManager } from '@backstage/backend-common';
|
|
5
6
|
import { CatalogApi } from '@backstage/catalog-client';
|
|
6
7
|
import { UserEntity, Entity } from '@backstage/catalog-model';
|
|
7
|
-
import { Config } from '@backstage/config';
|
|
8
8
|
import { Profile } from 'passport';
|
|
9
9
|
import { JSONWebKey } from 'jose';
|
|
10
10
|
import { TokenSet, UserinfoResponse } from 'openid-client';
|
|
11
|
+
import { JsonValue } from '@backstage/types';
|
|
11
12
|
|
|
12
13
|
/** Represents any form of serializable JWK */
|
|
13
14
|
interface AnyJWK extends Record<string, string> {
|
|
@@ -97,10 +98,6 @@ declare type OAuthProviderInfo = {
|
|
|
97
98
|
* Scopes granted for the access token.
|
|
98
99
|
*/
|
|
99
100
|
scope: string;
|
|
100
|
-
/**
|
|
101
|
-
* A refresh token issued for the signed in user
|
|
102
|
-
*/
|
|
103
|
-
refreshToken?: string;
|
|
104
101
|
};
|
|
105
102
|
declare type OAuthState = {
|
|
106
103
|
nonce: string;
|
|
@@ -119,17 +116,16 @@ declare type OAuthRefreshRequest = express.Request<{}> & {
|
|
|
119
116
|
* Any OAuth provider needs to implement this interface which has provider specific
|
|
120
117
|
* handlers for different methods to perform authentication, get access tokens,
|
|
121
118
|
* refresh tokens and perform sign out.
|
|
119
|
+
*
|
|
120
|
+
* @public
|
|
122
121
|
*/
|
|
123
122
|
interface OAuthHandlers {
|
|
124
123
|
/**
|
|
125
|
-
*
|
|
126
|
-
* @param {express.Request} req
|
|
127
|
-
* @param options
|
|
124
|
+
* Initiate a sign in request with an auth provider.
|
|
128
125
|
*/
|
|
129
126
|
start(req: OAuthStartRequest): Promise<RedirectInfo>;
|
|
130
127
|
/**
|
|
131
|
-
*
|
|
132
|
-
* @param {express.Request} req
|
|
128
|
+
* Handle the redirect from the auth provider when the user has signed in.
|
|
133
129
|
*/
|
|
134
130
|
handler(req: express.Request): Promise<{
|
|
135
131
|
response: OAuthResponse;
|
|
@@ -137,10 +133,11 @@ interface OAuthHandlers {
|
|
|
137
133
|
}>;
|
|
138
134
|
/**
|
|
139
135
|
* (Optional) Given a refresh token and scope fetches a new access token from the auth provider.
|
|
140
|
-
* @param {string} refreshToken
|
|
141
|
-
* @param {string} scope
|
|
142
136
|
*/
|
|
143
|
-
refresh?(req: OAuthRefreshRequest): Promise<
|
|
137
|
+
refresh?(req: OAuthRefreshRequest): Promise<{
|
|
138
|
+
response: OAuthResponse;
|
|
139
|
+
refreshToken?: string;
|
|
140
|
+
}>;
|
|
144
141
|
/**
|
|
145
142
|
* (Optional) Sign out of the auth provider.
|
|
146
143
|
*/
|
|
@@ -225,6 +222,16 @@ declare class CatalogIdentityClient {
|
|
|
225
222
|
|
|
226
223
|
declare function getEntityClaims(entity: UserEntity): TokenParams['claims'];
|
|
227
224
|
|
|
225
|
+
/**
|
|
226
|
+
* The context that is used for auth processing.
|
|
227
|
+
*
|
|
228
|
+
* @public
|
|
229
|
+
*/
|
|
230
|
+
declare type AuthResolverContext = {
|
|
231
|
+
tokenIssuer: TokenIssuer;
|
|
232
|
+
catalogIdentityClient: CatalogIdentityClient;
|
|
233
|
+
logger: Logger;
|
|
234
|
+
};
|
|
228
235
|
declare type AuthProviderConfig = {
|
|
229
236
|
/**
|
|
230
237
|
* The protocol://domain[:port] where the app is hosted. This is used to construct the
|
|
@@ -256,10 +263,10 @@ declare type RedirectInfo = {
|
|
|
256
263
|
*
|
|
257
264
|
* The routes in the auth backend API are tied to these methods like below
|
|
258
265
|
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
266
|
+
* `/auth/[provider]/start -> start`
|
|
267
|
+
* `/auth/[provider]/handler/frame -> frameHandler`
|
|
268
|
+
* `/auth/[provider]/refresh -> refresh`
|
|
269
|
+
* `/auth/[provider]/logout -> logout`
|
|
263
270
|
*/
|
|
264
271
|
interface AuthProviderRouteHandlers {
|
|
265
272
|
/**
|
|
@@ -270,9 +277,6 @@ interface AuthProviderRouteHandlers {
|
|
|
270
277
|
* Response
|
|
271
278
|
* - redirect to the auth provider for the user to sign in or consent.
|
|
272
279
|
* - sets a nonce cookie and also pass the nonce as 'state' query parameter in the redirect request
|
|
273
|
-
*
|
|
274
|
-
* @param {express.Request} req
|
|
275
|
-
* @param {express.Response} res
|
|
276
280
|
*/
|
|
277
281
|
start(req: express.Request, res: express.Response): Promise<void>;
|
|
278
282
|
/**
|
|
@@ -284,9 +288,6 @@ interface AuthProviderRouteHandlers {
|
|
|
284
288
|
* Response
|
|
285
289
|
* - postMessage to the window with a payload that contains accessToken, expiryInSeconds?, idToken? and scope.
|
|
286
290
|
* - sets a refresh token cookie if the auth provider supports refresh tokens
|
|
287
|
-
*
|
|
288
|
-
* @param {express.Request} req
|
|
289
|
-
* @param {express.Response} res
|
|
290
291
|
*/
|
|
291
292
|
frameHandler(req: express.Request, res: express.Response): Promise<void>;
|
|
292
293
|
/**
|
|
@@ -297,9 +298,6 @@ interface AuthProviderRouteHandlers {
|
|
|
297
298
|
* - to contain a refresh token cookie and scope (Optional) query parameter.
|
|
298
299
|
* Response
|
|
299
300
|
* - payload with accessToken, expiryInSeconds?, idToken?, scope and user profile information.
|
|
300
|
-
*
|
|
301
|
-
* @param {express.Request} req
|
|
302
|
-
* @param {express.Response} res
|
|
303
301
|
*/
|
|
304
302
|
refresh?(req: express.Request, res: express.Response): Promise<void>;
|
|
305
303
|
/**
|
|
@@ -307,9 +305,6 @@ interface AuthProviderRouteHandlers {
|
|
|
307
305
|
*
|
|
308
306
|
* Response
|
|
309
307
|
* - removes the refresh token cookie
|
|
310
|
-
*
|
|
311
|
-
* @param {express.Request} req
|
|
312
|
-
* @param {express.Response} res
|
|
313
308
|
*/
|
|
314
309
|
logout?(req: express.Request, res: express.Response): Promise<void>;
|
|
315
310
|
}
|
|
@@ -382,12 +377,15 @@ interface BackstageSignInResult {
|
|
|
382
377
|
}
|
|
383
378
|
/**
|
|
384
379
|
* The old exported symbol for {@link BackstageSignInResult}.
|
|
380
|
+
*
|
|
385
381
|
* @public
|
|
386
|
-
* @deprecated Use the
|
|
382
|
+
* @deprecated Use the {@link BackstageSignInResult} instead.
|
|
387
383
|
*/
|
|
388
384
|
declare type BackstageIdentity = BackstageSignInResult;
|
|
389
385
|
/**
|
|
390
|
-
* Response object containing the {@link BackstageUserIdentity} and the token
|
|
386
|
+
* Response object containing the {@link BackstageUserIdentity} and the token
|
|
387
|
+
* from the authentication provider.
|
|
388
|
+
*
|
|
391
389
|
* @public
|
|
392
390
|
*/
|
|
393
391
|
interface BackstageIdentityResponse extends BackstageSignInResult {
|
|
@@ -400,7 +398,8 @@ interface BackstageIdentityResponse extends BackstageSignInResult {
|
|
|
400
398
|
* Used to display login information to user, i.e. sidebar popup.
|
|
401
399
|
*
|
|
402
400
|
* It is also temporarily used as the profile of the signed-in user's Backstage
|
|
403
|
-
* identity, but we want to replace that with data from identity and/org catalog
|
|
401
|
+
* identity, but we want to replace that with data from identity and/org catalog
|
|
402
|
+
* service
|
|
404
403
|
*
|
|
405
404
|
* @public
|
|
406
405
|
*/
|
|
@@ -420,47 +419,52 @@ declare type ProfileInfo = {
|
|
|
420
419
|
picture?: string;
|
|
421
420
|
};
|
|
422
421
|
/**
|
|
423
|
-
*
|
|
422
|
+
* Type of sign in information context. Includes the profile information and
|
|
423
|
+
* authentication result which contains auth related information.
|
|
424
|
+
*
|
|
424
425
|
* @public
|
|
425
426
|
*/
|
|
426
|
-
declare type SignInInfo<
|
|
427
|
+
declare type SignInInfo<TAuthResult> = {
|
|
427
428
|
/**
|
|
428
429
|
* The simple profile passed down for use in the frontend.
|
|
429
430
|
*/
|
|
430
431
|
profile: ProfileInfo;
|
|
431
432
|
/**
|
|
432
|
-
* The authentication result that was received from the authentication
|
|
433
|
+
* The authentication result that was received from the authentication
|
|
434
|
+
* provider.
|
|
433
435
|
*/
|
|
434
|
-
result:
|
|
436
|
+
result: TAuthResult;
|
|
435
437
|
};
|
|
436
438
|
/**
|
|
437
|
-
*
|
|
438
|
-
*
|
|
439
|
+
* Describes the function which handles the result of a successful
|
|
440
|
+
* authentication. Must return a valid {@link BackstageSignInResult}.
|
|
441
|
+
*
|
|
439
442
|
* @public
|
|
440
443
|
*/
|
|
441
|
-
declare type SignInResolver<
|
|
442
|
-
tokenIssuer: TokenIssuer;
|
|
443
|
-
catalogIdentityClient: CatalogIdentityClient;
|
|
444
|
-
logger: Logger;
|
|
445
|
-
}) => Promise<BackstageSignInResult>;
|
|
444
|
+
declare type SignInResolver<TAuthResult> = (info: SignInInfo<TAuthResult>, context: AuthResolverContext) => Promise<BackstageSignInResult>;
|
|
446
445
|
/**
|
|
447
|
-
* The return type of authentication handler
|
|
446
|
+
* The return type of an authentication handler. Must contain valid profile
|
|
447
|
+
* information.
|
|
448
|
+
*
|
|
448
449
|
* @public
|
|
449
450
|
*/
|
|
450
451
|
declare type AuthHandlerResult = {
|
|
451
452
|
profile: ProfileInfo;
|
|
452
453
|
};
|
|
453
454
|
/**
|
|
454
|
-
* The AuthHandler function is called every time the user authenticates using
|
|
455
|
+
* The AuthHandler function is called every time the user authenticates using
|
|
456
|
+
* the provider.
|
|
455
457
|
*
|
|
456
|
-
* The handler should return a profile that represents the session for the user
|
|
458
|
+
* The handler should return a profile that represents the session for the user
|
|
459
|
+
* in the frontend.
|
|
457
460
|
*
|
|
458
|
-
* Throwing an error in the function will cause the authentication to fail,
|
|
459
|
-
* possible to use this function as a way to limit access to a certain
|
|
461
|
+
* Throwing an error in the function will cause the authentication to fail,
|
|
462
|
+
* making it possible to use this function as a way to limit access to a certain
|
|
463
|
+
* group of users.
|
|
460
464
|
*
|
|
461
465
|
* @public
|
|
462
466
|
*/
|
|
463
|
-
declare type AuthHandler<
|
|
467
|
+
declare type AuthHandler<TAuthResult> = (input: TAuthResult, context: AuthResolverContext) => Promise<AuthHandlerResult>;
|
|
464
468
|
declare type StateEncoder = (req: OAuthStartRequest) => Promise<{
|
|
465
469
|
encodedState: string;
|
|
466
470
|
}>;
|
|
@@ -513,6 +517,134 @@ declare const readState: (stateString: string) => OAuthState;
|
|
|
513
517
|
declare const encodeState: (state: OAuthState) => string;
|
|
514
518
|
declare const verifyNonce: (req: express.Request, providerId: string) => void;
|
|
515
519
|
|
|
520
|
+
declare type AtlassianAuthProviderOptions = OAuthProviderOptions & {
|
|
521
|
+
scopes: string;
|
|
522
|
+
signInResolver?: SignInResolver<OAuthResult>;
|
|
523
|
+
authHandler: AuthHandler<OAuthResult>;
|
|
524
|
+
tokenIssuer: TokenIssuer;
|
|
525
|
+
catalogIdentityClient: CatalogIdentityClient;
|
|
526
|
+
logger: Logger;
|
|
527
|
+
};
|
|
528
|
+
declare class AtlassianAuthProvider implements OAuthHandlers {
|
|
529
|
+
private readonly _strategy;
|
|
530
|
+
private readonly signInResolver?;
|
|
531
|
+
private readonly authHandler;
|
|
532
|
+
private readonly tokenIssuer;
|
|
533
|
+
private readonly catalogIdentityClient;
|
|
534
|
+
private readonly logger;
|
|
535
|
+
constructor(options: AtlassianAuthProviderOptions);
|
|
536
|
+
start(req: OAuthStartRequest): Promise<RedirectInfo>;
|
|
537
|
+
handler(req: express.Request): Promise<{
|
|
538
|
+
response: OAuthResponse;
|
|
539
|
+
refreshToken: string | undefined;
|
|
540
|
+
}>;
|
|
541
|
+
private handleResult;
|
|
542
|
+
refresh(req: OAuthRefreshRequest): Promise<{
|
|
543
|
+
response: OAuthResponse;
|
|
544
|
+
refreshToken: string | undefined;
|
|
545
|
+
}>;
|
|
546
|
+
}
|
|
547
|
+
declare type AtlassianProviderOptions = {
|
|
548
|
+
/**
|
|
549
|
+
* The profile transformation function used to verify and convert the auth response
|
|
550
|
+
* into the profile that will be presented to the user.
|
|
551
|
+
*/
|
|
552
|
+
authHandler?: AuthHandler<OAuthResult>;
|
|
553
|
+
/**
|
|
554
|
+
* Configure sign-in for this provider, without it the provider can not be used to sign users in.
|
|
555
|
+
*/
|
|
556
|
+
signIn?: {
|
|
557
|
+
resolver: SignInResolver<OAuthResult>;
|
|
558
|
+
};
|
|
559
|
+
};
|
|
560
|
+
declare const createAtlassianProvider: (options?: AtlassianProviderOptions | undefined) => AuthProviderFactory;
|
|
561
|
+
|
|
562
|
+
/** @public */
|
|
563
|
+
declare type Auth0ProviderOptions = {
|
|
564
|
+
/**
|
|
565
|
+
* The profile transformation function used to verify and convert the auth response
|
|
566
|
+
* into the profile that will be presented to the user.
|
|
567
|
+
*/
|
|
568
|
+
authHandler?: AuthHandler<OAuthResult>;
|
|
569
|
+
/**
|
|
570
|
+
* Configure sign-in for this provider, without it the provider can not be used to sign users in.
|
|
571
|
+
*/
|
|
572
|
+
signIn?: {
|
|
573
|
+
/**
|
|
574
|
+
* Maps an auth result to a Backstage identity for the user.
|
|
575
|
+
*/
|
|
576
|
+
resolver: SignInResolver<OAuthResult>;
|
|
577
|
+
};
|
|
578
|
+
};
|
|
579
|
+
/** @public */
|
|
580
|
+
declare const createAuth0Provider: (options?: Auth0ProviderOptions | undefined) => AuthProviderFactory;
|
|
581
|
+
|
|
582
|
+
declare type AwsAlbResult = {
|
|
583
|
+
fullProfile: Profile;
|
|
584
|
+
expiresInSeconds?: number;
|
|
585
|
+
accessToken: string;
|
|
586
|
+
};
|
|
587
|
+
declare type AwsAlbProviderOptions = {
|
|
588
|
+
/**
|
|
589
|
+
* The profile transformation function used to verify and convert the auth response
|
|
590
|
+
* into the profile that will be presented to the user.
|
|
591
|
+
*/
|
|
592
|
+
authHandler?: AuthHandler<AwsAlbResult>;
|
|
593
|
+
/**
|
|
594
|
+
* Configure sign-in for this provider, without it the provider can not be used to sign users in.
|
|
595
|
+
*/
|
|
596
|
+
signIn: {
|
|
597
|
+
/**
|
|
598
|
+
* Maps an auth result to a Backstage identity for the user.
|
|
599
|
+
*/
|
|
600
|
+
resolver: SignInResolver<AwsAlbResult>;
|
|
601
|
+
};
|
|
602
|
+
};
|
|
603
|
+
declare const createAwsAlbProvider: (options?: AwsAlbProviderOptions | undefined) => AuthProviderFactory;
|
|
604
|
+
|
|
605
|
+
declare type BitbucketOAuthResult = {
|
|
606
|
+
fullProfile: BitbucketPassportProfile;
|
|
607
|
+
params: {
|
|
608
|
+
id_token?: string;
|
|
609
|
+
scope: string;
|
|
610
|
+
expires_in: number;
|
|
611
|
+
};
|
|
612
|
+
accessToken: string;
|
|
613
|
+
refreshToken?: string;
|
|
614
|
+
};
|
|
615
|
+
declare type BitbucketPassportProfile = Profile & {
|
|
616
|
+
id?: string;
|
|
617
|
+
displayName?: string;
|
|
618
|
+
username?: string;
|
|
619
|
+
avatarUrl?: string;
|
|
620
|
+
_json?: {
|
|
621
|
+
links?: {
|
|
622
|
+
avatar?: {
|
|
623
|
+
href?: string;
|
|
624
|
+
};
|
|
625
|
+
};
|
|
626
|
+
};
|
|
627
|
+
};
|
|
628
|
+
declare const bitbucketUsernameSignInResolver: SignInResolver<BitbucketOAuthResult>;
|
|
629
|
+
declare const bitbucketUserIdSignInResolver: SignInResolver<BitbucketOAuthResult>;
|
|
630
|
+
declare type BitbucketProviderOptions = {
|
|
631
|
+
/**
|
|
632
|
+
* The profile transformation function used to verify and convert the auth response
|
|
633
|
+
* into the profile that will be presented to the user.
|
|
634
|
+
*/
|
|
635
|
+
authHandler?: AuthHandler<OAuthResult>;
|
|
636
|
+
/**
|
|
637
|
+
* Configure sign-in for this provider, without it the provider can not be used to sign users in.
|
|
638
|
+
*/
|
|
639
|
+
signIn?: {
|
|
640
|
+
/**
|
|
641
|
+
* Maps an auth result to a Backstage identity for the user.
|
|
642
|
+
*/
|
|
643
|
+
resolver: SignInResolver<OAuthResult>;
|
|
644
|
+
};
|
|
645
|
+
};
|
|
646
|
+
declare const createBitbucketProvider: (options?: BitbucketProviderOptions | undefined) => AuthProviderFactory;
|
|
647
|
+
|
|
516
648
|
declare type GithubOAuthResult = {
|
|
517
649
|
fullProfile: Profile;
|
|
518
650
|
params: {
|
|
@@ -547,7 +679,7 @@ declare type GithubProviderOptions = {
|
|
|
547
679
|
* Providing your own stateEncoder will allow you to add addition parameters to the state field.
|
|
548
680
|
*
|
|
549
681
|
* It is typed as follows:
|
|
550
|
-
* export type StateEncoder = (input: OAuthState) => Promise<{encodedState: string}
|
|
682
|
+
* `export type StateEncoder = (input: OAuthState) => Promise<{encodedState: string}>;`
|
|
551
683
|
*
|
|
552
684
|
* Note: the stateEncoder must encode a 'nonce' value and an 'env' value. Without this, the OAuth flow will fail
|
|
553
685
|
* (These two values will be set by the req.state by default)
|
|
@@ -625,6 +757,49 @@ declare type OAuth2ProviderOptions = {
|
|
|
625
757
|
};
|
|
626
758
|
declare const createOAuth2Provider: (options?: OAuth2ProviderOptions | undefined) => AuthProviderFactory;
|
|
627
759
|
|
|
760
|
+
/**
|
|
761
|
+
* JWT header extraction result, containing the raw value and the parsed JWT
|
|
762
|
+
* payload.
|
|
763
|
+
*
|
|
764
|
+
* @public
|
|
765
|
+
*/
|
|
766
|
+
declare type OAuth2ProxyResult<JWTPayload> = {
|
|
767
|
+
/**
|
|
768
|
+
* Parsed and decoded JWT payload.
|
|
769
|
+
*/
|
|
770
|
+
fullProfile: JWTPayload;
|
|
771
|
+
/**
|
|
772
|
+
* Raw JWT token
|
|
773
|
+
*/
|
|
774
|
+
accessToken: string;
|
|
775
|
+
};
|
|
776
|
+
/**
|
|
777
|
+
* Options for the oauth2-proxy provider factory
|
|
778
|
+
*
|
|
779
|
+
* @public
|
|
780
|
+
*/
|
|
781
|
+
declare type Oauth2ProxyProviderOptions<JWTPayload> = {
|
|
782
|
+
/**
|
|
783
|
+
* Configure an auth handler to generate a profile for the user.
|
|
784
|
+
*/
|
|
785
|
+
authHandler: AuthHandler<OAuth2ProxyResult<JWTPayload>>;
|
|
786
|
+
/**
|
|
787
|
+
* Configure sign-in for this provider, without it the provider can not be used to sign users in.
|
|
788
|
+
*/
|
|
789
|
+
signIn: {
|
|
790
|
+
/**
|
|
791
|
+
* Maps an auth result to a Backstage identity for the user.
|
|
792
|
+
*/
|
|
793
|
+
resolver: SignInResolver<OAuth2ProxyResult<JWTPayload>>;
|
|
794
|
+
};
|
|
795
|
+
};
|
|
796
|
+
/**
|
|
797
|
+
* Factory function for oauth2-proxy auth provider
|
|
798
|
+
*
|
|
799
|
+
* @public
|
|
800
|
+
*/
|
|
801
|
+
declare const createOauth2ProxyProvider: <JWTPayload>(options: Oauth2ProxyProviderOptions<JWTPayload>) => AuthProviderFactory;
|
|
802
|
+
|
|
628
803
|
/**
|
|
629
804
|
* authentication result for the OIDC which includes the token set and user information (a profile response sent by OIDC server)
|
|
630
805
|
* @public
|
|
@@ -672,32 +847,8 @@ declare type OktaProviderOptions = {
|
|
|
672
847
|
};
|
|
673
848
|
declare const createOktaProvider: (_options?: OktaProviderOptions | undefined) => AuthProviderFactory;
|
|
674
849
|
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
params: {
|
|
678
|
-
id_token?: string;
|
|
679
|
-
scope: string;
|
|
680
|
-
expires_in: number;
|
|
681
|
-
};
|
|
682
|
-
accessToken: string;
|
|
683
|
-
refreshToken?: string;
|
|
684
|
-
};
|
|
685
|
-
declare type BitbucketPassportProfile = Profile & {
|
|
686
|
-
id?: string;
|
|
687
|
-
displayName?: string;
|
|
688
|
-
username?: string;
|
|
689
|
-
avatarUrl?: string;
|
|
690
|
-
_json?: {
|
|
691
|
-
links?: {
|
|
692
|
-
avatar?: {
|
|
693
|
-
href?: string;
|
|
694
|
-
};
|
|
695
|
-
};
|
|
696
|
-
};
|
|
697
|
-
};
|
|
698
|
-
declare const bitbucketUsernameSignInResolver: SignInResolver<BitbucketOAuthResult>;
|
|
699
|
-
declare const bitbucketUserIdSignInResolver: SignInResolver<BitbucketOAuthResult>;
|
|
700
|
-
declare type BitbucketProviderOptions = {
|
|
850
|
+
/** @public */
|
|
851
|
+
declare type OneLoginProviderOptions = {
|
|
701
852
|
/**
|
|
702
853
|
* The profile transformation function used to verify and convert the auth response
|
|
703
854
|
* into the profile that will be presented to the user.
|
|
@@ -713,100 +864,103 @@ declare type BitbucketProviderOptions = {
|
|
|
713
864
|
resolver: SignInResolver<OAuthResult>;
|
|
714
865
|
};
|
|
715
866
|
};
|
|
716
|
-
|
|
867
|
+
/** @public */
|
|
868
|
+
declare const createOneLoginProvider: (options?: OneLoginProviderOptions | undefined) => AuthProviderFactory;
|
|
717
869
|
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
authHandler: AuthHandler<OAuthResult>;
|
|
722
|
-
tokenIssuer: TokenIssuer;
|
|
723
|
-
catalogIdentityClient: CatalogIdentityClient;
|
|
724
|
-
logger: Logger;
|
|
870
|
+
/** @public */
|
|
871
|
+
declare type SamlAuthResult = {
|
|
872
|
+
fullProfile: any;
|
|
725
873
|
};
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
private readonly signInResolver?;
|
|
729
|
-
private readonly authHandler;
|
|
730
|
-
private readonly tokenIssuer;
|
|
731
|
-
private readonly catalogIdentityClient;
|
|
732
|
-
private readonly logger;
|
|
733
|
-
constructor(options: AtlassianAuthProviderOptions);
|
|
734
|
-
start(req: OAuthStartRequest): Promise<RedirectInfo>;
|
|
735
|
-
handler(req: express.Request): Promise<{
|
|
736
|
-
response: OAuthResponse;
|
|
737
|
-
refreshToken: string;
|
|
738
|
-
}>;
|
|
739
|
-
private handleResult;
|
|
740
|
-
refresh(req: OAuthRefreshRequest): Promise<OAuthResponse>;
|
|
741
|
-
}
|
|
742
|
-
declare type AtlassianProviderOptions = {
|
|
874
|
+
/** @public */
|
|
875
|
+
declare type SamlProviderOptions = {
|
|
743
876
|
/**
|
|
744
877
|
* The profile transformation function used to verify and convert the auth response
|
|
745
878
|
* into the profile that will be presented to the user.
|
|
746
879
|
*/
|
|
747
|
-
authHandler?: AuthHandler<
|
|
880
|
+
authHandler?: AuthHandler<SamlAuthResult>;
|
|
748
881
|
/**
|
|
749
882
|
* Configure sign-in for this provider, without it the provider can not be used to sign users in.
|
|
750
883
|
*/
|
|
751
884
|
signIn?: {
|
|
752
|
-
|
|
885
|
+
/**
|
|
886
|
+
* Maps an auth result to a Backstage identity for the user.
|
|
887
|
+
*/
|
|
888
|
+
resolver?: SignInResolver<SamlAuthResult>;
|
|
753
889
|
};
|
|
754
890
|
};
|
|
755
|
-
|
|
891
|
+
/** @public */
|
|
892
|
+
declare const createSamlProvider: (options?: SamlProviderOptions | undefined) => AuthProviderFactory;
|
|
756
893
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
declare type
|
|
894
|
+
/**
|
|
895
|
+
* The data extracted from an IAP token.
|
|
896
|
+
*
|
|
897
|
+
* @public
|
|
898
|
+
*/
|
|
899
|
+
declare type GcpIapTokenInfo = {
|
|
763
900
|
/**
|
|
764
|
-
* The
|
|
765
|
-
* into the profile that will be presented to the user.
|
|
901
|
+
* The unique, stable identifier for the user.
|
|
766
902
|
*/
|
|
767
|
-
|
|
903
|
+
sub: string;
|
|
768
904
|
/**
|
|
769
|
-
*
|
|
905
|
+
* User email address.
|
|
770
906
|
*/
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
};
|
|
907
|
+
email: string;
|
|
908
|
+
/**
|
|
909
|
+
* Other fields.
|
|
910
|
+
*/
|
|
911
|
+
[key: string]: JsonValue;
|
|
777
912
|
};
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
913
|
+
/**
|
|
914
|
+
* The result of the initial auth challenge. This is the input to the auth
|
|
915
|
+
* callbacks.
|
|
916
|
+
*
|
|
917
|
+
* @public
|
|
918
|
+
*/
|
|
919
|
+
declare type GcpIapResult = {
|
|
920
|
+
/**
|
|
921
|
+
* The data extracted from the IAP token header.
|
|
922
|
+
*/
|
|
923
|
+
iapToken: GcpIapTokenInfo;
|
|
783
924
|
};
|
|
784
|
-
/**
|
|
785
|
-
|
|
925
|
+
/**
|
|
926
|
+
* Options for {@link createGcpIapProvider}.
|
|
927
|
+
*
|
|
928
|
+
* @public
|
|
929
|
+
*/
|
|
930
|
+
declare type GcpIapProviderOptions = {
|
|
786
931
|
/**
|
|
787
|
-
* The profile transformation function used to verify and convert the auth
|
|
788
|
-
* into the profile that will be presented to the user.
|
|
932
|
+
* The profile transformation function used to verify and convert the auth
|
|
933
|
+
* response into the profile that will be presented to the user. The default
|
|
934
|
+
* implementation just provides the authenticated email that the IAP
|
|
935
|
+
* presented.
|
|
789
936
|
*/
|
|
790
|
-
authHandler?: AuthHandler<
|
|
937
|
+
authHandler?: AuthHandler<GcpIapResult>;
|
|
791
938
|
/**
|
|
792
|
-
*
|
|
939
|
+
* Configures sign-in for this provider.
|
|
793
940
|
*/
|
|
794
|
-
signIn
|
|
941
|
+
signIn: {
|
|
795
942
|
/**
|
|
796
943
|
* Maps an auth result to a Backstage identity for the user.
|
|
797
944
|
*/
|
|
798
|
-
resolver
|
|
945
|
+
resolver: SignInResolver<GcpIapResult>;
|
|
799
946
|
};
|
|
800
947
|
};
|
|
801
|
-
|
|
802
|
-
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* Creates an auth provider for Google Identity-Aware Proxy.
|
|
951
|
+
*
|
|
952
|
+
* @public
|
|
953
|
+
*/
|
|
954
|
+
declare function createGcpIapProvider(options: GcpIapProviderOptions): AuthProviderFactory;
|
|
803
955
|
|
|
804
956
|
declare const factories: {
|
|
805
957
|
[providerId: string]: AuthProviderFactory;
|
|
806
958
|
};
|
|
807
959
|
|
|
808
960
|
/**
|
|
809
|
-
* Parses token and decorates the
|
|
961
|
+
* Parses a Backstage-issued token and decorates the
|
|
962
|
+
* {@link BackstageIdentityResponse} with identity information sourced from the
|
|
963
|
+
* token.
|
|
810
964
|
*
|
|
811
965
|
* @public
|
|
812
966
|
*/
|
|
@@ -840,4 +994,4 @@ declare type WebMessageResponse = {
|
|
|
840
994
|
declare const postMessageResponse: (res: express.Response, appOrigin: string, response: WebMessageResponse) => void;
|
|
841
995
|
declare const ensuresXRequestedWith: (req: express.Request) => boolean;
|
|
842
996
|
|
|
843
|
-
export { AtlassianAuthProvider, AtlassianProviderOptions, AuthHandler, AuthHandlerResult, AuthProviderFactory, AuthProviderFactoryOptions, AuthProviderRouteHandlers, AuthResponse, AwsAlbProviderOptions, BackstageIdentity, BackstageIdentityResponse, BackstageSignInResult, BackstageUserIdentity, BitbucketOAuthResult, BitbucketPassportProfile, BitbucketProviderOptions, CatalogIdentityClient, GithubOAuthResult, GithubProviderOptions, GitlabProviderOptions, GoogleProviderOptions, IdentityClient, MicrosoftProviderOptions, OAuth2ProviderOptions, OAuthAdapter, OAuthEnvironmentHandler, OAuthHandlers, OAuthProviderInfo, OAuthProviderOptions, OAuthRefreshRequest, OAuthResponse, OAuthResult, OAuthStartRequest, OAuthState, OidcAuthResult, OidcProviderOptions, OktaProviderOptions, ProfileInfo, RouterOptions, SamlAuthResult, SamlProviderOptions, SignInInfo, SignInResolver, TokenIssuer, WebMessageResponse, bitbucketUserIdSignInResolver, bitbucketUsernameSignInResolver, createAtlassianProvider, createAwsAlbProvider, createBitbucketProvider, createGithubProvider, createGitlabProvider, createGoogleProvider, createMicrosoftProvider, createOAuth2Provider, createOidcProvider, createOktaProvider, createOriginFilter, createRouter, createSamlProvider, factories as defaultAuthProviderFactories, encodeState, ensuresXRequestedWith, getEntityClaims, googleEmailSignInResolver, microsoftEmailSignInResolver, oktaEmailSignInResolver, postMessageResponse, prepareBackstageIdentityResponse, readState, verifyNonce };
|
|
997
|
+
export { AtlassianAuthProvider, AtlassianProviderOptions, Auth0ProviderOptions, AuthHandler, AuthHandlerResult, AuthProviderFactory, AuthProviderFactoryOptions, AuthProviderRouteHandlers, AuthResolverContext, AuthResponse, AwsAlbProviderOptions, BackstageIdentity, BackstageIdentityResponse, BackstageSignInResult, BackstageUserIdentity, BitbucketOAuthResult, BitbucketPassportProfile, BitbucketProviderOptions, CatalogIdentityClient, GcpIapProviderOptions, GcpIapResult, GcpIapTokenInfo, GithubOAuthResult, GithubProviderOptions, GitlabProviderOptions, GoogleProviderOptions, IdentityClient, MicrosoftProviderOptions, OAuth2ProviderOptions, OAuth2ProxyResult, OAuthAdapter, OAuthEnvironmentHandler, OAuthHandlers, OAuthProviderInfo, OAuthProviderOptions, OAuthRefreshRequest, OAuthResponse, OAuthResult, OAuthStartRequest, OAuthState, Oauth2ProxyProviderOptions, OidcAuthResult, OidcProviderOptions, OktaProviderOptions, OneLoginProviderOptions, ProfileInfo, RouterOptions, SamlAuthResult, SamlProviderOptions, SignInInfo, SignInResolver, TokenIssuer, WebMessageResponse, bitbucketUserIdSignInResolver, bitbucketUsernameSignInResolver, createAtlassianProvider, createAuth0Provider, createAwsAlbProvider, createBitbucketProvider, createGcpIapProvider, createGithubProvider, createGitlabProvider, createGoogleProvider, createMicrosoftProvider, createOAuth2Provider, createOauth2ProxyProvider, createOidcProvider, createOktaProvider, createOneLoginProvider, createOriginFilter, createRouter, createSamlProvider, factories as defaultAuthProviderFactories, encodeState, ensuresXRequestedWith, getEntityClaims, googleEmailSignInResolver, microsoftEmailSignInResolver, oktaEmailSignInResolver, postMessageResponse, prepareBackstageIdentityResponse, readState, verifyNonce };
|