Merge pull request #21968 from backstage/vinzscam/fix-okta-provider-missing-resolvers

auth-backend: add okta missing common resolvers
This commit is contained in:
Ben Lambert
2023-12-21 14:21:01 +01:00
committed by GitHub
3 changed files with 22 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-auth-backend': patch
---
Fixed an issue where some Okta's resolvers were missing
+2
View File
@@ -592,6 +592,8 @@ export const providers: Readonly<{
| undefined,
) => AuthProviderFactory_2;
resolvers: Readonly<{
emailLocalPartMatchingUserEntityName: () => SignInResolver<unknown>;
emailMatchingUserEntityProfileEmail: () => SignInResolver<unknown>;
emailMatchingUserEntityAnnotation(): SignInResolver<OAuthResult>;
}>;
}>;
@@ -24,6 +24,10 @@ import {
adaptLegacyOAuthSignInResolver,
} from '../../lib/legacy';
import { oktaAuthenticator } from '@backstage/plugin-auth-backend-module-okta-provider';
import {
commonByEmailLocalPartResolver,
commonByEmailResolver,
} from '../resolvers';
/**
* Auth provider integration for Okta auth
@@ -51,6 +55,17 @@ 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 entity email.
*/
emailMatchingUserEntityProfileEmail: () => commonByEmailResolver,
/**
* Looks up the user by matching their email to the `okta.com/email` annotation.
*/
emailMatchingUserEntityAnnotation(): SignInResolver<OAuthResult> {
return async (info, ctx) => {
const { profile } = info;