From 9f693f220d9b25f43f2a797daf2c20d5e3bba99a Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Thu, 27 Mar 2025 12:26:19 +0100 Subject: [PATCH] refactor(auth): separate SSO support from enterprise edition Add dedicated isSSOSupported property to correctly identify when SSO authentication is available, properly handling the 'msaas' edition case separately from enterprise edition checks. This fixes SSO visibility in the login interface. --- frontend/app/components/Login/SSOLogin.tsx | 6 +++--- frontend/app/mstore/userStore.ts | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/app/components/Login/SSOLogin.tsx b/frontend/app/components/Login/SSOLogin.tsx index 6e604913c..ca10dfdd0 100644 --- a/frontend/app/components/Login/SSOLogin.tsx +++ b/frontend/app/components/Login/SSOLogin.tsx @@ -14,7 +14,7 @@ interface SSOLoginProps { const SSOLogin = ({ authDetails, enforceSSO = false }: SSOLoginProps) => { const { userStore } = useStore(); const { t } = useTranslation(); - const { isEnterprise } = userStore; + const { isSSOSupported } = userStore; const getSSOLink = () => window !== window.top @@ -23,7 +23,7 @@ const SSOLogin = ({ authDetails, enforceSSO = false }: SSOLoginProps) => { const ssoLink = getSSOLink(); const ssoButtonText = `${t('Login with SSO')} ${authDetails.ssoProvider ? `(${authDetails.ssoProvider})` : '' - }`; + }`; if (enforceSSO) { return ( @@ -47,7 +47,7 @@ const SSOLogin = ({ authDetails, enforceSSO = false }: SSOLoginProps) => { - {isEnterprise ? ( + {isSSOSupported ? ( {t('SSO has not been configured.')}
diff --git a/frontend/app/mstore/userStore.ts b/frontend/app/mstore/userStore.ts index f29fcd325..3855ffd50 100644 --- a/frontend/app/mstore/userStore.ts +++ b/frontend/app/mstore/userStore.ts @@ -114,12 +114,14 @@ class UserStore { get isEnterprise() { return ( this.account?.edition === 'ee' || - this.account?.edition === 'msaas' || - this.authStore.authDetails?.edition === 'ee' || - this.authStore.authDetails?.edition === 'msaas' + this.authStore.authDetails?.edition === 'ee' ); } + get isSSOSupported() { + return this.isEnterprise || this.account?.edition === 'msaas' || this.authStore.authDetails?.edition === 'msaas'; + } + get isLoggedIn() { return Boolean(this.jwt); }