Package org.apache.jetspeed.security.impl

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


     * @param isMappingOnly Whether a principal's purpose is for security mappping only.
     * @return The {@link InternalUserPrincipal}.
     */
    public InternalUserPrincipal getInternalUserPrincipal(String username, boolean isMappingOnly)
    {
        UserPrincipal userPrincipal = new UserPrincipalImpl(username);
        String fullPath = userPrincipal.getFullPath();
        // Get user.
        Criteria filter = new Criteria();
        filter.addEqualTo("fullPath", fullPath);
        filter.addEqualTo("isMappingOnly", new Boolean(isMappingOnly));
        Query query = QueryFactory.newQuery(InternalUserPrincipalImpl.class, filter);
View Full Code Here


        return new TestSuite(TestSecurityHelper.class);
    }
   
    public void testHelpers() throws Exception
    {
        Principal principal = new UserPrincipalImpl("anon");
        Set principals = new PrincipalsSet();
        principals.add(principal);
        Subject subject = new Subject(true, principals, new HashSet(), new HashSet());
        System.out.println("subject = " + subject);
       
View Full Code Here

        for (int i = 0; i < fullPaths.length; i++)
        {
            String[] usersInGroup = userDao.getUserUidsForGroup(fullPaths[i]);
            for (int y = 0; y < usersInGroup.length; y++)
            {
                Principal userPrincipal = new UserPrincipalImpl(usersInGroup[y]);
                userPrincipals.add(userPrincipal);
            }
        }
    }
View Full Code Here

        for (int i = 0; i < fullPaths.length; i++)
        {
            String[] usersInRole = userDao.getUserUidsForRole(fullPaths[i]);
            for (int y = 0; y < usersInRole.length; y++)
            {
                Principal userPrincipal = new UserPrincipalImpl(usersInRole[y]);
                userPrincipals.add(userPrincipal);
            }
        }
    }   
View Full Code Here

     * @param principalUid The principal uid.
     * @return A group principal object.
     */
    protected Principal makePrincipal(String principalUid)
    {
        return new UserPrincipalImpl(principalUid);
    }
View Full Code Here

     */
    public void testAddDuplicateUserPrincipal() throws Exception
    {
        try
        {
            userHandler.addUserPrincipal(new UserPrincipalImpl(uid1));
            fail("Adding an already existant user should have thrown a SecurityException.");
        }
        catch (Exception e)
        {
            assertTrue("Adding an already existant user should have thrown a SecurityException.",
View Full Code Here

    /**
     * @throws Exception
     */
    public void testRemoveExistantUserPrincipal() throws Exception
    {
        UserPrincipal up = new UserPrincipalImpl(uid1);
        userHandler.removeUserPrincipal(up);
        assertTrue("User was found and should have been removed.", userHandler.getUserPrincipal(uid1) == null);
    }
View Full Code Here

     * @throws Exception
     */
    public void testRemoveNonExistantUserPrincipal() throws Exception
    {
        String localUid = Integer.toString(rand.nextInt()).toString();
        UserPrincipal localPrin = new UserPrincipalImpl(localUid);

        userHandler.removeUserPrincipal(localPrin);
    }
View Full Code Here

        final RequestContext rc =
            new JetspeedRequestContext(request, response, config, null);
       
        Set principals = new HashSet();
        principals.add(new UserPrincipalImpl("admin"));
        principals.add(new RolePrincipalImpl("admin"));
        Subject subject = new Subject(true, principals, new HashSet(), new HashSet());
       
        PipelineException pe = (PipelineException) JSSubject.doAsPrivileged(subject, new PrivilegedAction()
                {
View Full Code Here

    /** The {@link RoleSecurityHandler}. */
    private static RoleSecurityHandler roleHandler;   
   
    public static void seedUserData(String uid, String password) throws Exception
    {
        UserPrincipal up = new UserPrincipalImpl(uid);
        userHandler.addUserPrincipal(up);
        crHandler.setPassword(uid, "", password);
    }
View Full Code Here

TOP

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

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.