From 30c28ee83f610697bb539b41f7b8d88d498330b1 Mon Sep 17 00:00:00 2001 From: Chaitanya Potti Date: Fri, 27 Sep 2024 13:11:42 +0800 Subject: [PATCH] restrict passkeys, authenticator login methods --- packages/ui/src/components/SocialLogins.tsx | 2 ++ packages/ui/src/config.ts | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/components/SocialLogins.tsx b/packages/ui/src/components/SocialLogins.tsx index bf1d5ee76..b538930b2 100644 --- a/packages/ui/src/components/SocialLogins.tsx +++ b/packages/ui/src/components/SocialLogins.tsx @@ -68,6 +68,8 @@ export default function SocialLogins(props: SocialLoginProps) { LOGIN_PROVIDER.JWT, LOGIN_PROVIDER.SMS_PASSWORDLESS, LOGIN_PROVIDER.EMAIL_PASSWORDLESS, + LOGIN_PROVIDER.AUTHENTICATOR, + LOGIN_PROVIDER.PASSKEYS, ]; return ( diff --git a/packages/ui/src/config.ts b/packages/ui/src/config.ts index 3e178900e..6f6ca8f03 100644 --- a/packages/ui/src/config.ts +++ b/packages/ui/src/config.ts @@ -4,7 +4,13 @@ export function capitalizeFirstLetter(string: string): string { return string.charAt(0).toUpperCase() + string.slice(1); } -export const AUTH_PROVIDERS = Object.values(LOGIN_PROVIDER).filter((x) => x !== LOGIN_PROVIDER.WEBAUTHN && x !== LOGIN_PROVIDER.JWT); +const restrictedLoginMethods: Set = new Set([ + LOGIN_PROVIDER.AUTHENTICATOR, + LOGIN_PROVIDER.PASSKEYS, + LOGIN_PROVIDER.JWT, + LOGIN_PROVIDER.WEBAUTHN, +]); +export const AUTH_PROVIDERS = Object.values(LOGIN_PROVIDER).filter((x) => !restrictedLoginMethods.has(x)); export const AUTH_PROVIDERS_NAMES = AUTH_PROVIDERS.reduce( (acc, x) => {