Search in sources :

Example 91 with SimplePrincipal

use of com.yahoo.athenz.auth.impl.SimplePrincipal 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);
}
Also used : UserAuthority(com.yahoo.athenz.auth.impl.UserAuthority) SimplePrincipal(com.yahoo.athenz.auth.impl.SimplePrincipal) Test(org.testng.annotations.Test)

Aggregations

SimplePrincipal (com.yahoo.athenz.auth.impl.SimplePrincipal)91 Test (org.testng.annotations.Test)73 PrincipalAuthority (com.yahoo.athenz.auth.impl.PrincipalAuthority)50 Path (java.nio.file.Path)45 SignedDomain (com.yahoo.athenz.zms.SignedDomain)37 ChangeLogStore (com.yahoo.athenz.zts.store.ChangeLogStore)37 DataStore (com.yahoo.athenz.zts.store.DataStore)37 MockZMSFileChangeLogStore (com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore)37 ZMSFileChangeLogStore (com.yahoo.athenz.zts.store.impl.ZMSFileChangeLogStore)37 CertificateAuthority (com.yahoo.athenz.auth.impl.CertificateAuthority)31 X509Certificate (java.security.cert.X509Certificate)30 X509CertRecord (com.yahoo.athenz.zts.cert.X509CertRecord)22 InstanceCertManager (com.yahoo.athenz.zts.cert.InstanceCertManager)19 Authority (com.yahoo.athenz.auth.Authority)18 HttpServletRequest (javax.servlet.http.HttpServletRequest)18 Principal (com.yahoo.athenz.auth.Principal)16 InstanceProvider (com.yahoo.athenz.instance.provider.InstanceProvider)14 InstanceConfirmation (com.yahoo.athenz.instance.provider.InstanceConfirmation)12 IOException (java.io.IOException)7 WebApplicationException (javax.ws.rs.WebApplicationException)7