@backstage/plugin-auth-backend 0.0.0-nightly-2022122206 → 0.0.0-nightly-20220210021913
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 +49 -1
- package/dist/index.cjs.js +135 -83
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +26 -4
- package/migrations/20210326100300_timestamptz.js +2 -2
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -103,6 +103,7 @@ declare type OAuthState = {
|
|
|
103
103
|
nonce: string;
|
|
104
104
|
env: string;
|
|
105
105
|
origin?: string;
|
|
106
|
+
scope?: string;
|
|
106
107
|
};
|
|
107
108
|
declare type OAuthStartRequest = express.Request<{}> & {
|
|
108
109
|
scope: string;
|
|
@@ -232,6 +233,22 @@ declare type AuthResolverContext = {
|
|
|
232
233
|
catalogIdentityClient: CatalogIdentityClient;
|
|
233
234
|
logger: Logger;
|
|
234
235
|
};
|
|
236
|
+
/**
|
|
237
|
+
* The callback used to resolve the cookie configuration for auth providers that use cookies.
|
|
238
|
+
* @public
|
|
239
|
+
*/
|
|
240
|
+
declare type CookieConfigurer = (ctx: {
|
|
241
|
+
/** ID of the auth provider that this configuration applies to */
|
|
242
|
+
providerId: string;
|
|
243
|
+
/** The externally reachable base URL of the auth-backend plugin */
|
|
244
|
+
baseUrl: string;
|
|
245
|
+
/** The configured callback URL of the auth provider */
|
|
246
|
+
callbackUrl: string;
|
|
247
|
+
}) => {
|
|
248
|
+
domain: string;
|
|
249
|
+
path: string;
|
|
250
|
+
secure: boolean;
|
|
251
|
+
};
|
|
235
252
|
declare type AuthProviderConfig = {
|
|
236
253
|
/**
|
|
237
254
|
* The protocol://domain[:port] where the app is hosted. This is used to construct the
|
|
@@ -246,6 +263,10 @@ declare type AuthProviderConfig = {
|
|
|
246
263
|
* A function that is called to check whether an origin is allowed to receive the authentication result.
|
|
247
264
|
*/
|
|
248
265
|
isOriginAllowed: (origin: string) => boolean;
|
|
266
|
+
/**
|
|
267
|
+
* The function used to resolve cookie configuration based on the auth provider options.
|
|
268
|
+
*/
|
|
269
|
+
cookieConfigurer?: CookieConfigurer;
|
|
249
270
|
};
|
|
250
271
|
declare type RedirectInfo = {
|
|
251
272
|
/**
|
|
@@ -492,12 +513,13 @@ declare type Options = {
|
|
|
492
513
|
appOrigin: string;
|
|
493
514
|
tokenIssuer: TokenIssuer;
|
|
494
515
|
isOriginAllowed: (origin: string) => boolean;
|
|
495
|
-
callbackUrl
|
|
516
|
+
callbackUrl: string;
|
|
496
517
|
};
|
|
497
518
|
declare class OAuthAdapter implements AuthProviderRouteHandlers {
|
|
498
519
|
private readonly handlers;
|
|
499
520
|
private readonly options;
|
|
500
521
|
static fromConfig(config: AuthProviderConfig, handlers: OAuthHandlers, options: Pick<Options, 'providerId' | 'persistScopes' | 'disableRefresh' | 'tokenIssuer' | 'callbackUrl'>): OAuthAdapter;
|
|
522
|
+
private readonly baseCookieOptions;
|
|
501
523
|
constructor(handlers: OAuthHandlers, options: Options);
|
|
502
524
|
start(req: express.Request, res: express.Response): Promise<void>;
|
|
503
525
|
frameHandler(req: express.Request, res: express.Response): Promise<void>;
|
|
@@ -509,8 +531,8 @@ declare class OAuthAdapter implements AuthProviderRouteHandlers {
|
|
|
509
531
|
*/
|
|
510
532
|
private populateIdentity;
|
|
511
533
|
private setNonceCookie;
|
|
512
|
-
private
|
|
513
|
-
private
|
|
534
|
+
private setGrantedScopeCookie;
|
|
535
|
+
private getGrantedScopeFromCookie;
|
|
514
536
|
private setRefreshTokenCookie;
|
|
515
537
|
private removeRefreshTokenCookie;
|
|
516
538
|
}
|
|
@@ -997,4 +1019,4 @@ declare type WebMessageResponse = {
|
|
|
997
1019
|
declare const postMessageResponse: (res: express.Response, appOrigin: string, response: WebMessageResponse) => void;
|
|
998
1020
|
declare const ensuresXRequestedWith: (req: express.Request) => boolean;
|
|
999
1021
|
|
|
1000
|
-
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 };
|
|
1022
|
+
export { AtlassianAuthProvider, AtlassianProviderOptions, Auth0ProviderOptions, AuthHandler, AuthHandlerResult, AuthProviderFactory, AuthProviderFactoryOptions, AuthProviderRouteHandlers, AuthResolverContext, AuthResponse, AwsAlbProviderOptions, BackstageIdentity, BackstageIdentityResponse, BackstageSignInResult, BackstageUserIdentity, BitbucketOAuthResult, BitbucketPassportProfile, BitbucketProviderOptions, CatalogIdentityClient, CookieConfigurer, 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 };
|
|
@@ -28,7 +28,7 @@ exports.up = async function up(knex) {
|
|
|
28
28
|
.notNullable()
|
|
29
29
|
.defaultTo(knex.fn.now())
|
|
30
30
|
.comment('The creation time of the key')
|
|
31
|
-
.alter();
|
|
31
|
+
.alter({ alterType: true });
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
};
|
|
@@ -45,7 +45,7 @@ exports.down = async function down(knex) {
|
|
|
45
45
|
.notNullable()
|
|
46
46
|
.defaultTo(knex.fn.now())
|
|
47
47
|
.comment('The creation time of the key')
|
|
48
|
-
.alter();
|
|
48
|
+
.alter({ alterType: true });
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
};
|
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.0.0-nightly-
|
|
4
|
+
"version": "0.0.0-nightly-20220210021913",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"clean": "backstage-cli clean"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@backstage/backend-common": "^0.
|
|
33
|
+
"@backstage/backend-common": "^0.0.0-nightly-20220210021913",
|
|
34
34
|
"@backstage/catalog-client": "^0.5.5",
|
|
35
35
|
"@backstage/catalog-model": "^0.9.10",
|
|
36
36
|
"@backstage/config": "^0.1.13",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"helmet": "^4.0.0",
|
|
51
51
|
"jose": "^1.27.1",
|
|
52
52
|
"jwt-decode": "^3.1.0",
|
|
53
|
-
"knex": "^0.
|
|
53
|
+
"knex": "^1.0.2",
|
|
54
54
|
"lodash": "^4.17.21",
|
|
55
55
|
"luxon": "^2.0.2",
|
|
56
56
|
"minimatch": "^3.0.3",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"yn": "^4.0.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@backstage/cli": "^0.0.0-nightly-
|
|
77
|
-
"@backstage/test-utils": "^0.2.
|
|
76
|
+
"@backstage/cli": "^0.0.0-nightly-20220210021913",
|
|
77
|
+
"@backstage/test-utils": "^0.2.4",
|
|
78
78
|
"@types/body-parser": "^1.19.0",
|
|
79
79
|
"@types/cookie-parser": "^1.4.2",
|
|
80
80
|
"@types/express-session": "^1.17.2",
|