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 = 开发者_JS百科authtoken
I checked LogoutController and this is the only logic for logout:
redirect(uri: '/j_spring_security_logout')
Any idea? Thanks
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
精彩评论