Skip to content

honor redirect to SAML SSO path if user is already authenticated#50436

Merged
flyinghermit merged 8 commits intomasterfrom
sshah/redirect-on-saml-sso-path
Dec 20, 2024
Merged

honor redirect to SAML SSO path if user is already authenticated#50436
flyinghermit merged 8 commits intomasterfrom
sshah/redirect-on-saml-sso-path

Conversation

@flyinghermit
Copy link
Copy Markdown
Contributor

@flyinghermit flyinghermit commented Dec 19, 2024

In authenticated session, we always used to redirect to root path /web. This was done to prevent showing up Login form for users who are already authenticated but land on the https://proxy/web/login?redirect_uri=... path. This breaks SAML IdP service provider initiated SSO flow when user is already authenticated but is redirected to the root login page.

This PR updates such redirection behaviour in the UI so that if user has a valid web session, and the redirection path matches enterprise/saml-idp/sso path, the UI will honor the redirection to let user continue with SAML SSO. For non-matching path, the existing behavior of redirecting to the root /web path is preserved.

changelog: updates the UI login redirection service to honor redirection to enterprise/saml-idp/sso path even if user is already authenticated with Teleport.

@flyinghermit flyinghermit marked this pull request as ready for review December 19, 2024 16:56
@github-actions github-actions Bot requested review from avatus and kiosion December 19, 2024 16:57
@flyinghermit flyinghermit requested review from kimlisa and removed request for avatus and kiosion December 19, 2024 16:57
@flyinghermit flyinghermit changed the title Redirect if path is SAML IdP SSO path honor redirect to SAML SSO path if user is already authenticated Dec 19, 2024
expect(history.push).toHaveBeenCalledWith(samlIdPPath, true);
});

it('non-base domain redirects with base domain for a matching "/enterprise/saml-idp/sso"', async () => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We update any other domain to base domain. This test covers that scenario.

Though, this behavior does not sit well with me and I plan to do a followup on idea of rejecting non-base URL instead of replacing it with base URL.

Comment thread web/packages/teleport/src/Login/useLogin.test.tsx
Comment thread web/packages/teleport/src/Login/useLogin.ts
@flyinghermit flyinghermit added this pull request to the merge queue Dec 20, 2024
Merged via the queue into master with commit 8f91da0 Dec 20, 2024
@flyinghermit flyinghermit deleted the sshah/redirect-on-saml-sso-path branch December 20, 2024 15:29
@public-teleport-github-review-bot
Copy link
Copy Markdown

@flyinghermit See the table below for backport results.

Branch Result
branch/v15 Failed
branch/v16 Failed
branch/v17 Failed

carloscastrojumo pushed a commit to carloscastrojumo/teleport that referenced this pull request Feb 19, 2025
…vitational#50436)

* redirect if path is saml idp sso path

* fix test and add more tests

* add login component tests

* update test url path value

* update test var name

* rename non-base to base
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants