Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Security: How to get the initial target url

I am using the spring security to restricted urls. I am trying to provide signup and login page, on the same page.

On login spring security transfers to the restricted page. However i am trying to pass the target url to the signup process, so that after signup we can redirect to the restricted page.

How to get the actual URL that user was redirected from.

Any Ideas?

like image 645
Spring Monkey Avatar asked Mar 10 '09 16:03

Spring Monkey


1 Answers

This is how i got the URL from the Spring Security.

SavedRequest savedRequest = (SavedRequest)session.getAttribute(
    AbstractProcessingFilter.SPRING_SECURITY_SAVED_REQUEST_KEY);
String requestUrl = savedRequest.getFullRequestUrl();
like image 92
Spring Monkey Avatar answered Oct 12 '22 18:10

Spring Monkey