예제 #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 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);
       }
     }
   }
 }