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.
This commit is contained in:
Shekar Siri 2025-03-27 12:26:19 +01:00
parent 5ab30380b0
commit bb423a2481
2 changed files with 8 additions and 6 deletions

View file

@ -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) => {
<Tooltip
title={
<div className="text-center">
{isEnterprise ? (
{isSSOSupported ? (
<span>
{t('SSO has not been configured.')}
<br />

View file

@ -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);
}