auth-backend: add okta missing common resolvers

Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2023-12-21 13:54:39 +01:00
parent d8c360ea42
commit 3f05bcb099
2 changed files with 17 additions and 0 deletions
+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;