@backstage/plugin-auth-backend 0.5.0 → 0.5.1

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
@@ -419,6 +419,10 @@ declare type ProfileInfo = {
419
419
  */
420
420
  picture?: string;
421
421
  };
422
+ /**
423
+ * type of sign in information context, includes the profile information and authentication result which contains auth. related information
424
+ * @public
425
+ */
422
426
  declare type SignInInfo<AuthResult> = {
423
427
  /**
424
428
  * The simple profile passed down for use in the frontend.
@@ -429,11 +433,20 @@ declare type SignInInfo<AuthResult> = {
429
433
  */
430
434
  result: AuthResult;
431
435
  };
436
+ /**
437
+ * Sign in resolver type describes the function which handles the result of a successful authentication
438
+ * and it must return a valid {@link BackstageSignInResult}
439
+ * @public
440
+ */
432
441
  declare type SignInResolver<AuthResult> = (info: SignInInfo<AuthResult>, context: {
433
442
  tokenIssuer: TokenIssuer;
434
443
  catalogIdentityClient: CatalogIdentityClient;
435
444
  logger: Logger;
436
445
  }) => Promise<BackstageSignInResult>;
446
+ /**
447
+ * The return type of authentication handler which must contain a valid profile information
448
+ * @public
449
+ */
437
450
  declare type AuthHandlerResult = {
438
451
  profile: ProfileInfo;
439
452
  };
@@ -444,6 +457,8 @@ declare type AuthHandlerResult = {
444
457
  *
445
458
  * Throwing an error in the function will cause the authentication to fail, making it
446
459
  * possible to use this function as a way to limit access to a certain group of users.
460
+ *
461
+ * @public
447
462
  */
448
463
  declare type AuthHandler<AuthResult> = (input: AuthResult) => Promise<AuthHandlerResult>;
449
464
  declare type StateEncoder = (req: OAuthStartRequest) => Promise<{
@@ -610,14 +625,30 @@ declare type OAuth2ProviderOptions = {
610
625
  };
611
626
  declare const createOAuth2Provider: (options?: OAuth2ProviderOptions | undefined) => AuthProviderFactory;
612
627
 
613
- declare type AuthResult = {
628
+ /**
629
+ * authentication result for the OIDC which includes the token set and user information (a profile response sent by OIDC server)
630
+ * @public
631
+ */
632
+ declare type OidcAuthResult = {
614
633
  tokenset: TokenSet;
615
634
  userinfo: UserinfoResponse;
616
635
  };
636
+ /**
637
+ * OIDC provider callback options. An auth handler and a sign in resolver
638
+ * can be passed while creating a OIDC provider.
639
+ *
640
+ * authHandler : called after sign in was successful, a new object must be returned which includes a profile
641
+ * signInResolver: called after sign in was successful, expects to return a new {@link BackstageSignInResult}
642
+ *
643
+ * Both options are optional. There is fallback for authHandler where the default handler expect an e-mail explicitly
644
+ * otherwise it throws an error
645
+ *
646
+ * @public
647
+ */
617
648
  declare type OidcProviderOptions = {
618
- authHandler?: AuthHandler<AuthResult>;
649
+ authHandler?: AuthHandler<OidcAuthResult>;
619
650
  signIn?: {
620
- resolver?: SignInResolver<AuthResult>;
651
+ resolver?: SignInResolver<OidcAuthResult>;
621
652
  };
622
653
  };
623
654
  declare const createOidcProvider: (options?: OidcProviderOptions | undefined) => AuthProviderFactory;
@@ -809,4 +840,4 @@ declare type WebMessageResponse = {
809
840
  declare const postMessageResponse: (res: express.Response, appOrigin: string, response: WebMessageResponse) => void;
810
841
  declare const ensuresXRequestedWith: (req: express.Request) => boolean;
811
842
 
812
- export { AtlassianAuthProvider, AtlassianProviderOptions, 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, 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, prepareBackstageIdentityResponse, readState, verifyNonce };
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 };
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.5.0",
4
+ "version": "0.5.1",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -30,9 +30,9 @@
30
30
  "clean": "backstage-cli clean"
31
31
  },
32
32
  "dependencies": {
33
- "@backstage/backend-common": "^0.9.13",
33
+ "@backstage/backend-common": "^0.9.14",
34
34
  "@backstage/catalog-client": "^0.5.2",
35
- "@backstage/catalog-model": "^0.9.7",
35
+ "@backstage/catalog-model": "^0.9.8",
36
36
  "@backstage/config": "^0.1.11",
37
37
  "@backstage/errors": "^0.1.5",
38
38
  "@backstage/test-utils": "^0.1.24",
@@ -73,7 +73,7 @@
73
73
  "yn": "^4.0.0"
74
74
  },
75
75
  "devDependencies": {
76
- "@backstage/cli": "^0.10.1",
76
+ "@backstage/cli": "^0.10.2",
77
77
  "@types/body-parser": "^1.19.0",
78
78
  "@types/cookie-parser": "^1.4.2",
79
79
  "@types/express-session": "^1.17.2",
@@ -92,5 +92,5 @@
92
92
  "config.d.ts"
93
93
  ],
94
94
  "configSchema": "config.d.ts",
95
- "gitHead": "562be0b43016294e27af3ad024191bb86b13b1c1"
95
+ "gitHead": "9ff0f1e76d4510edda2f1b1b3e58cba168a76190"
96
96
  }