use of org.candlepin.auth.ConsumerPrincipal in project candlepin by candlepin.
the class PoolResourceTest method testConsumerCannotListPoolsForAnotherOwnersConsumer.
@Test(expected = NotFoundException.class)
public void testConsumerCannotListPoolsForAnotherOwnersConsumer() {
Principal p = setupPrincipal(new ConsumerPrincipal(foreignConsumer, owner2));
securityInterceptor.enable();
poolResource.list(null, passConsumer.getUuid(), null, false, null, p, null);
}
use of org.candlepin.auth.ConsumerPrincipal in project candlepin by candlepin.
the class PoolResourceTest method consumerCanListOwnersPools.
@Test
public void consumerCanListOwnersPools() {
Principal p = setupPrincipal(new ConsumerPrincipal(passConsumer, owner1));
securityInterceptor.enable();
poolResource.list(owner1.getId(), null, null, false, null, p, null);
}
use of org.candlepin.auth.ConsumerPrincipal in project candlepin by candlepin.
the class ConsumerCheckInFilterTest method testUpdatesCheckinWithAnnotation.
@Test
public void testUpdatesCheckinWithAnnotation() throws Exception {
Date lastCheckin = this.consumer.getLastCheckin();
Thread.sleep(1000);
Method method = FakeResource.class.getMethod("checkinMethod", String.class);
mockResourceMethod(method);
interceptor.filter(getContext());
ConsumerPrincipal p = (ConsumerPrincipal) ResteasyProviderFactory.getContextData(Principal.class);
this.consumerCurator.refresh(this.consumer);
Date updatedLastCheckin = p.getConsumer().getLastCheckin();
assertNotEquals(lastCheckin, updatedLastCheckin);
}
use of org.candlepin.auth.ConsumerPrincipal in project candlepin by candlepin.
the class ConsumerResourceIntegrationTest method canNotDeleteConsumerOtherThanSelf.
@Test(expected = NotFoundException.class)
public void canNotDeleteConsumerOtherThanSelf() {
Consumer evilConsumer = TestUtil.createConsumer(standardSystemType, owner);
consumerCurator.create(evilConsumer);
setupPrincipal(new ConsumerPrincipal(evilConsumer, owner));
securityInterceptor.enable();
consumerResource.deleteConsumer(consumer.getUuid(), principal);
}
use of org.candlepin.auth.ConsumerPrincipal in project candlepin by candlepin.
the class ConsumerResourceIntegrationTest method testCannotGetAnotherConsumersCerts.
@Test(expected = NotFoundException.class)
public void testCannotGetAnotherConsumersCerts() {
consumerResource.bind(consumer.getUuid(), pool.getId().toString(), null, 1, null, null, false, null, null);
consumerResource.bind(consumer.getUuid(), pool.getId().toString(), null, 1, null, null, false, null, null);
consumerResource.bind(consumer.getUuid(), pool.getId().toString(), null, 1, null, null, false, null, null);
Consumer evilConsumer = TestUtil.createConsumer(standardSystemType, owner);
consumerCurator.create(evilConsumer);
setupPrincipal(new ConsumerPrincipal(evilConsumer, owner));
securityInterceptor.enable();
consumerResource.getEntitlementCertificates(consumer.getUuid(), null);
}
Aggregations