Пример #1
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());
 }
  public static UserIdentity createIdentity(SamlSession samlSession) {
    Set<String> roles = samlSession.getRoles();
    if (roles == null) {
      roles = new HashSet<String>();
    }
    Subject theSubject = new Subject();
    String[] theRoles = new String[roles.size()];
    roles.toArray(theRoles);

    return new DefaultUserIdentity(theSubject, samlSession.getPrincipal(), theRoles);
  }
Пример #3
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);
     }
   }
 }
Пример #4
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);
       }
     }
   }
 }