use of org.candlepin.model.User in project candlepin by candlepin.
the class DefaultUserServiceAdapterTest method deletionValidationFail.
@Test
public void deletionValidationFail() {
User user = new User("guy", "pass");
user = this.service.createUser(user);
this.service.deleteUser(user);
Assert.assertFalse(this.service.validateUser("guy", "pass"));
}
use of org.candlepin.model.User in project candlepin by candlepin.
the class DefaultUserServiceAdapterTest method validationBadPassword.
@Test
public void validationBadPassword() {
User user = new User("dude", "password");
this.service.createUser(user);
Assert.assertFalse(this.service.validateUser("dude", "invalid"));
}
use of org.candlepin.model.User in project candlepin by candlepin.
the class DefaultUserServiceAdapterTest method validationPass.
@Test
public void validationPass() {
User user = new User("test_user", "mypassword");
this.service.createUser(user);
Assert.assertTrue(this.service.validateUser("test_user", "mypassword"));
}
use of org.candlepin.model.User in project candlepin by candlepin.
the class BasicAuthViaUserServiceTest method correctPrincipalColonPassword.
@Test
public void correctPrincipalColonPassword() throws Exception {
Owner owner = new Owner("user", "user");
setUserAndPassword("user", "1:2");
when(userService.validateUser("user", "1:2")).thenReturn(true);
Set<OwnerPermission> permissions = new HashSet<>();
permissions.add(new OwnerPermission(owner, Access.ALL));
when(userService.findByLogin("user")).thenReturn(new User());
UserPrincipal expected = new UserPrincipal("user", new ArrayList<>(permissions), false);
assertEquals(expected, this.auth.getPrincipal(request));
}
use of org.candlepin.model.User in project candlepin by candlepin.
the class ConsumerCuratorPermissionsTest method setupEditMyConsumersViewAllPrincipal.
private User setupEditMyConsumersViewAllPrincipal() {
Set<Permission> perms = new HashSet<>();
User u = new User("fakeuser", "dontcare");
perms.add(new UsernameConsumersPermission(u, owner));
perms.add(new OwnerPermission(owner, Access.READ_ONLY));
Principal p = new UserPrincipal(u.getUsername(), perms, false);
setupPrincipal(p);
return u;
}
Aggregations