Package org.apache.jetspeed.security.impl

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


        crHandler.setPassword(uid, "", password);
    }
   
    public static void seedGroupData(String gpUid) throws Exception
    {
        GroupPrincipal gp = new GroupPrincipalImpl(gpUid);
        grHandler.setGroupPrincipal(gp);
    }
View Full Code Here


        userHandler.removeUserPrincipal(up);
    }
   
    public static void removeGroupData(String gpUid) throws Exception
    {
        GroupPrincipal gp = new GroupPrincipalImpl(gpUid);
        grHandler.removeGroupPrincipal(gp);
    }
View Full Code Here

        {
            assertTrue("Could not create group. Abort test.", false);
        }

        // 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 Credential for Group
View Full Code Here

    /**
     * @throws Exception
     */
    public void testGetGroupPrincipal() throws Exception
    {
        String fullPath = (new GroupPrincipalImpl(gpUid1)).getFullPath();
        //GroupPrincipal groupPrincipal = grHandler.getGroupPrincipal(fullPath);
        GroupPrincipal groupPrincipal = grHandler.getGroupPrincipal(gpUid1);
        assertNotNull("Group was not found.", groupPrincipal);
        assertEquals(gpUid1,groupPrincipal.getName());
        assertEquals(fullPath,groupPrincipal.getFullPath());
View Full Code Here

    /**
     * @throws Exception
     */
    public void testAddDuplicateGroupPrincipal() throws Exception
    {
        grHandler.setGroupPrincipal(new GroupPrincipalImpl(gpUid1));
        List groups = grHandler.getGroupPrincipals("");
        assertEquals(1,groups.size());
    }
View Full Code Here

    /**
     * @throws Exception
     */
    public void testRemoveExistantUserPrincipal() throws Exception
    {
        GroupPrincipal gp = new GroupPrincipalImpl(gpUid1);
        grHandler.removeGroupPrincipal(gp);
        GroupPrincipal groupPrincipal = grHandler.getGroupPrincipal(gp.getFullPath());
        assertNull("Group was found and should have been removed.", groupPrincipal);
        List groups = grHandler.getGroupPrincipals("");
        assertEquals(0,groups.size());       
    }
View Full Code Here

     * @throws Exception
     */
    public void testRemoveNonExistantUserPrincipal() throws Exception
    {
        String localUid = Integer.toString(rand.nextInt()).toString();
        GroupPrincipal localPrin = new GroupPrincipalImpl(localUid);
        grHandler.removeGroupPrincipal(localPrin);
        List groups = grHandler.getGroupPrincipals("");
        assertEquals(1,groups.size());
    }
View Full Code Here

        {
            LdapDataHelper.seedGroupData(gpUid2);
            assertTrue("getUserPrincipals should have returned more than one user.", grHandler.getGroupPrincipals("*")
                    .size() > 1);

            String fullPath = (new GroupPrincipalImpl(gpUid1)).getFullPath();
            List groups = grHandler.getGroupPrincipals(fullPath);
            assertTrue("getGroupPrincipals should have returned one group.", groups.size() == 1);
            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());
        }
        finally
        {
            LdapDataHelper.removeGroupData(gpUid2);
        }
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

        GroupPrincipal groupPrincipal = null;
        InternalGroupPrincipal internalGroup = commonQueries.getInternalGroupPrincipal(GroupPrincipalImpl
                .getFullPathFromPrincipalName(groupFullPathName));
        if (null != internalGroup)
        {
            groupPrincipal = new GroupPrincipalImpl(GroupPrincipalImpl.getPrincipalNameFromFullPath(internalGroup
                    .getFullPath()));
        }
        return groupPrincipal;
    }
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.