Package org.candlepin.auth

Examples of org.candlepin.auth.Principal


        @SuppressWarnings("serial")
        public JobStatus create() {
            //sigh - all of this pain to construct a JobDetail
            //which does not have setters!
            Principal p = mock(Principal.class);
            when(p.getPrincipalName()).thenReturn(principalName);

            map.put(PinsetterJobListener.PRINCIPAL_KEY, p);
            map.put(JobStatus.TARGET_TYPE, JobStatus.TargetType.OWNER);
            map.put(JobStatus.TARGET_ID, ownerkey);
            JobStatus status = new JobStatus(
View Full Code Here


        assertEquals("unknown", status.getPrincipalName());
    }

    @Test
    public void knownPrincipalName() {
        Principal p = mock(Principal.class);
        when(p.getPrincipalName()).thenReturn("admin");
        JobDetail detail = mock(JobDetail.class);
        JobDataMap map = new JobDataMap();
        map.put(PinsetterJobListener.PRINCIPAL_KEY, p);
        when(detail.getKey()).thenReturn(JobKey.jobKey("name", "group"));
        when(detail.getJobDataMap()).thenReturn(map);
View Full Code Here

        @Override
        public Object invoke(MethodInvocation invocation) throws Throwable {
            SecurityHole securityHole = AuthUtil.checkForSecurityHoleAnnotation(
                invocation.getMethod());

            Principal principal = principalProvider.get();
            verifyAccess(invocation.getMethod(), principal, getArguments(invocation),
                securityHole);

            return invocation.proceed();
        }
View Full Code Here

        JobExecutionException e = mock(JobExecutionException.class);
        String longstr = RandomStringUtils.randomAlphanumeric(300);
        when(e.getMessage()).thenReturn(longstr);

        JobDataMap map = new JobDataMap();
        Principal principal = mock(Principal.class);
        when(principal.getPrincipalName()).thenReturn("test-admin");
        map.put(PinsetterJobListener.PRINCIPAL_KEY, principal);
        map.put(JobStatus.TARGET_TYPE, JobStatus.TargetType.OWNER);
        map.put(JobStatus.TARGET_ID, "10");

        JobDetail detail = mock(JobDetail.class);
View Full Code Here

        assertEquals(PinsetterJobListener.LISTENER_NAME, listener.getName());
    }

    @Test
    public void tobeExecuted() {
        Principal principal = mock(Principal.class);
        JobDataMap map = new JobDataMap();
        JobDetail detail = mock(JobDetail.class);
        JobStatus status = mock(JobStatus.class);

        map.put(PinsetterJobListener.PRINCIPAL_KEY, principal);
View Full Code Here

        verifyZeroInteractions(e);
    }

    @Test
    public void tobeExecutedNull() {
        Principal principal = mock(Principal.class);
        JobDataMap map = new JobDataMap();
        JobDetail detail = mock(JobDetail.class);
        JobStatus status = mock(JobStatus.class);

        map.put(PinsetterJobListener.PRINCIPAL_KEY, principal);
View Full Code Here

        verify(unitOfWork, atLeastOnce()).end();
    }

    @Test
    public void bug863518ToBeExecuted() {
        Principal principal = mock(Principal.class);
        JobDataMap map = new JobDataMap();
        JobDetail detail = mock(JobDetail.class);

        map.put(PinsetterJobListener.PRINCIPAL_KEY, principal);
View Full Code Here

    private EventFactory eventFactory;

    @Before
    public void init() throws Exception {
        principalProvider = mock(PrincipalProvider.class);
        Principal principal = mock(Principal.class);
        when(principalProvider.get()).thenReturn(principal);
        eventFactory = new EventFactory(principalProvider);
    }
View Full Code Here

    }

    protected Principal setupPrincipal(String username, Owner owner, Access verb) {
        OwnerPermission p = new OwnerPermission(owner, verb);
        // Only need a detached owner permission here:
        Principal ownerAdmin = new UserPrincipal(username, Arrays.asList(new Permission[] {
            p}), false);
        setupPrincipal(ownerAdmin);
        return ownerAdmin;
    }
View Full Code Here

    private User setupOnlyMyConsumersPrincipal() {
        Set<Permission> perms = new HashSet<Permission>();
        User u = new User("MySystemsAdmin", "passwd");
        perms.add(new UsernameConsumersPermission(u, owner));
        Principal p = new UserPrincipal(u.getUsername(), perms, false);
        setupPrincipal(p);
        return u;
    }
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.