コード例 #1
0
  private SessionId removeSessionId(
      String sessionId, HttpServletRequest httpRequest, HttpServletResponse httpResponse) {

    SessionId ldapSessionId = null;

    try {
      String id = sessionId;
      if (StringHelper.isEmpty(id)) {
        id = sessionIdService.getSessionIdFromCookie(httpRequest);
      }

      if (StringHelper.isNotEmpty(id)) {
        ldapSessionId = sessionIdService.getSessionId(id);
        if (ldapSessionId != null) {
          boolean result = sessionIdService.remove(ldapSessionId);
          if (!result) {
            log.error("Failed to remove session_id '{0}' from LDAP", id);
          }
        } else {
          log.error("Failed to load session from LDAP by session_id: '{0}'", id);
        }
      }
    } catch (Exception e) {
      log.error(e.getMessage(), e);
    } finally {
      sessionIdService.removeSessionIdCookie(httpResponse);
    }
    return ldapSessionId;
  }
コード例 #2
0
  private void removeSessionId(
      String sessionId, HttpServletRequest httpRequest, HttpServletResponse httpResponse) {
    String id = sessionId;
    if (StringHelper.isEmpty(id)) {
      id = sessionIdService.getSessionIdFromCookie(httpRequest);
    }

    if (StringHelper.isNotEmpty(id)) {
      SessionId ldapSessionId = sessionIdService.getSessionId(id);
      if (ldapSessionId != null) {
        boolean result = sessionIdService.remove(ldapSessionId);
        if (!result) {
          log.error("Failed to remove session_id '{0}' from LDAP", id);
        }
      } else {
        log.error("Failed to load session from LDAP by session_id: '{0}'", id);
      }
    }

    sessionIdService.removeSessionIdCookie(httpResponse);
  }