Spring Security Login Redirection
The redirection after logged in can be controlled in application.groovy
by adding the URL-related properties there. For more details, go see the chapter URL Properties
in the Grails Spring Security Core Plugin Documentation.
Always Redirect to a Default Path
The following example redirect to / after logged in.
grails.plugin.springsecurity.syccessHandler.defaultTargetUrl = "/" grails.plugin.springsecurity.syccessHandler.alwaysUseDefault= true
Redirect to the Originally-Requested Path
For some page that required user to be logged in before it is able to access, it will redirect user to the login page. After user logged in, we might want the user to redirect that originally-requested page. (This is actually the default behavior of Grails Spring Security Plugin 3.2.3)
grails.plugin.springsecurity.syccessHandler.alwaysUseDefault= false
Redirect to a Path if Login Failed
The following example redirect to /home/fail after login failed.
grails.plugin.springsecurity.failureHandler.defaultFailureUrl = "/home/fail"
Redirect to a Path After Logout
The following example redirect to /home/logout after logged in.
grails.plugin.springsecurity.logout.afterLogoutUrl = "/home/logout"