예제 #1
0
 @Override
 public void logoutBySsoId(List<String> ssoIds) {
   SamlSession account = getAccount();
   for (String ssoId : ssoIds) {
     if (account != null && account.getSessionIndex().equals(ssoId)) {
       logoutAccount();
     } else if (idMapper != null) {
       String sessionId = idMapper.getSessionFromSSO(ssoId);
       idMapper.removeSession(sessionId);
     }
   }
 }
예제 #2
0
 @Override
 public void logoutByPrincipal(String principal) {
   SamlSession account = getAccount();
   if (account != null && account.getPrincipal().getSamlSubject().equals(principal)) {
     logoutAccount();
   }
   if (idMapper != null) {
     Set<String> sessions = idMapper.getUserSessions(principal);
     if (sessions != null) {
       List<String> ids = new LinkedList<String>();
       ids.addAll(sessions);
       for (String id : ids) {
         idMapper.removeSession(id);
       }
     }
   }
 }
예제 #3
0
 @Override
 public void saveAccount(SamlSession account) {
   HttpSession session = request.getSession(true);
   session.setAttribute(SamlSession.class.getName(), account);
   if (idMapper != null)
     idMapper.map(
         account.getSessionIndex(), account.getPrincipal().getSamlSubject(), session.getId());
 }
예제 #4
0
 @Override
 public void logoutAccount() {
   HttpSession session = request.getSession(false);
   if (session == null) return;
   if (session != null) {
     if (idMapper != null) idMapper.removeSession(session.getId());
     SamlSession samlSession = (SamlSession) session.getAttribute(SamlSession.class.getName());
     if (samlSession != null) {
       session.removeAttribute(SamlSession.class.getName());
     }
     clearSavedRequest(session);
   }
 }
예제 #5
0
  @Override
  public boolean isLoggedIn() {
    HttpSession session = request.getSession(false);
    if (session == null) return false;
    if (session == null) {
      log.debug("session was null, returning null");
      return false;
    }
    final SamlSession samlSession = (SamlSession) session.getAttribute(SamlSession.class.getName());
    if (samlSession == null) {
      log.debug("SamlSession was not in session, returning null");
      return false;
    }
    if (idMapper != null && !idMapper.hasSession(session.getId())) {
      logoutAccount();
      return false;
    }

    needRequestRestore = restoreRequest();
    return true;
  }