How to fully logout? Spring Security -
how can logout? have in xml file:
<security:logout logout-url="/logoutme" />
and when enter /logoutme url not logged out - on controller added:
securitycontextholder.getcontext().getauthentication().getname()
and added name modelandview , display on page, , there still username, not anonymoususer before logging in.
how logout totally? i've tried create own logoutsuccesshandler implementation with:
securitycontextholder.clearcontext();
but.. doesnt seem work
this method spring security calls default on logout(from securitycontextlogouthandler class):
public void logout(httpservletrequest request, httpservletresponse response, authentication authentication) { assert.notnull(request, "httpservletrequest required"); if (invalidatehttpsession) { httpsession session = request.getsession(false); if (session != null) { logger.debug("invalidating session: " + session.getid()); session.invalidate(); } } if(clearauthentication) { securitycontext context = securitycontextholder.getcontext(); context.setauthentication(null); } securitycontextholder.clearcontext(); }
have tried use default, provided spring security logout url /logout
? or have customize things?
Comments
Post a Comment