Package org.candlepin.auth

Examples of org.candlepin.auth.Principal


        resource.create(consumer, p, USER, owner.getKey(), null);
    }

    @Test
    public void setStatusOnCreate() {
        Principal p = new TrustedUserPrincipal("anyuser");
        Consumer consumer = new Consumer();
        consumer.setType(system);
        consumer.setName("consumername");
        resource.create(consumer, p, USER, owner.getKey(), null);
        // Should be called with the consumer, null date (now),
View Full Code Here


    @Test
    public void testListForOrg() {
        List<Pool> pools = poolResource.list(owner1.getId(), null, null, false, null,
            adminPrincipal, null);
        assertEquals(2, pools.size());
        Principal p = setupPrincipal(owner2, Access.ALL);
        pools = poolResource.list(owner2.getId(), null, null, false, null, p, null);
        assertEquals(1, pools.size());
    }
View Full Code Here

    public void ownerAdminCannotListAnotherOwnersPools() {
        List<Pool> pools = poolResource.list(owner1.getId(), null, null, false, null,
            adminPrincipal, null);
        assertEquals(2, pools.size());

        Principal anotherPrincipal = setupPrincipal(owner2, Access.ALL);
        securityInterceptor.enable();

        poolResource.list(owner1.getId(), null, null, false, null, anotherPrincipal, null);
    }
View Full Code Here

    }


    @Test(expected = NotFoundException.class)
    public void testConsumerCannotListPoolsForAnotherOwnersConsumer() {
        Principal p = setupPrincipal(new ConsumerPrincipal(foreignConsumer));
        securityInterceptor.enable();

        poolResource.list(null, passConsumer.getUuid(), null, false, null, p, null);
    }
View Full Code Here

        poolResource.list(null, passConsumer.getUuid(), null, false, null, p, null);
    }

    @Test(expected = NotFoundException.class)
    public void consumerCannotListPoolsForAnotherOwner() {
        Principal p = setupPrincipal(new ConsumerPrincipal(foreignConsumer));
        securityInterceptor.enable();

        poolResource.list(owner1.getId(), null, null, false, null, p, null);
    }
View Full Code Here

        poolResource.list(owner1.getId(), null, null, false, null, p, null);
    }

    @Test
    public void consumerCanListOwnersPools() {
        Principal p = setupPrincipal(new ConsumerPrincipal(passConsumer));
        securityInterceptor.enable();

        poolResource.list(owner1.getId(), null, null, false, null, p, null);
    }
View Full Code Here

    private void compileRules(RulesCurator rulesCurator) {
        scriptLock.writeLock().lock();
        try {
            // XXX: we need a principal to access the rules,
            // but pushing and popping system principal could be a bad idea
            Principal systemPrincipal = new SystemPrincipal();
            ResteasyProviderFactory.pushContext(Principal.class, systemPrincipal);
            // Check to see if we need to recompile. we do this inside the write lock
            // just to avoid race conditions where we might double compile
            Date newUpdated = rulesCurator.getUpdated();
            if (newUpdated.equals(this.updated)) {
View Full Code Here

        return LISTENER_NAME;
    }

    @Override
    public void jobToBeExecuted(JobExecutionContext context) {
        Principal principal = (Principal) context.getMergedJobDataMap().get(PRINCIPAL_KEY);
        ResteasyProviderFactory.pushContext(Principal.class, principal);

        try {
            unitOfWork.begin();
            updateJob(context);
View Full Code Here

        this.principalName = getPrincipalName(jobDetail);
        this.jobClass = getJobClass(jobDetail);
    }

    private String getPrincipalName(JobDetail detail) {
        Principal p = (Principal) detail.getJobDataMap().get(
            PinsetterJobListener.PRINCIPAL_KEY);
        return p != null ? p.getPrincipalName() : "unknown";
    }
View Full Code Here

        throws Failure, WebApplicationException {

        SecurityHole securityHole = AuthUtil.checkForSecurityHoleAnnotation(
            method.getMethod());

        Principal principal = establishPrincipal(request, method, securityHole);
        try {
            verifyAccess(method.getMethod(), principal, getArguments(request, method),
                securityHole);
        }
        finally {
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.