Search code examples
spring-securityjava-ee-6

Spring security is not deleting remember me cookie when I logout


I have a login page with a remember me checkbox when i actually checkbox and login it works and creates the cookie for me logging in the problem is when I logout it redirects me just fine but for some reason it keeps the rememberMe Cookie active so when I get back into the application from another page it immediately logs me in

What are some things I can look so that I can delete the cookie when i logout.


Solution

  • Try to configure your custom logout page if it differs from '/j_spring_security_logout'.

    <http>
        <logout logout-success-url="/logout.htm"/>
    </http>
    

    Specifying 'logout-success' parameter you say Spring that it have to delete the cookie after request with such address. NOTE: any code mapped to this link ('/logout.htm') will be never executed 'cause of standard spring filters.