Package org.apache.jetspeed.security

Examples of org.apache.jetspeed.security.PrincipalsSet


    return getSubject(new AuthenticatedUserImpl(user, null, null));
  }

  public Subject getSubject(AuthenticatedUser user) throws SecurityException
  {
    Set<Principal> principals = new PrincipalsSet();
    resolveSubjectPrincipals(user, principals);
    return JetspeedSubjectFactory.createSubject(user.getUser(), getPublicCredentialsForSubject(user), getPrivateCredentialsForSubject(user), principals);
  }
View Full Code Here


    {
        // setup components, subjects, and cleanup from previous run
        super.setUp();
        pageManager = (PageManager) scm.getComponent("pageManager");
        pageLayout = (PageLayoutComponent) scm.getComponent("pageLayout");
        Set principals = new PrincipalsSet();
        principals.add(new TestUser("user"));
        userSubject = new Subject(true, principals, new HashSet(), new HashSet());
        cleanupTest();
    }
View Full Code Here

            // reset page manager cache
            pageManager.reset();
           
            // setup test subjects
            Set principals = new PrincipalsSet();
            principals.add(new TestUser("admin"));
            principals.add(new TestRole("admin"));
            Subject adminSubject = new Subject(true, principals, new HashSet(), new HashSet());
           
            principals = new PrincipalsSet();
            principals.add(new TestUser("user"));
            Subject userSubject = new Subject(true, principals, new HashSet(), new HashSet());
           
            principals = new PrincipalsSet();
            principals.add(new TestUser("manager"));
            principals.add(new TestRole("manager"));
            Subject managerSubject = new Subject(true, principals, new HashSet(), new HashSet());

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

            // setup test as admin user
            Exception setup = (Exception)JSSubject.doAsPrivileged(adminSubject, new PrivilegedAction()
                {
View Full Code Here

        System.out.println("COMPLETED: running test user role fallback.");
    }
   
    protected Subject createSubject()
    {
        Set principals = new PrincipalsSet();
        Set publicCredentials = new HashSet();
        Set privateCredentials = new HashSet();
       
        principals.add(new UserImpl("david"));
        principals.add(new RoleImpl("ATP"));
        principals.add(new RoleImpl("NB"));       
        principals.add(new RoleImpl("ATP-NB"));
       
        Subject subject = new Subject(true, principals, publicCredentials, privateCredentials);       
        return subject;
    }
View Full Code Here

        return subject;
    }

    protected Subject createSubject2()
    {
        Set principals = new PrincipalsSet();
        Set publicCredentials = new HashSet();
        Set privateCredentials = new HashSet();

        principals.add(new UserImpl("david"));
        principals.add(new RoleImpl("ATP"));
        principals.add(new RoleImpl("NB"));
       
        Subject subject = new Subject(true, principals, publicCredentials, privateCredentials);       
        return subject;
    }
View Full Code Here

    return getSubject(new AuthenticatedUserImpl(user, null, null));
  }

  public Subject getSubject(AuthenticatedUser user) throws SecurityException
  {
    Set<Principal> principals = new PrincipalsSet();
    resolveSubjectPrincipals(user, principals);
    return JetspeedSubjectFactory.createSubject(user.getUser(), getPublicCredentialsForSubject(user), getPrivateCredentialsForSubject(user), principals);
  }
View Full Code Here

     */
    public Subject getUserSubject()
    {
        if ((userSubject == null) && (user != null))
        {
            Set userPrincipals = new PrincipalsSet();
            userPrincipals.add(new PageManagerTestShared.TestUser(user));
            if (groups != null)
            {
                String [] groupsArray = groups.split(",");
                for (int i = 0; (i < groupsArray.length); i++)
                {
                    userPrincipals.add(new PageManagerTestShared.TestGroup(groupsArray[i].trim()));                                   
                }
            }
            if (roles != null)
            {
                String [] rolesArray = roles.split(",");
                for (int i = 0; (i < rolesArray.length); i++)
                {
                    userPrincipals.add(new PageManagerTestShared.TestRole(rolesArray[i].trim()));                                   
                }
            }
            userSubject = new Subject(true, userPrincipals, new HashSet(), new HashSet());           
        }
        return userSubject;
View Full Code Here

    }
   
    private Subject constructUserSubject()
    {
        // setup test subject
        Set principals = new PrincipalsSet();
        principals.add(new TestUser("user"));
        principals.add(new TestGroup("group"));
        principals.add(new TestRole("role"));
        return new Subject(true, principals, new HashSet(), new HashSet());
    }
View Full Code Here

            // reset page manager cache
            pageManager.reset();
           
            // setup test subjects
            Set principals = new PrincipalsSet();
            principals.add(new TestUser("admin"));
            principals.add(new TestRole("admin"));
            Subject adminSubject = new Subject(true, principals, new HashSet(), new HashSet());
           
            principals = new PrincipalsSet();
            principals.add(new TestUser("user"));
            Subject userSubject = new Subject(true, principals, new HashSet(), new HashSet());
           
            principals = new PrincipalsSet();
            principals.add(new TestUser("manager"));
            principals.add(new TestRole("manager"));
            Subject managerSubject = new Subject(true, principals, new HashSet(), new HashSet());

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

            // setup test as admin user
            Exception setup = (Exception)JSSubject.doAsPrivileged(adminSubject, new PrivilegedAction()
                {
View Full Code Here

    }

    private Subject constructUserSubject()
    {
        // setup test subject
        Set principals = new PrincipalsSet();
        principals.add(new TestUser("user"));
        principals.add(new TestGroup("group"));
        principals.add(new TestRole("role"));
        return new Subject(true, principals, new HashSet(), new HashSet());
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.security.PrincipalsSet

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.