Grails redirection after logout

9 Jun

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”

Advertisement

2 Responses to “Grails redirection after logout”

  1. thmarxorsten October 6, 2011 at 5:32 pm #

    you just made my day with this post. I was searching for hours to solve this redirect problem after logout.

    thanx for this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.