예제 #1
0
  /** Handles the logout processing. */
  @Override
  public void doLogout(StaplerRequest req, StaplerResponse rsp)
      throws IOException, ServletException {
    // Clear Spring Security context
    SecurityContextHolder.clearContext();

    // Remove session from CAS single sign-out storage
    HttpSession session = req.getSession(false);
    if (session != null) {
      SessionMappingStorage sessionMappingStorage =
          (SessionMappingStorage) getApplicationContext().getBean("casSessionMappingStorage");
      sessionMappingStorage.removeBySessionById(session.getId());
    }

    super.doLogout(req, rsp);
  }