Repository navigation
Preserve deeplink target after SAML login - #356
Merged
Merged
Conversation
kayjoosten
force-pushed
the
issue-325-deeplink-preserve
branch
from
September 29, 2026 07:32
8a5cfe6 to
97a1cc2
Compare
# If applied, this commit will... Make the profile app redirect users back to the page they originally requested after logging in via SAML, instead of always sending them to the homepage. # Why is this change needed? Prior to this change, browsing to a specific page (e.g. /attribute-support) while unauthenticated, logging in via WAYF/the IdP, and returning through the SAML ACS endpoint always landed the user on "/" instead of the page they originally asked for. The SamlAuthenticator is registered in security.yaml as a Symfony "custom_authenticator" rather than through one of Symfony's built-in authenticator factories (e.g. form_login). Symfony only calls AuthenticationSuccessHandler::setFirewallName() automatically for its own built-in factories, so the firewall name was never set on our SuccessHandler. Without a firewall name, DefaultAuthenticationSuccessHandler is unable to look up the deeplink that was stored in the session before authentication started, and always falls back to the default target path. # How does it address the issue? This change explicitly configures the SuccessHandler service with the "saml_based" firewall name, so the URL that was stored in the session before login is used again as the post-login redirect target. Tests covering the wiring and the redirect behavior, with and without a stored deeplink, are included. # Provide links to any relevant tickets, articles or other resources #325
kayjoosten
force-pushed
the
issue-325-deeplink-preserve
branch
from
September 29, 2026 07:55
97a1cc2 to
b7c34fb
Compare
johanib
approved these changes
Oct 1, 2026
johanib
left a comment
Contributor
There was a problem hiding this comment.
👍 This might have been a regression from a previous symfony upgrade.
This inserts the missing piece in the chain. tested 💯
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Browsing to a specific page (e.g.
/attribute-support) while unauthenticated, logging in via WAYF/the IdP, and returning through the SAML ACS endpoint always landed the user on/instead of the page they originally asked for.Why
SamlAuthenticatoris registered insecurity.yamlas a Symfonycustom_authenticatorrather than through one of Symfony's built-in authenticator factories (e.g.form_login). Symfony only callsAuthenticationSuccessHandler::setFirewallName()automatically for its own built-in factories, so the firewall name was never set on ourSuccessHandler. Without a firewall name,DefaultAuthenticationSuccessHandlercan't look up the deeplink stored in the session before authentication started, and always falls back to the default target path (/).Fix
Explicitly configure the
SuccessHandlerservice with thesaml_basedfirewall name inconfig/services.yaml, restoring Symfony's normal deeplink-preservation behavior.Testing
Added
src/OpenConext/ProfileBundle/Tests/Security/SamlAuthenticationSuccessHandlerTest.php, which:saml_basedfirewall nameVerified these tests fail without the fix and pass with it. Ran the full
composer checksuite (composer-validate, phplint, phpmd, phpcs, license-headers, phpunit, phpstan) locally, all green.Closes #325