I used the following code to achieve my goal:
Authentication auth = SecurityContextHolder.context.authentication new SecurityContextLogoutHandler().logout(request, response, auth); new PersistentTokenBasedRememberMeServices().logout(request, response, auth);
Marco source share