Merge pull request #11005 from Bonial-International-GmbH/PJ_resolvers

feat: add common signIn resolver to more provider
This commit is contained in:
Johan Haals
2022-04-22 10:23:36 +02:00
committed by GitHub
4 changed files with 20 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
---
'@backstage/plugin-auth-backend': patch
---
Add common signIn resolver to more providers.
- `providers.microsoft.resolvers.emailLocalPartMatchingUserEntityName()`
- `providers.okta.resolvers.emailLocalPartMatchingUserEntityName()`
+2
View File
@@ -889,6 +889,7 @@ export const providers: Readonly<{
| undefined,
) => AuthProviderFactory;
resolvers: Readonly<{
emailLocalPartMatchingUserEntityName: () => SignInResolver<unknown>;
emailMatchingUserEntityAnnotation(): SignInResolver<OAuthResult>;
}>;
}>;
@@ -945,6 +946,7 @@ export const providers: Readonly<{
| undefined,
) => AuthProviderFactory;
resolvers: Readonly<{
emailLocalPartMatchingUserEntityName: () => SignInResolver<unknown>;
emailMatchingUserEntityAnnotation(): SignInResolver<OAuthResult>;
}>;
}>;
@@ -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.
*/
@@ -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.
*/