feat: add common signIn resolver to more provider

- `providers.microsoft.resolvers.emailLocalPartMatchingUserEntityName()`
- `providers.okta.resolvers.emailLocalPartMatchingUserEntityName()`

Signed-off-by: Patrick Jungermann <Patrick.Jungermann@gmail.com>
This commit is contained in:
Patrick Jungermann
2022-04-21 16:19:00 +02:00
parent 7af4ce3d25
commit 787ae0d541
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.
*/