Search in sources :

Example 1 with TrustedUserPrincipal

use of org.candlepin.auth.TrustedUserPrincipal in project candlepin by candlepin.

the class ConsumerResourceCreationTest method oauthRegistrationSupported.

@Test
public void oauthRegistrationSupported() {
    // Should be able to register successfully with as a trusted user principal:
    Principal p = new TrustedUserPrincipal("anyuser");
    ConsumerDTO consumer = TestUtil.createConsumerDTO("sys.example.com", null, null, systemDto);
    resource.create(consumer, p, null, owner.getKey(), null, true);
}
Also used : TrustedUserPrincipal(org.candlepin.auth.TrustedUserPrincipal) ConsumerDTO(org.candlepin.dto.api.v1.ConsumerDTO) TrustedUserPrincipal(org.candlepin.auth.TrustedUserPrincipal) UserPrincipal(org.candlepin.auth.UserPrincipal) Principal(org.candlepin.auth.Principal) NoAuthPrincipal(org.candlepin.auth.NoAuthPrincipal) Test(org.junit.Test)

Example 2 with TrustedUserPrincipal

use of org.candlepin.auth.TrustedUserPrincipal in project candlepin by candlepin.

the class ConsumerResourceCreationTest method registerWithNoReleaseVer.

@Test
public void registerWithNoReleaseVer() {
    Principal p = new TrustedUserPrincipal("anyuser");
    ConsumerDTO consumer = TestUtil.createConsumerDTO("consumername", null, null, systemDto);
    resource.create(consumer, p, USER, owner.getKey(), null, true);
}
Also used : TrustedUserPrincipal(org.candlepin.auth.TrustedUserPrincipal) ConsumerDTO(org.candlepin.dto.api.v1.ConsumerDTO) TrustedUserPrincipal(org.candlepin.auth.TrustedUserPrincipal) UserPrincipal(org.candlepin.auth.UserPrincipal) Principal(org.candlepin.auth.Principal) NoAuthPrincipal(org.candlepin.auth.NoAuthPrincipal) Test(org.junit.Test)

Example 3 with TrustedUserPrincipal

use of org.candlepin.auth.TrustedUserPrincipal in project candlepin by candlepin.

the class ConsumerResourceCreationTest method registerWithNoInstalledProducts.

@Test
public void registerWithNoInstalledProducts() {
    Principal p = new TrustedUserPrincipal("anyuser");
    ConsumerDTO consumer = TestUtil.createConsumerDTO("consumerName", null, null, systemDto);
    resource.create(consumer, p, USER, owner.getKey(), null, true);
}
Also used : TrustedUserPrincipal(org.candlepin.auth.TrustedUserPrincipal) ConsumerDTO(org.candlepin.dto.api.v1.ConsumerDTO) TrustedUserPrincipal(org.candlepin.auth.TrustedUserPrincipal) UserPrincipal(org.candlepin.auth.UserPrincipal) Principal(org.candlepin.auth.Principal) NoAuthPrincipal(org.candlepin.auth.NoAuthPrincipal) Test(org.junit.Test)

Example 4 with TrustedUserPrincipal

use of org.candlepin.auth.TrustedUserPrincipal in project candlepin by candlepin.

the class ConsumerResourceCreationTest method setStatusOnCreate.

@Test
public void setStatusOnCreate() {
    Principal p = new TrustedUserPrincipal("anyuser");
    ConsumerDTO consumer = TestUtil.createConsumerDTO("consumername", null, null, systemDto);
    resource.create(consumer, p, USER, owner.getKey(), null, true);
    // Should be called with the consumer, null date (now),
    // no compliantUntil, and not update the consumer record
    verify(complianceRules).getStatus(any(Consumer.class), eq((Date) null), eq(false), eq(false));
}
Also used : TrustedUserPrincipal(org.candlepin.auth.TrustedUserPrincipal) Consumer(org.candlepin.model.Consumer) ConsumerDTO(org.candlepin.dto.api.v1.ConsumerDTO) TrustedUserPrincipal(org.candlepin.auth.TrustedUserPrincipal) UserPrincipal(org.candlepin.auth.UserPrincipal) Principal(org.candlepin.auth.Principal) NoAuthPrincipal(org.candlepin.auth.NoAuthPrincipal) Date(java.util.Date) Test(org.junit.Test)

Example 5 with TrustedUserPrincipal

use of org.candlepin.auth.TrustedUserPrincipal in project candlepin by candlepin.

the class ConsumerResourceCreationTest method registerWithEmptyReleaseVer.

@Test
public void registerWithEmptyReleaseVer() {
    Principal p = new TrustedUserPrincipal("anyuser");
    ConsumerDTO consumer = TestUtil.createConsumerDTO("consumername", null, null, systemDto);
    consumer.setReleaseVersion("");
    resource.create(consumer, p, USER, owner.getKey(), null, true);
}
Also used : TrustedUserPrincipal(org.candlepin.auth.TrustedUserPrincipal) ConsumerDTO(org.candlepin.dto.api.v1.ConsumerDTO) TrustedUserPrincipal(org.candlepin.auth.TrustedUserPrincipal) UserPrincipal(org.candlepin.auth.UserPrincipal) Principal(org.candlepin.auth.Principal) NoAuthPrincipal(org.candlepin.auth.NoAuthPrincipal) Test(org.junit.Test)

Aggregations

NoAuthPrincipal (org.candlepin.auth.NoAuthPrincipal)6 Principal (org.candlepin.auth.Principal)6 TrustedUserPrincipal (org.candlepin.auth.TrustedUserPrincipal)6 UserPrincipal (org.candlepin.auth.UserPrincipal)6 ConsumerDTO (org.candlepin.dto.api.v1.ConsumerDTO)6 Test (org.junit.Test)6 Date (java.util.Date)1 Consumer (org.candlepin.model.Consumer)1