Package java.security.acl

Examples of java.security.acl.Group


    @return The Set<Principal> for the application domain roles that the
    principal has been assigned.
    */
   public Set getUserRoles(Principal principal)
   {
      Group userRoles = getCurrentRoles(principal);
      return this.getRolesAsSet(userRoles);
  
View Full Code Here


      }
      catch (PrivilegedActionException e)
      {
         throw new IllegalStateException(e);
      }
      Group subjectRoles = getSubjectRoles(subject);
     
      //Deal with the security context
      SecurityContext sc = SubjectActions.getSecurityContext();
      if(sc == null)
      {
         sc = new JBossSecurityContext(securityDomain);
         SubjectActions.setSecurityContext(sc);  
      }

      Group userRoles = (Group)sc.getData().get(ROLES_IDENTIFIER);
      if(userRoles == null || "true".equalsIgnoreCase(SubjectActions.getRefreshSecurityContextRoles()))
         emptyContextRoles = true;
      userRoles = copyGroups(userRoles, subjectRoles);
     
      /**
       * Update the roles in the SecurityContext and
       * allow mapping rules be applied only if the SC roles
       * and the subject roles are not the same
       */
      if(subjectRoles != userRoles || emptyContextRoles)
      {
         MappingManager mm = sc.getMappingManager();
         MappingContext mc = mm.getMappingContext(Group.class);
         Group mappedUserRoles = userRoles;
         if(mc != null)
         {
            Map contextMap = new HashMap();
            contextMap.put(SecurityConstants.ROLES_IDENTIFIER, userRoles);
            contextMap.put(SecurityConstants.PRINCIPAL_IDENTIFIER, principal);
View Full Code Here

   {
      if(theSubject == null)
         throw new IllegalArgumentException("Subject is null");
      Set subjectGroups = theSubject.getPrincipals(Group.class);
      Iterator iter = subjectGroups.iterator();
      Group roles = null;
      while( iter.hasNext() )
      {
         Group grp = (Group) iter.next();
         String name = grp.getName();
         if( name.equals(ROLES_IDENTIFIER) )
            roles = grp;
      }
      return roles;
   }
View Full Code Here

         {
            String name = rs.getString(1);
            String groupName = rs.getString(2);
            if( groupName == null || groupName.length() == 0 )
               groupName = "Roles";
            Group group = (Group) setsMap.get(groupName);
            if( group == null )
            {
               group = new SimpleGroup(groupName);
               setsMap.put(groupName, group);
            }

            try
            {
               Principal p = aslm.createIdentity(name);
               if( trace )
                  log.trace("Assign user to role " + name);
               group.addMember(p);
            }
            catch(Exception e)
            {
               log.debug("Failed to create principal: "+name, e);
            }
View Full Code Here

    */
    public boolean isMember(Principal member)
    {
        if( rolesStack.size() == 0 )
            return false;
        Group activeGroup = (Group) rolesStack.getFirst();
        boolean isMember = activeGroup.isMember(member);
        return isMember;
    }
View Full Code Here

        IndexEnumeration()
        {
            if( rolesStack.size() > 0 )
            {
                Group grp = (Group) rolesStack.get(0);
                iter = grp.members();
            }
        }
View Full Code Here

      if(subject == null)
         throw new IllegalArgumentException("Subject passed is null");
      if(sc == null)
         throw new IllegalArgumentException("Sec Ctx sc passed is null");
     
      Group subjectRoles = getGroupFromSubject(subject);
     
      boolean emptyContextRoles = false;
     
      RoleGroup userRoles = sc.getUtil().getRoles();
      //Group userRoles = (Group)sc.getData().get(ROLES_IDENTIFIER);
View Full Code Here

   {
      if(theSubject == null)
         throw new IllegalArgumentException("Subject is null");
      Set<Group> subjectGroups = theSubject.getPrincipals(Group.class);
      Iterator<Group> iter = subjectGroups.iterator();
      Group roles = null;
      while( iter.hasNext() )
      {
         Group grp = (Group) iter.next();
         String name = grp.getName();
         if( name.equals(ROLES_IDENTIFIER) )
            roles = grp;
      }
      return roles;
   }
View Full Code Here

      this.subjectInfo = si;
   }
  
   public void setRoles(Group roles, boolean replace)
   {
      Group mergedRoles = roles;
      if(!replace)
      {
         mergedRoles = mergeGroups( (Group)contextData.get(ROLES_IDENTIFIER), roles);
      }
      contextData.put(ROLES_IDENTIFIER, mergedRoles);
View Full Code Here

      */
      Set subjectGroups = subject.getPrincipals(Group.class);
      Iterator iter = subjectGroups.iterator();
      while( iter.hasNext() )
      {
         Group grp = (Group) iter.next();
         String name = grp.getName();
         if( name.equals("CallerPrincipal") )
         {
            Enumeration members = grp.members();
            if( members.hasMoreElements() )
               info.callerPrincipal = (Principal) members.nextElement();
         }
      }
     
View Full Code Here

TOP

Related Classes of java.security.acl.Group

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.