Manual Redirect URL for Spring Security

We have several shopping cart pages that work with both guest and user paths. We want to allow the user to log in at any time during the process, but do not want to create another login page. I would prefer that we can simply redirect the user to an existing login and tell Spring about the security to which URL will return.

I know this happens automatically when the session timeout and / or protected pages are requested without a session, but is there a way I can provide the Spring Security URL myself?

+2
source share
1 answer

If you need a simple return URL to get the basket, then you are probably best off implementing this in AuthenticationSuccessHandler . You can look at the source for SimpleUrlAuthenticationSuccessHandler and its parent for inspiration.

The default login mechanism uses RequestCache and SavedRequest , but is designed to actually play back a request that would not otherwise be resolved. This is probably possible in your case.

+2
source

All Articles