public static void stop ( final HttpServletRequest servletRequest , final HttpServletResponse servletResponse ) { final HttpSession httpSession = servletRequest . getSession ( false ) ; if ( httpSession != null ) { httpSession . removeAttribute ( AUTH_SESSION_NAME ) ; } final Cookie cookie = ServletUtil . getCookie ( servletRequest , AUTH_COOKIE_NAME ) ; if ( cookie == null ) { return ; } cookie . setMaxAge ( 0 ) ; cookie . setPath ( "/" ) ; servletResponse . addCookie ( cookie ) ; }
Stops the user session by removing it from the http session and invalidating the cookie .