From ce038268c196af2b21c48ba73cc7ce7311f740fd Mon Sep 17 00:00:00 2001 From: Daniel Deloff <44780793+rv-ddeloff@users.noreply.github.com> Date: Wed, 20 Oct 2021 17:15:00 -0400 Subject: [PATCH] feedback fixes Signed-off-by: Daniel Deloff <44780793+rv-ddeloff@users.noreply.github.com> --- plugins/auth-backend/api-report.md | 15 +++++++++++--- .../src/providers/atlassian/index.ts | 5 ++++- .../src/providers/atlassian/provider.ts | 20 ++----------------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/plugins/auth-backend/api-report.md b/plugins/auth-backend/api-report.md index ed0647ecda..dfccd2b5d6 100644 --- a/plugins/auth-backend/api-report.md +++ b/plugins/auth-backend/api-report.md @@ -35,6 +35,16 @@ export class AtlassianAuthProvider implements OAuthHandlers { start(req: OAuthStartRequest): Promise; } +// Warning: (ae-missing-release-tag) "AtlassianProviderOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type AtlassianProviderOptions = { + authHandler?: AuthHandler; + signIn?: { + resolver: SignInResolver; + }; +}; + // Warning: (ae-missing-release-tag) "AuthProviderFactory" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) @@ -165,7 +175,6 @@ export const bitbucketUserIdSignInResolver: SignInResolver // @public (undocumented) export const bitbucketUsernameSignInResolver: SignInResolver; -// Warning: (ae-forgotten-export) The symbol "AtlassianProviderOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "createAtlassianProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) @@ -570,9 +579,9 @@ export type WebMessageResponse = // // src/identity/types.d.ts:25:5 - (ae-forgotten-export) The symbol "TokenParams" needs to be exported by the entry point index.d.ts // src/identity/types.d.ts:31:9 - (ae-forgotten-export) The symbol "AnyJWK" needs to be exported by the entry point index.d.ts -// src/providers/aws-alb/provider.d.ts:77:5 - (ae-forgotten-export) The symbol "AuthHandler" needs to be exported by the entry point index.d.ts +// src/providers/atlassian/provider.d.ts:38:5 - (ae-forgotten-export) The symbol "AuthHandler" needs to be exported by the entry point index.d.ts +// src/providers/atlassian/provider.d.ts:43:9 - (ae-forgotten-export) The symbol "SignInResolver" needs to be exported by the entry point index.d.ts // src/providers/aws-alb/provider.d.ts:77:5 - (ae-forgotten-export) The symbol "AwsAlbResult" needs to be exported by the entry point index.d.ts -// src/providers/aws-alb/provider.d.ts:85:9 - (ae-forgotten-export) The symbol "SignInResolver" needs to be exported by the entry point index.d.ts // src/providers/types.d.ts:99:5 - (ae-forgotten-export) The symbol "AuthProviderConfig" needs to be exported by the entry point index.d.ts // src/providers/types.d.ts:121:8 - (tsdoc-missing-deprecation-message) The @deprecated block must include a deprecation message, e.g. describing the recommended alternative ``` diff --git a/plugins/auth-backend/src/providers/atlassian/index.ts b/plugins/auth-backend/src/providers/atlassian/index.ts index b99b63d7bc..cf3eb901d9 100644 --- a/plugins/auth-backend/src/providers/atlassian/index.ts +++ b/plugins/auth-backend/src/providers/atlassian/index.ts @@ -15,4 +15,7 @@ */ export { createAtlassianProvider } from './provider'; -export type { AtlassianAuthProvider } from './provider'; +export type { + AtlassianAuthProvider, + AtlassianProviderOptions, +} from './provider'; diff --git a/plugins/auth-backend/src/providers/atlassian/provider.ts b/plugins/auth-backend/src/providers/atlassian/provider.ts index 4c031cedc9..f9b4b07715 100644 --- a/plugins/auth-backend/src/providers/atlassian/provider.ts +++ b/plugins/auth-backend/src/providers/atlassian/provider.ts @@ -204,14 +204,8 @@ export type AtlassianProviderOptions = { /** * Configure sign-in for this provider, without it the provider can not be used to sign users in. */ - /** - * Maps an auth result to a Backstage identity for the user. - * - * Set to `'email'` to use the default email-based sign in resolver, which will search - * the catalog for a single user entity that has a matching `microsoft.com/email` annotation. - */ signIn?: { - resolver?: SignInResolver; + resolver: SignInResolver; }; }; @@ -240,23 +234,13 @@ export const createAtlassianProvider = ( const authHandler: AuthHandler = options?.authHandler ?? atlassianDefaultAuthHandler; - const signInResolverFn = - options?.signIn?.resolver ?? atlassianDefaultSignInResolver; - - const signInResolver: SignInResolver = info => - signInResolverFn(info, { - catalogIdentityClient, - tokenIssuer, - logger, - }); - const provider = new AtlassianAuthProvider({ clientId, clientSecret, scopes, callbackUrl, authHandler, - signInResolver, + signInResolver: options?.signIn?.resolver, catalogIdentityClient, logger, tokenIssuer,