Package org.candlepin.auth

Examples of org.candlepin.auth.ConsumerPrincipal


    @Test(expected = ForbiddenException.class)
    public void testConsumerRoleCannotGetOwner() {
        Consumer c = TestUtil.createConsumer(owner);
        consumerTypeCurator.create(c.getType());
        consumerCurator.create(c);
        setupPrincipal(new ConsumerPrincipal(c));

        securityInterceptor.enable();

        ownerResource.getOwner(owner.getKey());
    }
View Full Code Here


    @Test
    public void testConsumerCanListPools() {
        Consumer c = TestUtil.createConsumer(owner);
        consumerTypeCurator.create(c.getType());
        consumerCurator.create(c);
        Principal principal = setupPrincipal(new ConsumerPrincipal(c));

        securityInterceptor.enable();

        ownerResource.listPools(owner.getKey(), null, null, null, false, null,
            null, new ArrayList<KeyValueParameter>(), principal, null);
View Full Code Here

    @Test(expected = ForbiddenException.class)
    public void testConsumerRoleCannotAccessOwnerAtomFeed() {
        Consumer c = TestUtil.createConsumer(owner);
        consumerTypeCurator.create(c.getType());
        consumerCurator.create(c);
        setupPrincipal(new ConsumerPrincipal(c));

        securityInterceptor.enable();

        ownerResource.getOwnerAtomFeed(owner.getKey());
    }
View Full Code Here

    @Test(expected = ForbiddenException.class)
    public void consumerCannotListAllConsumersInOwner() {
        Consumer c = TestUtil.createConsumer(owner);
        consumerTypeCurator.create(c.getType());
        consumerCurator.create(c);
        setupPrincipal(new ConsumerPrincipal(c));

        securityInterceptor.enable();

        ownerResource.listConsumers(owner.getKey(), null, null,
            new ArrayList<String>(), null, null, null);
View Full Code Here

        Consumer c = TestUtil.createConsumer(owner);
        consumerTypeCurator.create(c.getType());
        consumerCurator.create(c);

        Principal principal = setupPrincipal(new ConsumerPrincipal(c));
        securityInterceptor.enable();

        List<Pool> pools = ownerResource.listPools(owner.getKey(), c.getUuid(), null,
            p.getId(), true, null, null, new ArrayList<KeyValueParameter>(), principal, null);
        assertEquals(1, pools.size());
View Full Code Here

            product1.getId(), false, null, adminPrincipal, null);
    }

    @Test
    public void testListConsumerFiltering() {
        setupPrincipal(new ConsumerPrincipal(passConsumer));
        List<Pool> pools = poolResource.list(null, passConsumer.getUuid(), null, false,
            null, adminPrincipal, null);
        assertEquals(2, pools.size());

        verify(attrUtil, times(2)).buildCalculatedAttributes(any(Pool.class),
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

        if (principal instanceof ConsumerPrincipal) {
            // HACK: We need to do this after the principal has been pushed,
            // lest our security settings start getting upset when we try to
            // update a consumer without any roles:
            ConsumerPrincipal p = (ConsumerPrincipal) principal;
            consumerCurator.updateLastCheckin(p.getConsumer());
        }

        return principal;
    }
View Full Code Here

TOP

Related Classes of org.candlepin.auth.ConsumerPrincipal

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.