Monday, 14 May 2012

Grails - directing user to different auth pages

I'm using the Spring security plugin (which uses Spring Security 3.x), and figured out how one would show different auth pages based on the success redirection url:

           SavedRequest savedRequest = 
                     new HttpSessionRequestCache().getRequest(request, response); 
           String requestUrl = savedRequest.getRequestURL(); 
           String view = requestUrl.contains("business") ? 'auth-business' : 'auth' 


Here we are getting the SaveRequest object from the HttpSessionRequestCache(), which is a little different from how you would do it in Spring Security 2.x.

Enjoy!

No comments:

Post a Comment