-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Stefan Pfeiffer opened SPR-15088 and commented
Following up to #19587 discussion, the example given in the Reference URL (after accepting my PR) demonstrates a problem with DefaultRedirectStrategy
in conjunction with ForwardedHeaderFilter
when DefaultRedirectStrategy.sendRedirect(request, response, url)
gets a relative URL in the url
parameter. Both add the context path to the URL. LoginUrlAuthenticationEntryPoint
feeds an absolute path to DefaultRedirectStrategy.sendRedirect
, so the example has to be faked to return a relative URL. I found the problem when using a SavedRequestAwareAuthenticationSuccessHandler
, when the savedRequest
is null
, which then returns a default redirect target of /
which ends up in DefaultRedirectStrategy.sendRedirect(…)
, triggering the double-context-path problem.
Nonetheless, DefaultRedirectStrategy.sendRedirect(…)
should be able to handle relative URLs.
Setting DefaultRedirectStrategy.setContextRelative(true)
should fix the problem, but i do not think that would be the right spot to prevent an interaction with the ForwardedHeaderFilter
somewhere in the filter chain?
Affects: 4.3.5
Reference URL: https://github.com/rwinch/spring-security-sample/tree/SPR-15020
Referenced from: commits df98d30, 523370b
1 votes, 4 watchers