use of com.yahoo.athenz.auth.impl.UserAuthority in project athenz by yahoo.
the class SimplePrincipalTest method testSimplePrincipalNullRole.
@Test
public void testSimplePrincipalNullRole() {
UserAuthority userAuthority = new UserAuthority();
userAuthority.initialize();
assertNull(SimplePrincipal.create("user", fakeCreds, (List<String>) null, userAuthority));
}
use of com.yahoo.athenz.auth.impl.UserAuthority in project athenz by yahoo.
the class SimplePrincipalTest method testSimplePrincipalEmptyRole.
@Test
public void testSimplePrincipalEmptyRole() {
List<String> roles = new ArrayList<>();
UserAuthority userAuthority = new UserAuthority();
userAuthority.initialize();
assertNull(SimplePrincipal.create("user", fakeCreds, roles, userAuthority));
roles.add("newrole");
SimplePrincipal p = (SimplePrincipal) SimplePrincipal.create("user", fakeCreds, roles, userAuthority);
assertEquals(p.getRoles().size(), 1);
assertTrue(p.getRoles().contains("newrole"));
}
use of com.yahoo.athenz.auth.impl.UserAuthority in project athenz by yahoo.
the class SimplePrincipalTest method testSimplePrincipal.
@Test
public void testSimplePrincipal() {
String testApplicationId = "test_app_id";
SimplePrincipal p = (SimplePrincipal) SimplePrincipal.create("user", "jdoe", fakeCreds, null);
assertNotNull(p);
p.setUnsignedCreds(fakeUnsignedCreds);
p.setApplicationId(testApplicationId);
assertEquals(p.getName(), "jdoe");
assertEquals(p.getDomain(), "user");
assertEquals(p.getCredentials(), fakeCreds);
assertEquals(p.getUnsignedCredentials(), fakeUnsignedCreds);
assertEquals(p.getApplicationId(), testApplicationId);
UserAuthority userAuthority = new UserAuthority();
userAuthority.initialize();
p = (SimplePrincipal) SimplePrincipal.create("user", "jdoe", fakeCreds, userAuthority);
assertNotNull(p);
}
Aggregations