Package org.candlepin.auth

Examples of org.candlepin.auth.Principal


        when(usa.findByLogin(eq("Aladdin"))).thenReturn(
            new User("Aladdin", "open sesame", true));

        interceptor.preProcess(req, rmethod);

        Principal p = ResteasyProviderFactory.getContextData(Principal.class);
        assertTrue(p instanceof UserPrincipal);
    }
View Full Code Here


        Class clazz = FakeResource.class;
        when(rmethod.getResourceClass()).thenReturn(clazz);

        interceptor.preProcess(req, rmethod);

        Principal p = ResteasyProviderFactory.getContextData(Principal.class);
        assertTrue(p instanceof NoAuthPrincipal);
    }
View Full Code Here

        when(usa.validateUser(eq("Aladdin"), eq("open sesame"))).thenReturn(true);
        when(usa.findByLogin(eq("Aladdin"))).thenReturn(new User("Aladdin", "open sesame"));

        interceptor.preProcess(req, rmethod);

        Principal p = ResteasyProviderFactory.getContextData(Principal.class);
        assertTrue(p instanceof UserPrincipal);
    }
View Full Code Here

        when(p.getName()).thenReturn("CN=" + c.getUuid() + ", C=US, L=Raleigh");
        when(cert.getSubjectDN()).thenReturn(p);

        interceptor.preProcess(req, rmethod);

        Principal p1 = ResteasyProviderFactory.getContextData(Principal.class);
        assertTrue(p1 instanceof ConsumerPrincipal);
        verify(consumerCurator).updateLastCheckin(c);
    }
View Full Code Here

    @Test
    public void noJobMapPrincipal() {
        List<Permission> permissions = Arrays.asList(new Permission[] {
            new OwnerPermission(new Owner("test_owner"), Access.ALL)
        });
        Principal principal = new UserPrincipal("testing", permissions, false);
        when(this.principalProvider.get()).thenReturn(principal);

        JobDetail detail = newJob().build();
        when(response.getEntity()).thenReturn(detail);
View Full Code Here

    @Test
    public void existingJobMapPrincipal() {
        List<Permission> permissions = Arrays.asList(new Permission[] {
            new OwnerPermission(new Owner("test_owner"), Access.ALL)
        });
        Principal principal = new UserPrincipal("testing", permissions, false);

        when(this.principalProvider.get()).thenReturn(principal);

        JobDataMap map = new JobDataMap();
        map.put("Temp", "something");
View Full Code Here

        String username = "(foo)@{baz}.[com]&?";
        User u = userCurator.create(new User(username, "dontcare"));
        ownerAdminRole.addUser(u);
        roleCurator.merge(ownerAdminRole);

        Principal emailuser = TestUtil.createPrincipal(username, owner,
            Access.ALL);
        setupPrincipal(emailuser);

        Consumer personal = TestUtil.createConsumer(personType, owner);
        personal.setName(((UserPrincipal) emailuser).getUsername());
View Full Code Here

        roleCurator.create(owner2Role);

        Set<Permission> perms = new HashSet<Permission>();
        perms.add(new OwnerPermission(owner1, Access.ALL));
        perms.add(new OwnerPermission(owner2, Access.READ_ONLY));
        Principal userPrincipal = new UserPrincipal(user.getUsername(), perms, false);

        // Requesting the list of owners for this user should assume ALL, and not
        // return owner2:
        List<Owner> owners = userResource.listUsersOwners(user.getUsername(),
            userPrincipal);
View Full Code Here

        owner1Role.addUser(user);
        roleCurator.create(owner1Role);

        Set<Permission> perms = new HashSet<Permission>();
        perms.add(new UsernameConsumersPermission(user, owner1));
        Principal userPrincipal = new UserPrincipal(user.getUsername(), perms, false);

        List<Owner> owners = userResource.listUsersOwners(user.getUsername(),
            userPrincipal);
        assertEquals(1, owners.size());
        assertEquals(owner1.getKey(), owners.get(0).getKey());
View Full Code Here

                log.debug("check for: " + username + " - password of length #" +
                    (password == null ? 0 : password.length()) + " = <omitted>");

                if (userServiceAdapter.validateUser(username, password)) {
                    Principal principal = createPrincipal(username);
                    if (log.isDebugEnabled()) {
                        log.debug("principal created for user '" + username);
                    }

                    return principal;
View Full Code Here

TOP

Related Classes of org.candlepin.auth.Principal

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.