tags:

views:

99

answers:

1

Is there a similar logic for logout using this login code:

// login account
def autht = new AuthToken(username, password)
def authtoken = daoAuthenticationProvider.authenticate(autht)
SecurityContextHolder.context.authentication = authtoken

I checked LogoutController and this is the only logic for logout:

redirect(uri: '/j_spring_security_logout')

Any idea? Thanks

A: 

You would need to invalidate the session:

session.invalidate()

and remove the authentication:

SecurityContextHolder.clearContext()

You also need to remove their remember-me cookie if that's supported. Add a dependency injection for rememberMeServices ("def rememberMeServices") and call

rememberMeServices.logout request, response, null
Burt Beckwith