Package org.apache.jetspeed.security.impl

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


        rms.addRole("mappedrole.role1");
        gms.addGroup("mappedgroup");
       
        Permission perm = new PortletPermission("myportlet", "view");
        pms.addPermission(perm);
        pms.grantPermission(new RolePrincipalImpl("mappedrole"), perm);
       
        rms.addRoleToUser("mappedroleuser", "mappedrole");
        rms.addRoleToGroup("mappedrole", "mappedgroup");   
    }
View Full Code Here


        grHandler.setGroupPrincipal(gp);
    }
   
    public static void seedRoleData(String roleUid) throws Exception
    {
        RolePrincipal rp = new RolePrincipalImpl(roleUid);
        roleHandler.setRolePrincipal(rp);
    }
View Full Code Here

        grHandler.removeGroupPrincipal(gp);
    }
   
    public static void removeRoleData(String roleUid) throws Exception
    {
        RolePrincipal rp = new RolePrincipalImpl(roleUid);
        roleHandler.removeRolePrincipal(rp);
    }   
View Full Code Here

    /**
     * @throws Exception
     */
    public void testGetRolePrincipal() throws Exception
    {
        String fullPath = (new RolePrincipalImpl(roleUid1)).getFullPath();
        RolePrincipal rolePrincipal = roleHandler.getRolePrincipal(roleUid1);
        assertNotNull("Role was not found.", rolePrincipal);
        assertEquals(roleUid1,rolePrincipal.getName());
        assertEquals(fullPath,rolePrincipal.getFullPath());
    }
View Full Code Here

    /**
     * @throws Exception
     */
    public void testAddDuplicateRolePrincipal() throws Exception
    {
      roleHandler.setRolePrincipal(new RolePrincipalImpl(roleUid1));
        List roles = roleHandler.getRolePrincipals("");
        assertEquals(1,roles.size());
    }
View Full Code Here

    /**
     * @throws Exception
     */
    public void testRemoveExistantUserPrincipal() throws Exception
    {
        RolePrincipal gp = new RolePrincipalImpl(roleUid1);
        roleHandler.removeRolePrincipal(gp);
        RolePrincipal rolePrincipal = roleHandler.getRolePrincipal(gp.getFullPath());
        assertNull("Role was found and should have been removed.", rolePrincipal);
        List roles = roleHandler.getRolePrincipals("");
        assertEquals(0,roles.size());       
    }
View Full Code Here

     * @throws Exception
     */
    public void testRemoveNonExistantUserPrincipal() throws Exception
    {
        String localUid = Integer.toString(rand.nextInt()).toString();
        RolePrincipal localPrin = new RolePrincipalImpl(localUid);
        roleHandler.removeRolePrincipal(localPrin);
        List roles = roleHandler.getRolePrincipals("");
        assertEquals(1,roles.size());
    }
View Full Code Here

        {
            LdapDataHelper.seedRoleData(gpUid2);
            assertTrue("getUserPrincipals should have returned more than one user.", roleHandler.getRolePrincipals("*")
                    .size() > 1);

            String fullPath = (new RolePrincipalImpl(roleUid1)).getFullPath();
            List roles = roleHandler.getRolePrincipals(fullPath);
            assertTrue("getRolePrincipals should have returned one role.", roles.size() == 1);
            assertTrue("List should have consisted of RolePrincipal objects.", roles.get(0) instanceof RolePrincipal);

            String localUid = Integer.toString(rand.nextInt()).toString();
            assertTrue("getRolePrincipals should not have found any roles with the specified filter.", roleHandler
                    .getRolePrincipals(new RolePrincipalImpl(localUid).getFullPath()).isEmpty());
        }
        finally
        {
            LdapDataHelper.removeRoleData(gpUid2);
        }
View Full Code Here

        Set principals = new PrincipalsSet();
        Set publicCredentials = new HashSet();
        Set privateCredentials = new HashSet();
       
        principals.add(new UserPrincipalImpl("david"));
        principals.add(new RolePrincipalImpl("ATP"));
        principals.add(new RolePrincipalImpl("NB"));       
        principals.add(new RolePrincipalImpl("ATP-NB"));       
        Subject subject = new Subject(true, principals, publicCredentials, privateCredentials);       
        return subject;
    }
View Full Code Here

        Set principals = new PrincipalsSet();
        Set publicCredentials = new HashSet();
        Set privateCredentials = new HashSet();
       
        principals.add(new UserPrincipalImpl("david"));
        principals.add(new RolePrincipalImpl("ATP"));
        principals.add(new RolePrincipalImpl("NB"));       
        Subject subject = new Subject(true, principals, publicCredentials, privateCredentials);       
        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.