Package java.security.acl

Examples of java.security.acl.Group


    }

    public void testSetEntryForGroupPrincipal() throws RepositoryException, NotExecutableException {
        JackrabbitAccessControlList pt = createEmptyTemplate(getTestPath());
        Privilege[] privs = privilegesFromName(Privilege.JCR_READ);
        Group grPrincipal = (Group) pMgr.getEveryone();

        // adding allow-entry must succeed
        assertTrue(pt.addAccessControlEntry(grPrincipal, privs));

        // adding deny-entry must succeed
View Full Code Here


    }

    @Test
    public void testSetEntryForGroupPrincipal() throws Exception {
        Privilege[] privs = privilegesFromNames(JCR_READ);
        Group grPrincipal = (Group) principalManager.getEveryone();

        // adding allow-entry must succeed
        assertTrue(acl.addAccessControlEntry(grPrincipal, privs));

        // adding deny-entry must succeed
View Full Code Here

    public Group getRoles (JAASUserPrincipal principal)
    {
        //get all the roles of the various types
        String[] roleClassNames = getRoleClassNames();
        Group roleGroup = new JAASGroup(JAASGroup.ROLES);
       
        try
        {
            JAASUserPrincipal thePrincipal = principal;
           
            if (thePrincipal == null)
                thePrincipal = defaultUser;
           
            for (int i=0; i<roleClassNames.length;i++)
            {
                Class load_class=Thread.currentThread().getContextClassLoader().loadClass(roleClassNames[i]);
                Set rolesForType = thePrincipal.getSubject().getPrincipals (load_class);
                Iterator itor = rolesForType.iterator();
                while (itor.hasNext())
                {
                    roleGroup.addMember((Principal) itor.next());
                }
            }
           
            return roleGroup;
        }
View Full Code Here

         Subject subject = SecurityAssociation.getSubject();

         if (subject != null)
         {
            // Check the caller's roles
            Group subjectRoles = getSubjectRoles(subject);
            if (subjectRoles != null)
            {
               Iterator iter = roles.iterator();
               while (!hasRole && iter.hasNext())
               {
View Full Code Here

    */
   private Group getSubjectRoles(Subject subject)
   {
      Set subjectGroups = subject.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"))
         {
            roles = grp;
         }
      }
View Full Code Here

   {
      Set groups = subject.getPrincipals(Group.class);

      if(groups == null || groups.isEmpty())
      {
         Group g = new SimpleGroup("Roles");
         subject.getPrincipals().add(g);
         groups = new HashSet();
         groups.add(g);
      }

      Group roles = null;

      for(Iterator i = groups.iterator(); i.hasNext(); )
      {
         Group g = (Group)i.next();
         if ("Roles".equals(g.getName()))
         {
            roles = g;
         }
      }
View Full Code Here

  @Override
  protected Group[] getRoleSets() throws LoginException
  {
    try
    {
      Group roles = new SimpleGroup("Roles");
      for (String role : this.identity.getRoles())
      {
        roles.addMember(this.createIdentity(role));
      }

      Group[] groups = { roles };

      return groups;
View Full Code Here

         return ; // No Mapping
     
      Set roleset = (Set)principalRolesMap.get(principal.getName());
      if(roleset != null)
      {
         Group newRoles = new SimpleGroup(SecurityConstants.ROLES_IDENTIFIER);
         Iterator iter = roleset.iterator();
         while(iter.hasNext())
         {
            String rolename = (String)iter.next();
            newRoles.addMember(createNewPrincipal(mappedObject,rolename));
         }
         mappedObject = MappingProviderUtil.replacePrincipals(mappedObject, newRoles)
      }
      result.setMappedObject(mappedObject);
   }
View Full Code Here

    @see Subject#getPrincipals()
    */
   public boolean doesUserHaveRole(Principal principal, Set rolePrincipals)
   {
      boolean hasRole = false;
      Group roles = this.getCurrentRoles(principal);
      if( trace )
         log.trace("doesUserHaveRole(Set), roles: "+roles);
      if(roles != null)
      {
         Iterator iter = rolePrincipals.iterator();
View Full Code Here

    @return true if the active principal has the role, false otherwise.
    */
   public boolean doesUserHaveRole(Principal principal, Principal role)
   {
      boolean hasRole = false;
      Group roles = this.getCurrentRoles(principal);
      hasRole = doesRoleGroupHaveRole(role, roles);
      return hasRole;
   }
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.