diff --git a/openmetadata-ui/src/main/resources/ui/src/router/AppRouter.tsx b/openmetadata-ui/src/main/resources/ui/src/router/AppRouter.tsx index ada8f6be0f8..e301aa48b12 100644 --- a/openmetadata-ui/src/main/resources/ui/src/router/AppRouter.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/router/AppRouter.tsx @@ -23,6 +23,7 @@ import SlackChat from '../components/SlackChat/SlackChat'; import { ROUTES } from '../constants/constants'; import { AuthTypes } from '../enums/signin.enum'; import AccountActivationConfirmation from '../pages/signup/account-activation-confirmation.component'; +import { isProtectedRoute } from '../utils/AuthProvider.util'; import withSuspenseFallback from './withSuspenseFallback'; const AuthenticatedAppRouter = withSuspenseFallback( @@ -55,7 +56,6 @@ const AppRouter = () => { const { authConfig, - isAuthDisabled, isAuthenticated, loading, isSigningIn, @@ -72,6 +72,11 @@ const AppRouter = () => { const isOidcProvider = authConfig?.provider && oidcProviders.includes(authConfig.provider); + const isBasicAuthProvider = + authConfig && + (authConfig.provider === AuthTypes.BASIC || + authConfig.provider === AuthTypes.LDAP); + const fetchSlackChatConfig = () => { fetchSlackConfig() .then((res) => { @@ -114,95 +119,60 @@ const AppRouter = () => { } }, [location.pathname]); - return loading ? ( - - ) : ( - <> - {isOidcProvider || isAuthenticated ? ( - <> - - {slackChat} - - ) : ( - <> - {slackChat} - - + if (loading) { + return ; + } - {callbackComponent ? ( - - ) : null} - - {!isAuthDisabled && !isAuthenticated && !isSigningIn ? ( - <> - - - - - - ) : ( - - )} - - {!isSigningIn ? ( - <> - - - - - - ) : null} - {isAuthDisabled || isAuthenticated ? ( - - ) : ( - <> - - - - - - )} - - + if (!isAuthenticated && isProtectedRoute(location.pathname)) { + return ; + } + + if (isOidcProvider || isAuthenticated) { + return ( + <> + + {slackChat} + + ); + } + + return ( + + {slackChat} + + {callbackComponent ? ( + + ) : null} + + + {!isAuthenticated && !isSigningIn ? ( + <> + + + ) : ( + + )} + + + {isBasicAuthProvider && ( + <> + + + + )} - + {isAuthenticated && } + + ); };