Examples of UserPrincipalImpl


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

        assertNotNull("Default profiling rule is null", rule);
        assertTrue("default rule unexpected, = " + rule.getId(), rule.getId().equals(DEFAULT_RULE));
        assertTrue("default rule class not mapped", rule instanceof StandardProfilingRule);

        // Test anonymous principal-rule
        ProfilingRule anonRule = profiler.getRuleForPrincipal(new UserPrincipalImpl("anon"),
                ProfileLocator.PAGE_LOCATOR);
        assertNotNull("anonymous rule is null", anonRule);
        assertTrue("anonymous rule is j1", anonRule.getId().equals(DEFAULT_RULE));

        // Test Retrieving All Rules
View Full Code Here

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

    }

    public void testGetLocatorNames() throws Exception
    {
        assertNotNull("profiler service is null", profiler);
        String[] result = profiler.getLocatorNamesForPrincipal(new UserPrincipalImpl("guest"));
        for (int ix = 0; ix < result.length; ix++)
        {
            System.out.println("$$$ result = " + result[ix]);
            assertTrue("locator name = " + result[ix], result[ix].equals("page"));
        }
View Full Code Here

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

        {
            System.out.println("Group:" + TEST_GROUP + " site: " + TEST_URL + " has already a remote credential");
        }

        // Create Principal for User
        principal = new UserPrincipalImpl(TEST_GROUP_USER);
        principals = new HashSet();
        principals.add(principal);
        subject = new Subject(true, principals, new HashSet(), new HashSet());

        // User should have credential for site
View Full Code Here

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

        {
            // assertTrue("user already exists. exception caught: " + sex, false);
        }

        // Initialization
        Principal principal = new UserPrincipalImpl(TEST_USER);
        Set principals = new HashSet();
        principals.add(principal);
        Subject subject = new Subject(true, principals, new HashSet(), new HashSet());

        if (ssoBroker.hasSSOCredentials(subject, TEST_URL) == false)
View Full Code Here

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

     * @param principalName The user principal name.
     * @return The subject.
     */
    public static Subject createSubject(String principalName)
    {
        Principal principal = new UserPrincipalImpl(principalName);
        Set principals = new PrincipalsSet();
        principals.add(principal);
        return new Subject(true, principals, new HashSet(), new HashSet());
    }
View Full Code Here

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

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

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

        secHandler.setUserPrincipalInGroup(uid1, gp1.getName());
        secHandler.setUserPrincipalInGroup(uid2, gp1.getName());
        String fullPathName = new GroupPrincipalImpl(gpUid1).getName();
        logger.debug("Group full path name from testGetUserPrincipalsInGroup()[" + fullPathName + "]");
        Set userPrincipals = secHandler.getUserPrincipalsInGroup(fullPathName);
        assertTrue(userPrincipals.contains(new UserPrincipalImpl(uid1)));
        assertTrue(userPrincipals.contains(new UserPrincipalImpl(uid2)));
       
        assertEquals("The user should have been in two groups.", 2, userPrincipals.size());
    }
View Full Code Here

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

        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

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

            // 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());

            userPrincipal = new UserPrincipalImpl("guest");
            principals = new PrincipalsSet();
            principals.add(userPrincipal);
            Subject guestSubject = new Subject(true, principals, new HashSet(), new HashSet());

            // setup test as admin user
View Full Code Here

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

        principals.add(rolePrincipal1);
        principals.add(rolePrincipal2);
        principals.add(rolePrincipal3);
       
        // create the user principal
        Principal userPrincipal = new UserPrincipalImpl("david");       
        principals.add(userPrincipal);
       
        // create the subject
        Subject subject = new Subject(true, principals, new HashSet(), new HashSet());
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.