diff --git a/.changeset/strong-mangos-sell.md b/.changeset/strong-mangos-sell.md new file mode 100644 index 0000000000..c70a917a4d --- /dev/null +++ b/.changeset/strong-mangos-sell.md @@ -0,0 +1,8 @@ +--- +'@backstage/plugin-auth-backend': patch +--- + +Add common signIn resolver to more providers. + +- `providers.microsoft.resolvers.emailLocalPartMatchingUserEntityName()` +- `providers.okta.resolvers.emailLocalPartMatchingUserEntityName()` diff --git a/plugins/auth-backend/api-report.md b/plugins/auth-backend/api-report.md index a01a309dd4..ae02e859a1 100644 --- a/plugins/auth-backend/api-report.md +++ b/plugins/auth-backend/api-report.md @@ -889,6 +889,7 @@ export const providers: Readonly<{ | undefined, ) => AuthProviderFactory; resolvers: Readonly<{ + emailLocalPartMatchingUserEntityName: () => SignInResolver; emailMatchingUserEntityAnnotation(): SignInResolver; }>; }>; @@ -945,6 +946,7 @@ export const providers: Readonly<{ | undefined, ) => AuthProviderFactory; resolvers: Readonly<{ + emailLocalPartMatchingUserEntityName: () => SignInResolver; emailMatchingUserEntityAnnotation(): SignInResolver; }>; }>; diff --git a/plugins/auth-backend/src/providers/microsoft/provider.ts b/plugins/auth-backend/src/providers/microsoft/provider.ts index 5b3e80e679..cc722ad4e5 100644 --- a/plugins/auth-backend/src/providers/microsoft/provider.ts +++ b/plugins/auth-backend/src/providers/microsoft/provider.ts @@ -43,6 +43,7 @@ import { AuthResolverContext, } from '../types'; import { createAuthProviderIntegration } from '../createAuthProviderIntegration'; +import { commonByEmailLocalPartResolver } from '../resolvers'; import { Logger } from 'winston'; import fetch from 'node-fetch'; @@ -270,6 +271,10 @@ export const microsoft = createAuthProviderIntegration({ }); }, resolvers: { + /** + * Looks up the user by matching their email local part to the entity name. + */ + emailLocalPartMatchingUserEntityName: () => commonByEmailLocalPartResolver, /** * Looks up the user by matching their email to the `microsoft.com/email` annotation. */ diff --git a/plugins/auth-backend/src/providers/okta/provider.ts b/plugins/auth-backend/src/providers/okta/provider.ts index b83e640731..0516b4415d 100644 --- a/plugins/auth-backend/src/providers/okta/provider.ts +++ b/plugins/auth-backend/src/providers/okta/provider.ts @@ -43,6 +43,7 @@ import { AuthResolverContext, } from '../types'; import { createAuthProviderIntegration } from '../createAuthProviderIntegration'; +import { commonByEmailLocalPartResolver } from '../resolvers'; import { StateStore } from 'passport-oauth2'; type PrivateInfo = { @@ -274,6 +275,10 @@ export const okta = createAuthProviderIntegration({ }); }, resolvers: { + /** + * Looks up the user by matching their email local part to the entity name. + */ + emailLocalPartMatchingUserEntityName: () => commonByEmailLocalPartResolver, /** * Looks up the user by matching their email to the `okta.com/email` annotation. */