Grails Spring Security redirection after a wait session

I have a problem with the session timeout. In my grails application, the user logs in after the session timeout, but then goes to the last edited page. I want to prevent this and send them to a specific url. How can I achieve this, I cannot find something in the spring security documentation.

Hey.

+3
spring-security grails session-timeout
source share
2 answers

In docs, it looks like you can use a combination of

successHandler.defaultTargetUrl="/whatever/url/you/want" successHandler.alwaysUseDefault=true 
+2
source share

By default, spring security will send the original request after a successful login. This can be prevented by adding the following to Config.groovy :

 grails.plugins.springsecurity.successHandler.alwaysUseDefault = true grails.plugins.springsecurity.successHandler.alwaysUseDefaultTargetUrl = true grails.plugins.springsecurity.successHandler.defaultTargetUrl = '/my/default/url' 

Two properties sound as if they should do the same, but in my case it only works when I have both. Perhaps you can remove one of them and make it work ...

This will change the behavior at every login, not just after a timeout. If you need a more dynamic solution, I think you need to insert spring into the security source code ...

+1
source share

All Articles