@backstage/plugin-auth-backend 0.4.10 → 0.6.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 +80 -0
- package/dist/index.cjs.js +1319 -1220
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +252 -117
- package/package.json +7 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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';
|
|
@@ -70,7 +70,16 @@ declare type OAuthResult = {
|
|
|
70
70
|
accessToken: string;
|
|
71
71
|
refreshToken?: string;
|
|
72
72
|
};
|
|
73
|
-
|
|
73
|
+
/**
|
|
74
|
+
* The expected response from an OAuth flow.
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
declare type OAuthResponse = {
|
|
79
|
+
profile: ProfileInfo;
|
|
80
|
+
providerInfo: OAuthProviderInfo;
|
|
81
|
+
backstageIdentity?: BackstageSignInResult;
|
|
82
|
+
};
|
|
74
83
|
declare type OAuthProviderInfo = {
|
|
75
84
|
/**
|
|
76
85
|
* An access token issued for the signed in user.
|
|
@@ -88,10 +97,6 @@ declare type OAuthProviderInfo = {
|
|
|
88
97
|
* Scopes granted for the access token.
|
|
89
98
|
*/
|
|
90
99
|
scope: string;
|
|
91
|
-
/**
|
|
92
|
-
* A refresh token issued for the signed in user
|
|
93
|
-
*/
|
|
94
|
-
refreshToken?: string;
|
|
95
100
|
};
|
|
96
101
|
declare type OAuthState = {
|
|
97
102
|
nonce: string;
|
|
@@ -123,7 +128,7 @@ interface OAuthHandlers {
|
|
|
123
128
|
* @param {express.Request} req
|
|
124
129
|
*/
|
|
125
130
|
handler(req: express.Request): Promise<{
|
|
126
|
-
response:
|
|
131
|
+
response: OAuthResponse;
|
|
127
132
|
refreshToken?: string;
|
|
128
133
|
}>;
|
|
129
134
|
/**
|
|
@@ -131,7 +136,10 @@ interface OAuthHandlers {
|
|
|
131
136
|
* @param {string} refreshToken
|
|
132
137
|
* @param {string} scope
|
|
133
138
|
*/
|
|
134
|
-
refresh?(req: OAuthRefreshRequest): Promise<
|
|
139
|
+
refresh?(req: OAuthRefreshRequest): Promise<{
|
|
140
|
+
response: OAuthResponse;
|
|
141
|
+
refreshToken?: string;
|
|
142
|
+
}>;
|
|
135
143
|
/**
|
|
136
144
|
* (Optional) Sign out of the auth provider.
|
|
137
145
|
*/
|
|
@@ -158,7 +166,7 @@ declare class IdentityClient {
|
|
|
158
166
|
* Returns a BackstageIdentity (user) matching the token.
|
|
159
167
|
* The method throws an error if verification fails.
|
|
160
168
|
*/
|
|
161
|
-
authenticate(token: string | undefined): Promise<
|
|
169
|
+
authenticate(token: string | undefined): Promise<BackstageIdentityResponse>;
|
|
162
170
|
/**
|
|
163
171
|
* Parses the given authorization header and returns
|
|
164
172
|
* the bearer token, or null if no bearer token is given
|
|
@@ -211,7 +219,7 @@ declare class CatalogIdentityClient {
|
|
|
211
219
|
*
|
|
212
220
|
* Returns a superset of the entity names that can be passed directly to `issueToken` as `ent`.
|
|
213
221
|
*/
|
|
214
|
-
resolveCatalogMembership(
|
|
222
|
+
resolveCatalogMembership(query: MemberClaimQuery): Promise<string[]>;
|
|
215
223
|
}
|
|
216
224
|
|
|
217
225
|
declare function getEntityClaims(entity: UserEntity): TokenParams['claims'];
|
|
@@ -317,37 +325,83 @@ declare type AuthProviderFactory = (options: AuthProviderFactoryOptions) => Auth
|
|
|
317
325
|
declare type AuthResponse<ProviderInfo> = {
|
|
318
326
|
providerInfo: ProviderInfo;
|
|
319
327
|
profile: ProfileInfo;
|
|
320
|
-
backstageIdentity?:
|
|
328
|
+
backstageIdentity?: BackstageIdentityResponse;
|
|
321
329
|
};
|
|
322
|
-
|
|
330
|
+
/**
|
|
331
|
+
* User identity information within Backstage.
|
|
332
|
+
*
|
|
333
|
+
* @public
|
|
334
|
+
*/
|
|
335
|
+
declare type BackstageUserIdentity = {
|
|
323
336
|
/**
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
* This is typically the same as the user entity `metadata.name`.
|
|
337
|
+
* The type of identity that this structure represents. In the frontend app
|
|
338
|
+
* this will currently always be 'user'.
|
|
327
339
|
*/
|
|
328
|
-
|
|
340
|
+
type: 'user';
|
|
329
341
|
/**
|
|
330
|
-
*
|
|
331
|
-
*
|
|
342
|
+
* The entityRef of the user in the catalog.
|
|
343
|
+
* For example User:default/sandra
|
|
332
344
|
*/
|
|
333
|
-
|
|
345
|
+
userEntityRef: string;
|
|
334
346
|
/**
|
|
335
|
-
* The
|
|
347
|
+
* The user and group entities that the user claims ownership through
|
|
336
348
|
*/
|
|
337
|
-
|
|
349
|
+
ownershipEntityRefs: string[];
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* A representation of a successful Backstage sign-in.
|
|
353
|
+
*
|
|
354
|
+
* Compared to the {@link BackstageIdentityResponse} this type omits
|
|
355
|
+
* the decoded identity information embedded in the token.
|
|
356
|
+
*
|
|
357
|
+
* @public
|
|
358
|
+
*/
|
|
359
|
+
interface BackstageSignInResult {
|
|
360
|
+
/**
|
|
361
|
+
* An opaque ID that uniquely identifies the user within Backstage.
|
|
362
|
+
*
|
|
363
|
+
* This is typically the same as the user entity `metadata.name`.
|
|
364
|
+
*
|
|
365
|
+
* @deprecated Use the `identity` field instead
|
|
366
|
+
*/
|
|
367
|
+
id: string;
|
|
338
368
|
/**
|
|
339
369
|
* The entity that the user is represented by within Backstage.
|
|
340
370
|
*
|
|
341
371
|
* This entity may or may not exist within the Catalog, and it can be used
|
|
342
372
|
* to read and store additional metadata about the user.
|
|
373
|
+
*
|
|
374
|
+
* @deprecated Use the `identity` field instead.
|
|
343
375
|
*/
|
|
344
376
|
entity?: Entity;
|
|
345
|
-
|
|
377
|
+
/**
|
|
378
|
+
* The token used to authenticate the user within Backstage.
|
|
379
|
+
*/
|
|
380
|
+
token: string;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* The old exported symbol for {@link BackstageSignInResult}.
|
|
384
|
+
* @public
|
|
385
|
+
* @deprecated Use the `BackstageSignInResult` type instead.
|
|
386
|
+
*/
|
|
387
|
+
declare type BackstageIdentity = BackstageSignInResult;
|
|
388
|
+
/**
|
|
389
|
+
* Response object containing the {@link BackstageUserIdentity} and the token from the authentication provider.
|
|
390
|
+
* @public
|
|
391
|
+
*/
|
|
392
|
+
interface BackstageIdentityResponse extends BackstageSignInResult {
|
|
393
|
+
/**
|
|
394
|
+
* A plaintext description of the identity that is encapsulated within the token.
|
|
395
|
+
*/
|
|
396
|
+
identity: BackstageUserIdentity;
|
|
397
|
+
}
|
|
346
398
|
/**
|
|
347
399
|
* Used to display login information to user, i.e. sidebar popup.
|
|
348
400
|
*
|
|
349
401
|
* It is also temporarily used as the profile of the signed-in user's Backstage
|
|
350
402
|
* identity, but we want to replace that with data from identity and/org catalog service
|
|
403
|
+
*
|
|
404
|
+
* @public
|
|
351
405
|
*/
|
|
352
406
|
declare type ProfileInfo = {
|
|
353
407
|
/**
|
|
@@ -364,6 +418,10 @@ declare type ProfileInfo = {
|
|
|
364
418
|
*/
|
|
365
419
|
picture?: string;
|
|
366
420
|
};
|
|
421
|
+
/**
|
|
422
|
+
* type of sign in information context, includes the profile information and authentication result which contains auth. related information
|
|
423
|
+
* @public
|
|
424
|
+
*/
|
|
367
425
|
declare type SignInInfo<AuthResult> = {
|
|
368
426
|
/**
|
|
369
427
|
* The simple profile passed down for use in the frontend.
|
|
@@ -374,11 +432,20 @@ declare type SignInInfo<AuthResult> = {
|
|
|
374
432
|
*/
|
|
375
433
|
result: AuthResult;
|
|
376
434
|
};
|
|
435
|
+
/**
|
|
436
|
+
* Sign in resolver type describes the function which handles the result of a successful authentication
|
|
437
|
+
* and it must return a valid {@link BackstageSignInResult}
|
|
438
|
+
* @public
|
|
439
|
+
*/
|
|
377
440
|
declare type SignInResolver<AuthResult> = (info: SignInInfo<AuthResult>, context: {
|
|
378
441
|
tokenIssuer: TokenIssuer;
|
|
379
442
|
catalogIdentityClient: CatalogIdentityClient;
|
|
380
443
|
logger: Logger;
|
|
381
|
-
}) => Promise<
|
|
444
|
+
}) => Promise<BackstageSignInResult>;
|
|
445
|
+
/**
|
|
446
|
+
* The return type of authentication handler which must contain a valid profile information
|
|
447
|
+
* @public
|
|
448
|
+
*/
|
|
382
449
|
declare type AuthHandlerResult = {
|
|
383
450
|
profile: ProfileInfo;
|
|
384
451
|
};
|
|
@@ -389,6 +456,8 @@ declare type AuthHandlerResult = {
|
|
|
389
456
|
*
|
|
390
457
|
* Throwing an error in the function will cause the authentication to fail, making it
|
|
391
458
|
* possible to use this function as a way to limit access to a certain group of users.
|
|
459
|
+
*
|
|
460
|
+
* @public
|
|
392
461
|
*/
|
|
393
462
|
declare type AuthHandler<AuthResult> = (input: AuthResult) => Promise<AuthHandlerResult>;
|
|
394
463
|
declare type StateEncoder = (req: OAuthStartRequest) => Promise<{
|
|
@@ -443,6 +512,134 @@ declare const readState: (stateString: string) => OAuthState;
|
|
|
443
512
|
declare const encodeState: (state: OAuthState) => string;
|
|
444
513
|
declare const verifyNonce: (req: express.Request, providerId: string) => void;
|
|
445
514
|
|
|
515
|
+
declare type AtlassianAuthProviderOptions = OAuthProviderOptions & {
|
|
516
|
+
scopes: string;
|
|
517
|
+
signInResolver?: SignInResolver<OAuthResult>;
|
|
518
|
+
authHandler: AuthHandler<OAuthResult>;
|
|
519
|
+
tokenIssuer: TokenIssuer;
|
|
520
|
+
catalogIdentityClient: CatalogIdentityClient;
|
|
521
|
+
logger: Logger;
|
|
522
|
+
};
|
|
523
|
+
declare class AtlassianAuthProvider implements OAuthHandlers {
|
|
524
|
+
private readonly _strategy;
|
|
525
|
+
private readonly signInResolver?;
|
|
526
|
+
private readonly authHandler;
|
|
527
|
+
private readonly tokenIssuer;
|
|
528
|
+
private readonly catalogIdentityClient;
|
|
529
|
+
private readonly logger;
|
|
530
|
+
constructor(options: AtlassianAuthProviderOptions);
|
|
531
|
+
start(req: OAuthStartRequest): Promise<RedirectInfo>;
|
|
532
|
+
handler(req: express.Request): Promise<{
|
|
533
|
+
response: OAuthResponse;
|
|
534
|
+
refreshToken: string | undefined;
|
|
535
|
+
}>;
|
|
536
|
+
private handleResult;
|
|
537
|
+
refresh(req: OAuthRefreshRequest): Promise<{
|
|
538
|
+
response: OAuthResponse;
|
|
539
|
+
refreshToken: string | undefined;
|
|
540
|
+
}>;
|
|
541
|
+
}
|
|
542
|
+
declare type AtlassianProviderOptions = {
|
|
543
|
+
/**
|
|
544
|
+
* The profile transformation function used to verify and convert the auth response
|
|
545
|
+
* into the profile that will be presented to the user.
|
|
546
|
+
*/
|
|
547
|
+
authHandler?: AuthHandler<OAuthResult>;
|
|
548
|
+
/**
|
|
549
|
+
* Configure sign-in for this provider, without it the provider can not be used to sign users in.
|
|
550
|
+
*/
|
|
551
|
+
signIn?: {
|
|
552
|
+
resolver: SignInResolver<OAuthResult>;
|
|
553
|
+
};
|
|
554
|
+
};
|
|
555
|
+
declare const createAtlassianProvider: (options?: AtlassianProviderOptions | undefined) => AuthProviderFactory;
|
|
556
|
+
|
|
557
|
+
/** @public */
|
|
558
|
+
declare type Auth0ProviderOptions = {
|
|
559
|
+
/**
|
|
560
|
+
* The profile transformation function used to verify and convert the auth response
|
|
561
|
+
* into the profile that will be presented to the user.
|
|
562
|
+
*/
|
|
563
|
+
authHandler?: AuthHandler<OAuthResult>;
|
|
564
|
+
/**
|
|
565
|
+
* Configure sign-in for this provider, without it the provider can not be used to sign users in.
|
|
566
|
+
*/
|
|
567
|
+
signIn?: {
|
|
568
|
+
/**
|
|
569
|
+
* Maps an auth result to a Backstage identity for the user.
|
|
570
|
+
*/
|
|
571
|
+
resolver: SignInResolver<OAuthResult>;
|
|
572
|
+
};
|
|
573
|
+
};
|
|
574
|
+
/** @public */
|
|
575
|
+
declare const createAuth0Provider: (options?: Auth0ProviderOptions | undefined) => AuthProviderFactory;
|
|
576
|
+
|
|
577
|
+
declare type AwsAlbResult = {
|
|
578
|
+
fullProfile: Profile;
|
|
579
|
+
expiresInSeconds?: number;
|
|
580
|
+
accessToken: string;
|
|
581
|
+
};
|
|
582
|
+
declare type AwsAlbProviderOptions = {
|
|
583
|
+
/**
|
|
584
|
+
* The profile transformation function used to verify and convert the auth response
|
|
585
|
+
* into the profile that will be presented to the user.
|
|
586
|
+
*/
|
|
587
|
+
authHandler?: AuthHandler<AwsAlbResult>;
|
|
588
|
+
/**
|
|
589
|
+
* Configure sign-in for this provider, without it the provider can not be used to sign users in.
|
|
590
|
+
*/
|
|
591
|
+
signIn: {
|
|
592
|
+
/**
|
|
593
|
+
* Maps an auth result to a Backstage identity for the user.
|
|
594
|
+
*/
|
|
595
|
+
resolver: SignInResolver<AwsAlbResult>;
|
|
596
|
+
};
|
|
597
|
+
};
|
|
598
|
+
declare const createAwsAlbProvider: (options?: AwsAlbProviderOptions | undefined) => AuthProviderFactory;
|
|
599
|
+
|
|
600
|
+
declare type BitbucketOAuthResult = {
|
|
601
|
+
fullProfile: BitbucketPassportProfile;
|
|
602
|
+
params: {
|
|
603
|
+
id_token?: string;
|
|
604
|
+
scope: string;
|
|
605
|
+
expires_in: number;
|
|
606
|
+
};
|
|
607
|
+
accessToken: string;
|
|
608
|
+
refreshToken?: string;
|
|
609
|
+
};
|
|
610
|
+
declare type BitbucketPassportProfile = Profile & {
|
|
611
|
+
id?: string;
|
|
612
|
+
displayName?: string;
|
|
613
|
+
username?: string;
|
|
614
|
+
avatarUrl?: string;
|
|
615
|
+
_json?: {
|
|
616
|
+
links?: {
|
|
617
|
+
avatar?: {
|
|
618
|
+
href?: string;
|
|
619
|
+
};
|
|
620
|
+
};
|
|
621
|
+
};
|
|
622
|
+
};
|
|
623
|
+
declare const bitbucketUsernameSignInResolver: SignInResolver<BitbucketOAuthResult>;
|
|
624
|
+
declare const bitbucketUserIdSignInResolver: SignInResolver<BitbucketOAuthResult>;
|
|
625
|
+
declare type BitbucketProviderOptions = {
|
|
626
|
+
/**
|
|
627
|
+
* The profile transformation function used to verify and convert the auth response
|
|
628
|
+
* into the profile that will be presented to the user.
|
|
629
|
+
*/
|
|
630
|
+
authHandler?: AuthHandler<OAuthResult>;
|
|
631
|
+
/**
|
|
632
|
+
* Configure sign-in for this provider, without it the provider can not be used to sign users in.
|
|
633
|
+
*/
|
|
634
|
+
signIn?: {
|
|
635
|
+
/**
|
|
636
|
+
* Maps an auth result to a Backstage identity for the user.
|
|
637
|
+
*/
|
|
638
|
+
resolver: SignInResolver<OAuthResult>;
|
|
639
|
+
};
|
|
640
|
+
};
|
|
641
|
+
declare const createBitbucketProvider: (options?: BitbucketProviderOptions | undefined) => AuthProviderFactory;
|
|
642
|
+
|
|
446
643
|
declare type GithubOAuthResult = {
|
|
447
644
|
fullProfile: Profile;
|
|
448
645
|
params: {
|
|
@@ -555,14 +752,30 @@ declare type OAuth2ProviderOptions = {
|
|
|
555
752
|
};
|
|
556
753
|
declare const createOAuth2Provider: (options?: OAuth2ProviderOptions | undefined) => AuthProviderFactory;
|
|
557
754
|
|
|
558
|
-
|
|
755
|
+
/**
|
|
756
|
+
* authentication result for the OIDC which includes the token set and user information (a profile response sent by OIDC server)
|
|
757
|
+
* @public
|
|
758
|
+
*/
|
|
759
|
+
declare type OidcAuthResult = {
|
|
559
760
|
tokenset: TokenSet;
|
|
560
761
|
userinfo: UserinfoResponse;
|
|
561
762
|
};
|
|
763
|
+
/**
|
|
764
|
+
* OIDC provider callback options. An auth handler and a sign in resolver
|
|
765
|
+
* can be passed while creating a OIDC provider.
|
|
766
|
+
*
|
|
767
|
+
* authHandler : called after sign in was successful, a new object must be returned which includes a profile
|
|
768
|
+
* signInResolver: called after sign in was successful, expects to return a new {@link BackstageSignInResult}
|
|
769
|
+
*
|
|
770
|
+
* Both options are optional. There is fallback for authHandler where the default handler expect an e-mail explicitly
|
|
771
|
+
* otherwise it throws an error
|
|
772
|
+
*
|
|
773
|
+
* @public
|
|
774
|
+
*/
|
|
562
775
|
declare type OidcProviderOptions = {
|
|
563
|
-
authHandler?: AuthHandler<
|
|
776
|
+
authHandler?: AuthHandler<OidcAuthResult>;
|
|
564
777
|
signIn?: {
|
|
565
|
-
resolver?: SignInResolver<
|
|
778
|
+
resolver?: SignInResolver<OidcAuthResult>;
|
|
566
779
|
};
|
|
567
780
|
};
|
|
568
781
|
declare const createOidcProvider: (options?: OidcProviderOptions | undefined) => AuthProviderFactory;
|
|
@@ -586,32 +799,8 @@ declare type OktaProviderOptions = {
|
|
|
586
799
|
};
|
|
587
800
|
declare const createOktaProvider: (_options?: OktaProviderOptions | undefined) => AuthProviderFactory;
|
|
588
801
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
params: {
|
|
592
|
-
id_token?: string;
|
|
593
|
-
scope: string;
|
|
594
|
-
expires_in: number;
|
|
595
|
-
};
|
|
596
|
-
accessToken: string;
|
|
597
|
-
refreshToken?: string;
|
|
598
|
-
};
|
|
599
|
-
declare type BitbucketPassportProfile = Profile & {
|
|
600
|
-
id?: string;
|
|
601
|
-
displayName?: string;
|
|
602
|
-
username?: string;
|
|
603
|
-
avatarUrl?: string;
|
|
604
|
-
_json?: {
|
|
605
|
-
links?: {
|
|
606
|
-
avatar?: {
|
|
607
|
-
href?: string;
|
|
608
|
-
};
|
|
609
|
-
};
|
|
610
|
-
};
|
|
611
|
-
};
|
|
612
|
-
declare const bitbucketUsernameSignInResolver: SignInResolver<BitbucketOAuthResult>;
|
|
613
|
-
declare const bitbucketUserIdSignInResolver: SignInResolver<BitbucketOAuthResult>;
|
|
614
|
-
declare type BitbucketProviderOptions = {
|
|
802
|
+
/** @public */
|
|
803
|
+
declare type OneLoginProviderOptions = {
|
|
615
804
|
/**
|
|
616
805
|
* The profile transformation function used to verify and convert the auth response
|
|
617
806
|
* into the profile that will be presented to the user.
|
|
@@ -627,69 +816,8 @@ declare type BitbucketProviderOptions = {
|
|
|
627
816
|
resolver: SignInResolver<OAuthResult>;
|
|
628
817
|
};
|
|
629
818
|
};
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
declare type AtlassianAuthProviderOptions = OAuthProviderOptions & {
|
|
633
|
-
scopes: string;
|
|
634
|
-
signInResolver?: SignInResolver<OAuthResult>;
|
|
635
|
-
authHandler: AuthHandler<OAuthResult>;
|
|
636
|
-
tokenIssuer: TokenIssuer;
|
|
637
|
-
catalogIdentityClient: CatalogIdentityClient;
|
|
638
|
-
logger: Logger;
|
|
639
|
-
};
|
|
640
|
-
declare class AtlassianAuthProvider implements OAuthHandlers {
|
|
641
|
-
private readonly _strategy;
|
|
642
|
-
private readonly signInResolver?;
|
|
643
|
-
private readonly authHandler;
|
|
644
|
-
private readonly tokenIssuer;
|
|
645
|
-
private readonly catalogIdentityClient;
|
|
646
|
-
private readonly logger;
|
|
647
|
-
constructor(options: AtlassianAuthProviderOptions);
|
|
648
|
-
start(req: OAuthStartRequest): Promise<RedirectInfo>;
|
|
649
|
-
handler(req: express.Request): Promise<{
|
|
650
|
-
response: OAuthResponse;
|
|
651
|
-
refreshToken: string;
|
|
652
|
-
}>;
|
|
653
|
-
private handleResult;
|
|
654
|
-
refresh(req: OAuthRefreshRequest): Promise<OAuthResponse>;
|
|
655
|
-
}
|
|
656
|
-
declare type AtlassianProviderOptions = {
|
|
657
|
-
/**
|
|
658
|
-
* The profile transformation function used to verify and convert the auth response
|
|
659
|
-
* into the profile that will be presented to the user.
|
|
660
|
-
*/
|
|
661
|
-
authHandler?: AuthHandler<OAuthResult>;
|
|
662
|
-
/**
|
|
663
|
-
* Configure sign-in for this provider, without it the provider can not be used to sign users in.
|
|
664
|
-
*/
|
|
665
|
-
signIn?: {
|
|
666
|
-
resolver: SignInResolver<OAuthResult>;
|
|
667
|
-
};
|
|
668
|
-
};
|
|
669
|
-
declare const createAtlassianProvider: (options?: AtlassianProviderOptions | undefined) => AuthProviderFactory;
|
|
670
|
-
|
|
671
|
-
declare type AwsAlbResult = {
|
|
672
|
-
fullProfile: Profile;
|
|
673
|
-
expiresInSeconds?: number;
|
|
674
|
-
accessToken: string;
|
|
675
|
-
};
|
|
676
|
-
declare type AwsAlbProviderOptions = {
|
|
677
|
-
/**
|
|
678
|
-
* The profile transformation function used to verify and convert the auth response
|
|
679
|
-
* into the profile that will be presented to the user.
|
|
680
|
-
*/
|
|
681
|
-
authHandler?: AuthHandler<AwsAlbResult>;
|
|
682
|
-
/**
|
|
683
|
-
* Configure sign-in for this provider, without it the provider can not be used to sign users in.
|
|
684
|
-
*/
|
|
685
|
-
signIn: {
|
|
686
|
-
/**
|
|
687
|
-
* Maps an auth result to a Backstage identity for the user.
|
|
688
|
-
*/
|
|
689
|
-
resolver: SignInResolver<AwsAlbResult>;
|
|
690
|
-
};
|
|
691
|
-
};
|
|
692
|
-
declare const createAwsAlbProvider: (options?: AwsAlbProviderOptions | undefined) => AuthProviderFactory;
|
|
819
|
+
/** @public */
|
|
820
|
+
declare const createOneLoginProvider: (options?: OneLoginProviderOptions | undefined) => AuthProviderFactory;
|
|
693
821
|
|
|
694
822
|
/** @public */
|
|
695
823
|
declare type SamlAuthResult = {
|
|
@@ -719,6 +847,13 @@ declare const factories: {
|
|
|
719
847
|
[providerId: string]: AuthProviderFactory;
|
|
720
848
|
};
|
|
721
849
|
|
|
850
|
+
/**
|
|
851
|
+
* Parses token and decorates the BackstageIdentityResponse with identity information sourced from the token
|
|
852
|
+
*
|
|
853
|
+
* @public
|
|
854
|
+
*/
|
|
855
|
+
declare function prepareBackstageIdentityResponse(result: BackstageSignInResult): BackstageIdentityResponse;
|
|
856
|
+
|
|
722
857
|
declare type ProviderFactories = {
|
|
723
858
|
[s: string]: AuthProviderFactory;
|
|
724
859
|
};
|
|
@@ -729,7 +864,7 @@ interface RouterOptions {
|
|
|
729
864
|
discovery: PluginEndpointDiscovery;
|
|
730
865
|
providerFactories?: ProviderFactories;
|
|
731
866
|
}
|
|
732
|
-
declare function createRouter(
|
|
867
|
+
declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
|
733
868
|
declare function createOriginFilter(config: Config): (origin: string) => boolean;
|
|
734
869
|
|
|
735
870
|
/**
|
|
@@ -747,4 +882,4 @@ declare type WebMessageResponse = {
|
|
|
747
882
|
declare const postMessageResponse: (res: express.Response, appOrigin: string, response: WebMessageResponse) => void;
|
|
748
883
|
declare const ensuresXRequestedWith: (req: express.Request) => boolean;
|
|
749
884
|
|
|
750
|
-
export { AtlassianAuthProvider, AtlassianProviderOptions, AuthProviderFactory, AuthProviderFactoryOptions, AuthProviderRouteHandlers, AuthResponse, AwsAlbProviderOptions, BackstageIdentity, BitbucketOAuthResult, BitbucketPassportProfile, BitbucketProviderOptions, CatalogIdentityClient, GithubOAuthResult, GithubProviderOptions, GitlabProviderOptions, GoogleProviderOptions, IdentityClient, MicrosoftProviderOptions, OAuth2ProviderOptions, OAuthAdapter, OAuthEnvironmentHandler, OAuthHandlers, OAuthProviderInfo, OAuthProviderOptions, OAuthRefreshRequest, OAuthResponse, OAuthResult, OAuthStartRequest, OAuthState, OktaProviderOptions, ProfileInfo, RouterOptions, SamlAuthResult, SamlProviderOptions, 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, readState, verifyNonce };
|
|
885
|
+
export { AtlassianAuthProvider, AtlassianProviderOptions, Auth0ProviderOptions, 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, OneLoginProviderOptions, ProfileInfo, RouterOptions, SamlAuthResult, SamlProviderOptions, SignInInfo, SignInResolver, TokenIssuer, WebMessageResponse, bitbucketUserIdSignInResolver, bitbucketUsernameSignInResolver, createAtlassianProvider, createAuth0Provider, createAwsAlbProvider, createBitbucketProvider, createGithubProvider, createGitlabProvider, createGoogleProvider, createMicrosoftProvider, createOAuth2Provider, createOidcProvider, createOktaProvider, createOneLoginProvider, createOriginFilter, createRouter, createSamlProvider, factories as defaultAuthProviderFactories, encodeState, ensuresXRequestedWith, getEntityClaims, googleEmailSignInResolver, microsoftEmailSignInResolver, oktaEmailSignInResolver, postMessageResponse, prepareBackstageIdentityResponse, readState, verifyNonce };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-auth-backend",
|
|
3
3
|
"description": "A Backstage backend plugin that handles authentication",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"clean": "backstage-cli clean"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@backstage/backend-common": "^0.
|
|
34
|
-
"@backstage/catalog-client": "^0.5.
|
|
35
|
-
"@backstage/catalog-model": "^0.9.
|
|
33
|
+
"@backstage/backend-common": "^0.10.1",
|
|
34
|
+
"@backstage/catalog-client": "^0.5.3",
|
|
35
|
+
"@backstage/catalog-model": "^0.9.8",
|
|
36
36
|
"@backstage/config": "^0.1.11",
|
|
37
37
|
"@backstage/errors": "^0.1.5",
|
|
38
|
-
"@backstage/test-utils": "^0.1
|
|
38
|
+
"@backstage/test-utils": "^0.2.1",
|
|
39
39
|
"@google-cloud/firestore": "^4.15.1",
|
|
40
40
|
"@types/express": "^4.17.6",
|
|
41
41
|
"@types/passport": "^1.0.3",
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"express-promise-router": "^4.1.0",
|
|
47
47
|
"express-session": "^1.17.1",
|
|
48
48
|
"fs-extra": "9.1.0",
|
|
49
|
-
"got": "^11.5.2",
|
|
50
49
|
"helmet": "^4.0.0",
|
|
51
50
|
"jose": "^1.27.1",
|
|
52
51
|
"jwt-decode": "^3.1.0",
|
|
@@ -73,7 +72,7 @@
|
|
|
73
72
|
"yn": "^4.0.0"
|
|
74
73
|
},
|
|
75
74
|
"devDependencies": {
|
|
76
|
-
"@backstage/cli": "^0.10.
|
|
75
|
+
"@backstage/cli": "^0.10.4",
|
|
77
76
|
"@types/body-parser": "^1.19.0",
|
|
78
77
|
"@types/cookie-parser": "^1.4.2",
|
|
79
78
|
"@types/express-session": "^1.17.2",
|
|
@@ -92,5 +91,5 @@
|
|
|
92
91
|
"config.d.ts"
|
|
93
92
|
],
|
|
94
93
|
"configSchema": "config.d.ts",
|
|
95
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "4b2a8ed96ff427735c872a72c1864321ef698436"
|
|
96
95
|
}
|