public void doLogout(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
        HttpSession session = req.getSession(false);
        if(session!=null)
            session.invalidate();
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
        SecurityContextHolder.clearContext();

        // reset remember-me cookie
        Cookie cookie = new Cookie(ACEGI_SECURITY_HASHED_REMEMBER_ME_COOKIE_KEY,"");
        cookie.setMaxAge(0);
        cookie.setSecure(req.isSecure());
        cookie.setHttpOnly(true);
        cookie.setPath(req.getContextPath().length()>0 ? req.getContextPath() : "/");
        rsp.addCookie(cookie);

        rsp.sendRedirect2(getPostLogOutUrl(req,auth));
    }
public void doLogout ( StaplerRequest req , StaplerResponse rsp ) throws IOException , ServletException { HttpSession session = req . getSession ( false ) ; if ( session != null ) session . invalidate ( ) ; Authentication auth = SecurityContextHolder . getContext ( ) . getAuthentication ( ) ; SecurityContextHolder . clearContext ( ) ; Cookie cookie = new Cookie ( ACEGI_SECURITY_HASHED_REMEMBER_ME_COOKIE_KEY , "" ) ; cookie . setMaxAge ( 0 ) ; cookie . setSecure ( req . isSecure ( ) ) ; cookie . setHttpOnly ( true ) ; cookie . setPath ( req . getContextPath ( ) . length ( ) > 0 ? req . getContextPath ( ) : "/" ) ; rsp . addCookie ( cookie ) ; rsp . sendRedirect2 ( getPostLogOutUrl ( req , auth ) ) ; }
Handles the logout processing.

<p>
The default implementation erases the session and do a few other clean up, then
redirect the user to the URL specified by {@link #getPostLogOutUrl(StaplerRequest, Authentication)}.

@since 1.314