Package java.security.acl

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


    public void testUserInRole2() {
        Subject s = new Subject();
        Principal p = new SimplePrincipal("Barry");
        s.getPrincipals().add(p);
        Group group = new SimpleGroup("Roles", p);
        group.addMember(new SimpleGroup("friend"));
        s.getPrincipals().add(group);
        assertTrue(new DefaultSecurityContext(p, s).isUserInRole("friend"));
    }
   
    @Test
View Full Code Here


        Subject s = new Subject();
        Principal p = new SimplePrincipal("Barry");
        s.getPrincipals().add(p);
        Group group = new SimpleGroup("Roles", p);
        Group subgroup = new SimpleGroup("subgroup");
        subgroup.addMember(new SimpleGroup("friend"));
        group.addMember(subgroup);
        s.getPrincipals().add(group);
        assertTrue(new DefaultSecurityContext(p, s).isUserInRole("friend"));
    }
   
View Full Code Here

                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

    protected Group[] getRoleSets() throws LoginException {
        Group roles = new SimpleGroup("Roles");
        Group[] groups = { roles };
        //group mapping would go here
        if(getIdentity().getName().equals("anil")) {
            roles.addMember(new SimplePrincipal("gooduser"));
        }
        roles.addMember(getIdentity());
        return groups;
    }
View Full Code Here

        Group[] groups = { roles };
        //group mapping would go here
        if(getIdentity().getName().equals("anil")) {
            roles.addMember(new SimplePrincipal("gooduser"));
        }
        roles.addMember(getIdentity());
        return groups;
    }

}
View Full Code Here

    }

    @Override
    protected Group[] getRoleSets() throws LoginException {
        Group roles = new SimpleGroup(SecurityConstants.ROLES_IDENTIFIER);
        roles.addMember(new SimplePrincipal(role));
        return new Group[] { roles };
    }

    @Override
    protected Principal getIdentity() {
View Full Code Here

     */
    @Override
    protected Group[] getRoleSets() throws LoginException {
        try {
            Group roles = new SimpleGroup(SecurityConstants.ROLES_IDENTIFIER);
            roles.addMember(new SimplePrincipal(role));
            Group callerPrincipal = new SimpleGroup(SecurityConstants.CALLER_PRINCIPAL_GROUP);
            callerPrincipal.addMember(new CustomPrincipal(CALLER_NAME));
            return new Group[] { roles, callerPrincipal };
        } catch (Exception e) {
            throw new LoginException(e.toString());
View Full Code Here

    protected Group[] getRoleSets() throws LoginException {
        try {
            Group roles = new SimpleGroup(SecurityConstants.ROLES_IDENTIFIER);
            roles.addMember(new SimplePrincipal(role));
            Group callerPrincipal = new SimpleGroup(SecurityConstants.CALLER_PRINCIPAL_GROUP);
            callerPrincipal.addMember(new CustomPrincipal(CALLER_NAME));
            return new Group[] { roles, callerPrincipal };
        } catch (Exception e) {
            throw new LoginException(e.toString());
        }
    }
View Full Code Here

    @Override
    protected Group[] getRoleSets() throws LoginException {
        Group roles = new SimpleGroup("Roles");
        Group callerPrincipal = new SimpleGroup("CallerPrincipal");
        Group[] groups = { roles, callerPrincipal };
        callerPrincipal.addMember(getIdentity());
        return groups;
    }

}
View Full Code Here

    @Override
    protected Group[] getRoleSets() throws LoginException {
        Group roles = new SimpleGroup("Roles");
        Group callerPrincipal = new SimpleGroup("CallerPrincipal");
        Group[] groups = { roles, callerPrincipal };
        callerPrincipal.addMember(getIdentity());
        return groups;
    }

}
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.