Grails Spring Security - Always redirect to specific page after login?
grails, spring-security
Solution
Beyond setting the `defaultTargetUrl` you also need to tell Spring Security to force the use of that default target URL. Your `Config.groovy` should look something like this:
grails.plugins.springsecurity.successHandler.alwaysUseDefault = true
grails.plugins.springsecurity.successHandler.defaultTargetUrl = '/home'
You can research further options using the Spring Security API documentation for the SavedRequestAwareAuthenticationSuccessHandler, should you need them.
UPDATE: Later versions of the plugin use `grails.plugin` and not `grails.plugins`
Problem
I have a grails application that is using the spring security plugin for authentication. If my session expires, and I click a link in the application it takes me to the login screen then tries to redirect to the page I was on previously. I would like to configure spring security to always redirect to the home page instead of the last page the user clicked on. Is there a setting that controls this behavior?