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

It is not possible to use referer as redirection location using SavedRequestAwareAuthenticationSuccessHandler #7445

Open
Antoniossss opened this issue Sep 17, 2019 · 0 comments
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@Antoniossss
Copy link

Antoniossss commented Sep 17, 2019

Summary

Current implementation by any means does not allow to use referer as redirection url despite extending AbstractAuthenticationTargetUrlRequestHandler which allows that and exposes propert setter useReferer(true).

Actual Behavior

Exposed useReferer setter has no effect.

Expected Behavior

Use referrer as redirection location if useReferer(true) is set and proper header is present in the original request.

Version

<spring-security.version>5.0.10.RELEASE</spring-security.version>

Sample

This example shows badly written (trial and error yet) workaround implementation

Will add working workaround

This is done to affect following check inside SavedRequestAwareAuthenticationSuccessHandler

String targetUrlParameter = getTargetUrlParameter();
if (isAlwaysUseDefaultTargetUrl()
|| (targetUrlParameter != null && StringUtils.hasText(request
.getParameter(targetUrlParameter)))) {
requestCache.removeRequest(request, response);
super.onAuthenticationSuccess(request, response, authentication);
return;

In general, if isAlwaysUseDefaultTargetUrl - default target will be used even if not specified. If targetUrl parameter is set and present - it will be used. There is no other path to access .superOnAuthenticationSuccess to get referer working having saver request - and this is my goal

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

2 participants