Examples of PrincipalsSet


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

        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 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

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

        return subject;
    }

    protected Subject createSubject2()
    {
        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

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

    }
   
    public void testSubsiteRules()
    {
        RequestContext request = new MockRequestContext("/");
        Set principals = new PrincipalsSet();
        Set publicCredentials = new HashSet();
        Set privateCredentials = new HashSet();       
        principals.add(new UserPrincipalImpl("user"));
        principals.add(new RolePrincipalImpl("role"));
        request.setSubject(new Subject(true, principals, publicCredentials, privateCredentials));
        request.setLocale(new Locale("en", "US"));
        MockHttpServletRequest servletRequest = new MockHttpServletRequest();
        servletRequest.setServerName("www.domain.com");
        request.setRequest(servletRequest);
View Full Code Here

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

        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 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

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

        return subject;
    }

    protected Subject createSubject2()
    {
        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

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

     * @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.PrincipalsSet

            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
            Exception setup = (Exception)JSSubject.doAsPrivileged(adminSubject, new PrivilegedAction()
                {
View Full Code Here

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

            {
                UserManager userManager = (UserManager)Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.security.UserManager");
                boolean success = userManager.authenticate(username, password);
                if (success)
                {
                    Set principals = new PrincipalsSet();
                    Subject subject = new Subject(true, principals, new HashSet(), new HashSet());
                    UserPrincipal userPrincipal = new UserSubjectPrincipalImpl(username, subject);
                    principals.add(userPrincipal);
                    sRequest = wrapperRequest((HttpServletRequest)request, userPrincipal);
                    request.getSession().removeAttribute(LoginConstants.ERRORCODE);
                    HttpSession session = request.getSession(true);
                    session.setAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT, subject);
                    //System.out.println("*** login session = " + session);
View Full Code Here

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

        }
       
        //////////////////////////////////////////////////////////////////////////
        // Run Test
        ////////////       
        Set adminPrincipals = new PrincipalsSet();
        Set adminPublicCredentials = new HashSet();
        Set adminPrivateCredentials = new HashSet();
        Set userPrincipals = new PrincipalsSet();
        Set userPublicCredentials = new HashSet();
        Set userPrivateCredentials = new HashSet();
       
        adminPrincipals.add(adminUser);
        adminPrincipals.add(adminRole);
        adminPrincipals.add(userRole);

        userPrincipals.add(userUser);
        userPrincipals.add(userRole);
       
        try
        {
            Subject adminSubject = new Subject(true, adminPrincipals, adminPublicCredentials, adminPrivateCredentials);
            Subject userSubject = new Subject(true, userPrincipals, userPublicCredentials, userPrivateCredentials);                   
View Full Code Here

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

        }
       
        //////////////////////////////////////////////////////////////////////////
        // Run Test
        ////////////       
        Set principals = new PrincipalsSet();
        Set publicCredentials = new HashSet();
        Set privateCredentials = new HashSet();
        principals.add(user);
        principals.add(role1);
        principals.add(role2);

        try
        {
            Subject subject = new Subject(true, principals, publicCredentials, privateCredentials);       
            boolean access = pms.checkPermission(subject, perm1);
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.