diff --git a/plugins/auth-backend/src/providers/bitbucket/provider.test.ts b/plugins/auth-backend/src/providers/bitbucket/provider.test.ts index 7ab803243a..690729a5fb 100644 --- a/plugins/auth-backend/src/providers/bitbucket/provider.test.ts +++ b/plugins/auth-backend/src/providers/bitbucket/provider.test.ts @@ -14,9 +14,8 @@ * limitations under the License. */ -import { BitbucketAuthProvider } from './provider'; +import { BitbucketAuthProvider, BitbucketOAuthResult } from './provider'; import * as helpers from '../../lib/passport/PassportStrategyHelper'; -import { OAuthResult } from '../../lib/oauth'; import { getVoidLogger } from '@backstage/backend-common'; import { TokenIssuer } from '../../identity/types'; import { CatalogIdentityClient } from '../../lib/catalog'; @@ -25,7 +24,7 @@ const mockFrameHandler = jest.spyOn( helpers, 'executeFrameHandlerStrategy', ) as unknown as jest.MockedFunction< - () => Promise<{ result: OAuthResult; privateInfo: any }> + () => Promise<{ result: BitbucketOAuthResult; privateInfo: any }> >; describe('createBitbucketProvider', () => { @@ -58,6 +57,13 @@ describe('createBitbucketProvider', () => { mockFrameHandler.mockResolvedValueOnce({ result: { fullProfile: { + _json: { + links: { + avatar: { + href: 'https://a1cf74336522e87f135f-2f21ace9a6cf0052456644b80fa06d4f.ssl.cf2.rackcdn.com/images/characters_opt/p-mystic-river-sean-penn.jpg', + }, + }, + }, emails: [{ value: 'conrad@example.com' }], displayName: 'Conrad', id: 'conrad', diff --git a/plugins/auth-backend/src/providers/bitbucket/provider.ts b/plugins/auth-backend/src/providers/bitbucket/provider.ts index 81dddba5d0..7f27e64fee 100644 --- a/plugins/auth-backend/src/providers/bitbucket/provider.ts +++ b/plugins/auth-backend/src/providers/bitbucket/provider.ts @@ -53,7 +53,7 @@ type PrivateInfo = { type Options = OAuthProviderOptions & { signInResolver?: SignInResolver; - authHandler: AuthHandler; + authHandler: AuthHandler; tokenIssuer: TokenIssuer; catalogIdentityClient: CatalogIdentityClient; logger: Logger; @@ -213,7 +213,7 @@ export const bitbucketEmailSignInResolver: SignInResolver = async ( const entity = await ctx.catalogIdentityClient.findUser({ annotations: { - 'bitbucket/email': profile.email, + 'bitbucket.org/email': profile.email, }, }); @@ -248,11 +248,11 @@ export type BitbucketProviderOptions = { /** * Configure sign-in for this provider, without it the provider can not be used to sign users in. */ - signIn?: { + signIn: { /** * Maps an auth result to a Backstage identity for the user. */ - resolver?: SignInResolver; + resolver: SignInResolver; }; };