spring security core: 1.0.1
In DefaultSecurityConfig.groovy there is a ‘logout.afterLogoutUrl’ property that can be replaced in the Config.groovy. The use of that property (as it name described) : after logout it will be redirected to that url. I was thinking how if i want to redirected to specified url based on user’s role (dynamic url when logout) because in the project i’m in, i must redirect it to either this login page or that login page since there are 2 login page. After several googling (thanks to the google again), finally i found how to do it. we can use:
redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl + “?spring-security-redirect=/login1Page”
the code above will redirect us to the login1Page after we logout and if we want to pass parameter to that login1Page we can use:
redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl + “?spring-security-redirect=/login1Page?lang=en”
you just made my day with this post. I was searching for hours to solve this redirect problem after logout.
thanx for this post.
this only works for versions prior to 3.0.6 of spring-security-core, in which they fixed an exploit vector: https://jira.springsource.org/browse/SEC-1790
thanx man, i was stuck for two days before i stumble to your soln. Now it work like a charm…thank you