Package org.apache.jetspeed.security.impl

Examples of org.apache.jetspeed.security.impl.RolePrincipalImpl


    {
        Principal principal = null;
        if (fullPath.startsWith(BasePrincipal.PREFS_ROLE_ROOT))
        {
            String name = RolePrincipalImpl.getPrincipalNameFromFullPath(fullPath);           
            principal = new RolePrincipalImpl(name);
        }
        else if (fullPath.startsWith(BasePrincipal.PREFS_USER_ROOT))
        {
            String name = UserPrincipalImpl.getPrincipalNameFromFullPath(fullPath);
            principal = new UserPrincipalImpl(name);
View Full Code Here


        {
            StringTokenizer toke = new StringTokenizer(roleNames, ",");
            while (toke.hasMoreTokens())
            {
                String roleName = (String)toke.nextToken();
                Principal role = new RolePrincipalImpl(roleName);
                principals.add(role);
            }               
        }
        return pm.updatePermission(permission, principals);                   
    }
View Full Code Here

        gp1 = new GroupPrincipalImpl(gpUid1);
        gp2 = new GroupPrincipalImpl(gpUid2);
        LdapDataHelper.seedGroupData(gpUid1);
        LdapDataHelper.seedGroupData(gpUid2);
       
        ro1 = new RolePrincipalImpl(roleUid1);
        ro2 = new RolePrincipalImpl(roleUid2);       
        LdapDataHelper.seedRoleData(roleUid1);
        LdapDataHelper.seedRoleData(roleUid2);
               
        LdapDataHelper.seedUserData(uid1, password);
        LdapDataHelper.seedUserData(uid2, password);
View Full Code Here

    public void testGetUserPrincipalsInRole() throws Exception
    {
        secHandler.setUserPrincipalInRole(uid1, ro1.getName());
        secHandler.setUserPrincipalInRole(uid2, ro1.getName());

        String fullPathName = new RolePrincipalImpl(roleUid1).getName();
        logger.debug("Role full path name from testGetUserPrincipalsInRole()[" + fullPathName + "]");
        Set userPrincipals = secHandler.getUserPrincipalsInRole(fullPathName);
        assertTrue(userPrincipals.contains(new UserPrincipalImpl(uid1)));
        assertTrue(userPrincipals.contains(new UserPrincipalImpl(uid2)));
        assertEquals("The user should have been in two roles.", 2, userPrincipals.size());
View Full Code Here

        secHandler.setRolePrincipalInGroup(gpUid1, ro1.getName());
        secHandler.setRolePrincipalInGroup(gpUid1, ro2.getName());
        secHandler.setRolePrincipalInGroup(gpUid2, ro1.getName());
       

        String fullPathName = new RolePrincipalImpl(roleUid1).getName();
        logger.debug("Role full path name from testGetUserPrincipalsInRole()[" + fullPathName + "]");
        assertEquals("The group should have 2 roles.", 2, secHandler.getRolePrincipalsInGroup(gpUid1).size());
        assertEquals("The group should have 1 role.", 1, secHandler.getRolePrincipalsInGroup(gpUid2).size());
    }
View Full Code Here

        secHandler.setRolePrincipalInGroup(gpUid1, ro2.getName());
        secHandler.setRolePrincipalInGroup(gpUid2, ro1.getName());
        secHandler.setUserPrincipalInGroup(uid1,gpUid1);
       

        String fullPathName = new RolePrincipalImpl(roleUid1).getName();
        logger.debug("Role full path name from testGetUserPrincipalsInRole()[" + fullPathName + "]");
        assertEquals("The group should have 2 roles.", 2, secHandler.getRolePrincipalsInGroup(gpUid1).size());
        assertEquals("The group should have 1 role.", 1, secHandler.getRolePrincipalsInGroup(gpUid2).size());
    }    
View Full Code Here

    {
        secHandler.setRolePrincipalInGroup(gpUid1, ro1.getName());
        secHandler.setRolePrincipalInGroup(gpUid2, ro1.getName());
        secHandler.setUserPrincipalInRole(uid1, ro1.getName());
        secHandler.setUserPrincipalInRole(uid1, ro2.getName());
        String fullPathName = new RolePrincipalImpl(gpUid1).getName();
        logger.debug("Role full path name from testGetUserPrincipalsInRole()[" + fullPathName + "]");
        assertEquals("The group should have contained 1 role.", 1, secHandler.getRolePrincipalsInGroup(gpUid1)
                .size());
        assertEquals("The group should have contained 1 role.", 1, secHandler.getRolePrincipalsInGroup(gpUid1)
                .size());
View Full Code Here

            // reset page manager cache
            pageManager.reset();
           
            // setup test subjects
            Principal userPrincipal = new UserPrincipalImpl("admin");
            Principal rolePrincipal = new RolePrincipalImpl("admin");
            Set principals = new PrincipalsSet();
            principals.add(userPrincipal);
            principals.add(rolePrincipal);
            Subject adminSubject = new Subject(true, principals, new HashSet(), new HashSet());
           
            userPrincipal = new UserPrincipalImpl("user");
            principals = new PrincipalsSet();
            principals.add(userPrincipal);
            Subject userSubject = new Subject(true, principals, new HashSet(), new HashSet());
           
            userPrincipal = new UserPrincipalImpl("manager");
            rolePrincipal = new RolePrincipalImpl("manager");
            principals = new PrincipalsSet();
            principals.add(userPrincipal);
            principals.add(rolePrincipal);
            Subject managerSubject = new Subject(true, principals, new HashSet(), new HashSet());
View Full Code Here

        assertTrue("folder3 failed to create", pageManager.folderExists(FOLDER1));
       
        Set principals = new HashSet();
       
        // create the role principals
        Principal rolePrincipal1 = new RolePrincipalImpl("role1");
        Principal rolePrincipal2 = new RolePrincipalImpl("role2");
        Principal rolePrincipal3 = new RolePrincipalImpl("role3");
        principals.add(rolePrincipal1);
        principals.add(rolePrincipal2);
        principals.add(rolePrincipal3);
       
        // create the user principal
View Full Code Here

            combo.append(role.getName());
            count++;                       
        }
        Set principals = new HashSet();
        principals.add(SecurityHelper.getBestPrincipal(currentSubject, UserPrincipal.class));
        principals.add(new RolePrincipalImpl(combo.toString()));
        Subject subject =
            new Subject(true, principals, new HashSet(), new HashSet());
        return subject;
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.security.impl.RolePrincipalImpl

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.