Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEN-1578: SAML redirect leads to 404 page on UI #17978

Merged
merged 7 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import AppContainer from '../AppContainer/AppContainer';
import Loader from '../common/Loader/Loader';
import { UnAuthenticatedAppRouter } from './UnAuthenticatedAppRouter';

import SamlCallback from '../../pages/SamlCallback';

const AppRouter = () => {
const location = useCustomLocation();

Expand Down Expand Up @@ -92,6 +94,14 @@ const AppRouter = () => {
<Route exact component={SignUpPage} path={ROUTES.SIGNUP}>
{!isEmpty(currentUser) && <Redirect to={ROUTES.HOME} />}
</Route>

{/* When authenticating from an SSO provider page (e.g., SAML Apps), if the user is already logged in,
the callbacks should be available. This ensures consistent behavior across different authentication scenarios. */}
<Route
component={SamlCallback}
path={[ROUTES.SAML_CALLBACK, ROUTES.AUTH_CALLBACK]}
/>

{isAuthenticated ? <AppContainer /> : <UnAuthenticatedAppRouter />}
</Switch>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { AuthProvider } from '../../generated/configuration/authenticationConfig
import { useApplicationStore } from '../../hooks/useApplicationStore';
import useCustomLocation from '../../hooks/useCustomLocation/useCustomLocation';
import PageNotFound from '../../pages/PageNotFound/PageNotFound';
import SamlCallback from '../../pages/SamlCallback';
import AccountActivationConfirmation from '../../pages/SignUp/account-activation-confirmation.component';
import { isProtectedRoute } from '../../utils/AuthProvider.util';
import Auth0Callback from '../Auth/AppCallbacks/Auth0Callback/Auth0Callback';
Expand Down Expand Up @@ -76,10 +75,7 @@ export const UnAuthenticatedAppRouter = () => {
{callbackComponent && (
<Route component={callbackComponent} path={ROUTES.CALLBACK} />
)}
<Route
component={SamlCallback}
path={[ROUTES.SAML_CALLBACK, ROUTES.AUTH_CALLBACK]}
/>

{!isSigningUp && (
<Route exact path={ROUTES.HOME}>
<Redirect to={ROUTES.SIGNIN} />
Expand Down
Loading