Package org.apache.jetspeed.security.impl

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


        }
       
       
       
         //  Initialization of Group
      Principal principal = new GroupPrincipalImpl(TEST_GROUP);
        Set principals = new HashSet();
        principals.add(principal);
        Subject subject = new Subject(true, principals, new HashSet(), new HashSet())
       
        // Add SSO Credentail for Group
View Full Code Here


       
        // Group or User
        if (fullPath.indexOf("/group/") > -1 )
        {
            name = fullPath.substring(GROUP_PATH.length());
            principal = new GroupPrincipalImpl(name);
        }
        else
        {
            name = fullPath.substring(USER_PATH.length());
            principal = new UserPrincipalImpl(name);
View Full Code Here

       
        // Group or User
        if (fullPath.indexOf("/group/") > -1 )
        {
            name = fullPath.substring(GROUP_PATH.length());
            principal = new GroupPrincipalImpl(name);
        }
        else
        {
            name = fullPath.substring(USER_PATH.length());
            principal = new UserPrincipalImpl(name);
View Full Code Here

    public void testGetUserPrincipalsInGroup() throws SecurityException
    {
        secHandler.setUserPrincipalInGroup(uid1, gp1.getFullPath());
        secHandler.setUserPrincipalInGroup(uid2, gp1.getFullPath());

        String fullPathName = new GroupPrincipalImpl(gpUid1).getFullPath();
        LOG.debug("Group full path name from testGetUserPrincipalsInGroup()[" + fullPathName + "]");
        assertEquals("The user should have been in two groups.", 2, secHandler.getUserPrincipalsInGroup(fullPathName)
                .size());
    }
View Full Code Here

        // Add group with no prior groups.
        try
        {
            gms.addUserToGroup("anonuser1", "testusertogroup1.group1");
            Collection principals = ums.getUser("anonuser1").getSubject().getPrincipals();
            assertTrue("anonuser1 should contain testusertogroup1.group1", principals.contains(new GroupPrincipalImpl(
                    "testusertogroup1.group1")));
        }
        catch (SecurityException sex)
        {
            assertTrue("should add user to group. exception caught: " + sex, false);
        }
        // Add group with existing groups.
        try
        {
            gms.addUserToGroup("anonuser1", "testusertogroup1.group2");
            Collection principals = ums.getUser("anonuser1").getSubject().getPrincipals();
            assertTrue("anonuser1 should contain testusertogroup1.group2", principals.contains(new GroupPrincipalImpl(
                    "testusertogroup1.group2")));
        }
        catch (SecurityException sex)
        {
            assertTrue("should add user to group. exception caught: " + sex, false);
View Full Code Here

            // (4 groups + 1 user).
            assertEquals(
                "principal size should be == 5 after removing testgroup1.group1, for principals: " + principals.toString(),
                5,
                principals.size());
            assertFalse("anonuser2 should not contain testgroup1.group1", principals.contains(new GroupPrincipalImpl(
                    "testgroup1.group1")));
        }
        catch (SecurityException sex)
        {
            assertTrue("should remove group. exception caught: " + sex, false);
View Full Code Here

    {
        // Init test.
        UserPrincipal user = new UserPrincipalImpl("anon");
        RolePrincipal role1 = new RolePrincipalImpl("anonrole1");
        RolePrincipal role2 = new RolePrincipalImpl("anonrole2");
        GroupPrincipal group1 = new GroupPrincipalImpl("anongroup1");
        GroupPrincipal group2 = new GroupPrincipalImpl("anongroup2");
        PortletPermission perm1 = new PortletPermission("anontestportlet", "view");
        PortletPermission perm2 = new PortletPermission("anontestportlet", "view, edit");
        PortletPermission perm3 = new PortletPermission("anontestportlet", "view, edit, secure");
        PortletPermission perm4 = new PortletPermission("anontestportlet", "view, edit, secure, minimized");
        try
        {
            ums.addUser(user.getName(), "password");
            rms.addRole(role1.getName());
            rms.addRole(role2.getName());
            gms.addGroup(group1.getName());
            gms.addGroup(group2.getName());
            pms.addPermission(perm1);
            pms.addPermission(perm2);
            pms.addPermission(perm3);
            pms.addPermission(perm4);
            pms.grantPermission(role1, perm1);
View Full Code Here

        assertNotNull("Group was not found.", grHandler.getGroupPrincipal(gp1.getFullPath()));
    }

    public void testAddDuplicateGroupPrincipal() throws SecurityException
    {
        grHandler.setGroupPrincipal(new GroupPrincipalImpl(gpUid1));
    }
View Full Code Here

    }

    public void testRemoveNonExistantUserPrincipal() throws SecurityException
    {
        String localUid = Integer.toString(rand.nextInt()).toString();
        GroupPrincipal localPrin = new GroupPrincipalImpl(localUid);

        grHandler.removeGroupPrincipal(localPrin);
    }
View Full Code Here

        assertTrue("List should have consisted of GroupPrincipal objects.", groups.get(0) instanceof GroupPrincipal);

        String localUid = Integer.toString(rand.nextInt()).toString();

        assertTrue("getGroupPrincipals should not have found any groups with the specified filter.", grHandler
                .getGroupPrincipals(new GroupPrincipalImpl(localUid).getFullPath()).isEmpty());
    }
View Full Code Here

TOP

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

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.