Package java.security.acl

Examples of java.security.acl.Group.members()


        Enumeration<? extends Principal> members = group.members();
        assertEquals(new SimpleGroup("group", "friend"), members.nextElement());
        assertFalse(members.hasMoreElements());
       
        group.removeMember(new SimpleGroup("group", "friend"));
        assertFalse(group.members().hasMoreElements());
    }
}
View Full Code Here


      Set groups = subject.getPrincipals(Group.class);
      Set principals = subject.getPrincipals();
      assertTrue("Principals contains Java Duke", principals.contains(new SimplePrincipal("jduke")));
      assertTrue("Principals contains Roles", groups.contains(new SimplePrincipal("Roles")));
      Group roles = (Group) groups.iterator().next();
      Enumeration names = roles.members();
      while( names.hasMoreElements() )
      {
         System.out.println(names.nextElement());
      }
      assertTrue("inf_map_vmware_iso_S is a role", roles.isMember(new SimplePrincipal("inf_map_vmware_iso_S")));
View Full Code Here

         if(p instanceof Group)
         {
            Group gp = (Group)p;
            if("Roles".equals(gp.getName()) == false)
               continue;
            Enumeration en = gp.members();
            while(en.hasMoreElements())
            {
               Principal role = (Principal)en.nextElement();
               return role.getName();
            }
View Full Code Here

            assertTrue("Java is NOT a role", roles.isMember(new SimplePrincipal("Java")) == false);
            assertTrue("Coder is NOT a role", roles.isMember(new SimplePrincipal("Coder")) == false);
         }
         else if (roles.getName().equals("CallerPrincipal"))
         {
            getLog().info("CallerPrincipal is " + roles.members().nextElement());
            boolean isMember = roles.isMember(new SimplePrincipal("callerScott"));
            assertTrue("CallerPrincipal is callerScott", isMember);
         }
      }
      lc.logout();
View Full Code Here

            assertTrue("Java is a role", roles.isMember(new SimplePrincipal("Java")));
            assertTrue("Coder is a role", roles.isMember(new SimplePrincipal("Coder")));
         }
         else if (roles.getName().equals("CallerPrincipal"))
         {
            getLog().info("CallerPrincipal is " + roles.members().nextElement());
            boolean isMember = roles.isMember(new SimplePrincipal("callerStark"));
            assertTrue("CallerPrincipal is callerStark", isMember);
         }
      }
      lc.logout();
View Full Code Here

            assertTrue("Role2 is a role", roles.isMember(new SimplePrincipal("Role2")));
            assertTrue("Role3 is a role", roles.isMember(new SimplePrincipal("Role3")));
         }
         else if (roles.getName().equals("CallerPrincipal"))
         {
            getLog().info("CallerPrincipal is " + roles.members().nextElement());
            boolean isMember = roles.isMember(new SimplePrincipal("callerJdukeman"));
            assertTrue("CallerPrincipal is callerJdukeman", isMember);
         }
      }
      lc.logout();
View Full Code Here

            assertTrue("Java is NOT a role", roles.isMember(new SimplePrincipal("Java")) == false);
            assertTrue("Coder is NOT a role", roles.isMember(new SimplePrincipal("Coder")) == false);
         }
         else if (roles.getName().equals("CallerPrincipal"))
         {
            getLog().info("CallerPrincipal is " + roles.members().nextElement());
            boolean isMember = roles.isMember(new SimplePrincipal("callerScott2"));
            assertTrue("CallerPrincipal is callerScott2", isMember);
         }
      }
      lc.logout();
View Full Code Here

         subject = lc.getSubject();
         groups = subject.getPrincipals(Group.class);
         assertTrue("Principals contains jduke", subject.getPrincipals().contains(new SimplePrincipal("jduke")));
         assertTrue("Principals contains Roles", groups.contains(new SimplePrincipal("Roles")));
         roles = (Group) groups.iterator().next();
         Enumeration iter = roles.members();
         while( iter.hasMoreElements() )
            log.debug(iter.nextElement());
         // Only the roles from the DatabaseServerLoginModule should exist
         assertTrue("Role1 is NOT a role", !roles.isMember(new SimplePrincipal("Role1")));
         assertTrue("Role2 is NOT a role", !roles.isMember(new SimplePrincipal("Role2")));
View Full Code Here

            assertTrue("Java is NOT a role", roles.isMember(new SimplePrincipal("Java")) == false);
            assertTrue("Coder is NOT a role", roles.isMember(new SimplePrincipal("Coder")) == false);
         }
         else if( roles.getName().equals("CallerPrincipal") )
         {
            log.info("CallerPrincipal is "+roles.members().nextElement());
            boolean isMember = roles.isMember(new SimplePrincipal("callerX509"));
            assertTrue("CallerPrincipal is callerX509", isMember);
         }
      }
      lc.logout();
View Full Code Here

         Group group = (Group) roleGroups.get(roleGroup);
         String[] names = {};
         if( group != null )
         {
            ArrayList tmp = new ArrayList();
            Enumeration iter = group.members();
            while( iter.hasMoreElements() )
            {
               Principal p = (Principal) iter.nextElement();
               tmp.add(p.getName());
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.