Search in sources :

Example 11 with AuditLogMsgBuilder

use of com.yahoo.athenz.common.server.log.AuditLogMsgBuilder in project athenz by yahoo.

the class ZMSImplTest method testGetAuditLogMsgBuilder.

@Test
public void testGetAuditLogMsgBuilder() {
    AuditLogMsgBuilder msgBldr = ZMSUtils.getAuditLogMsgBuilder(mockDomRsrcCtx, auditLogger, "mydomain", auditRef, "myapi", "PUT");
    assertNotNull(msgBldr);
}
Also used : DefaultAuditLogMsgBuilder(com.yahoo.athenz.common.server.log.impl.DefaultAuditLogMsgBuilder) AuditLogMsgBuilder(com.yahoo.athenz.common.server.log.AuditLogMsgBuilder)

Example 12 with AuditLogMsgBuilder

use of com.yahoo.athenz.common.server.log.AuditLogMsgBuilder in project athenz by yahoo.

the class ZMSImplTest method testGetAuditLogMsgBuilderTokenWithSig.

@Test
public void testGetAuditLogMsgBuilderTokenWithSig() {
    Authority principalAuthority = new com.yahoo.athenz.common.server.debug.DebugPrincipalAuthority();
    String userId = "user1";
    String signature = "ABRACADABRA";
    String unsignedCreds = "v=U1;d=user;n=user1";
    Principal principal = SimplePrincipal.create("user", userId, unsignedCreds + ";s=" + signature, 0, principalAuthority);
    // set unsigned creds
    ((SimplePrincipal) principal).setUnsignedCreds(unsignedCreds);
    ResourceContext ctx = createResourceContext(principal);
    AuditLogMsgBuilder msgBldr = ZMSUtils.getAuditLogMsgBuilder(ctx, auditLogger, "mydomain", auditRef, "myapi", "PUT");
    assertNotNull(msgBldr);
    String who = msgBldr.who();
    assertNotNull(who);
    assertTrue(who.contains(userId));
    assertTrue(!who.contains(signature), "Should not contain the signature: " + who);
}
Also used : DefaultAuditLogMsgBuilder(com.yahoo.athenz.common.server.log.impl.DefaultAuditLogMsgBuilder) AuditLogMsgBuilder(com.yahoo.athenz.common.server.log.AuditLogMsgBuilder) Authority(com.yahoo.athenz.auth.Authority) PrincipalAuthority(com.yahoo.athenz.auth.impl.PrincipalAuthority) SimplePrincipal(com.yahoo.athenz.auth.impl.SimplePrincipal) Principal(com.yahoo.athenz.auth.Principal) SimplePrincipal(com.yahoo.athenz.auth.impl.SimplePrincipal)

Example 13 with AuditLogMsgBuilder

use of com.yahoo.athenz.common.server.log.AuditLogMsgBuilder in project athenz by yahoo.

the class ZMSImplTest method testGetAuditLogMsgBuilderNullCtx.

@Test
public void testGetAuditLogMsgBuilderNullCtx() {
    AuditLogMsgBuilder msgBldr = ZMSUtils.getAuditLogMsgBuilder(null, auditLogger, "mydomain", auditRef, "myapi", "PUT");
    assertNotNull(msgBldr);
}
Also used : DefaultAuditLogMsgBuilder(com.yahoo.athenz.common.server.log.impl.DefaultAuditLogMsgBuilder) AuditLogMsgBuilder(com.yahoo.athenz.common.server.log.AuditLogMsgBuilder)

Example 14 with AuditLogMsgBuilder

use of com.yahoo.athenz.common.server.log.AuditLogMsgBuilder in project athenz by yahoo.

the class ZMSImplTest method testGetAuditLogMsgBuilderNullParams.

@Test
public void testGetAuditLogMsgBuilderNullParams() {
    AuditLogMsgBuilder msgBldr = ZMSUtils.getAuditLogMsgBuilder(mockDomRsrcCtx, auditLogger, null, null, null, null);
    assertNotNull(msgBldr);
}
Also used : DefaultAuditLogMsgBuilder(com.yahoo.athenz.common.server.log.impl.DefaultAuditLogMsgBuilder) AuditLogMsgBuilder(com.yahoo.athenz.common.server.log.AuditLogMsgBuilder)

Example 15 with AuditLogMsgBuilder

use of com.yahoo.athenz.common.server.log.AuditLogMsgBuilder in project athenz by yahoo.

the class ZMSImplTest method testGetAuditLogMsgBuilderNullPrincipal.

@Test
public void testGetAuditLogMsgBuilderNullPrincipal() {
    ResourceContext ctx = createResourceContext(null);
    AuditLogMsgBuilder msgBldr = ZMSUtils.getAuditLogMsgBuilder(ctx, auditLogger, "mydomain", auditRef, "myapi", "PUT");
    assertNotNull(msgBldr);
}
Also used : DefaultAuditLogMsgBuilder(com.yahoo.athenz.common.server.log.impl.DefaultAuditLogMsgBuilder) AuditLogMsgBuilder(com.yahoo.athenz.common.server.log.AuditLogMsgBuilder)

Aggregations

AuditLogMsgBuilder (com.yahoo.athenz.common.server.log.AuditLogMsgBuilder)24 DefaultAuditLogMsgBuilder (com.yahoo.athenz.common.server.log.impl.DefaultAuditLogMsgBuilder)14 Principal (com.yahoo.athenz.auth.Principal)13 SimplePrincipal (com.yahoo.athenz.auth.impl.SimplePrincipal)12 AuditLogger (com.yahoo.athenz.common.server.log.AuditLogger)8 Test (org.testng.annotations.Test)8 HashSet (java.util.HashSet)7 DefaultAuditLogger (com.yahoo.athenz.common.server.log.impl.DefaultAuditLogger)6 SignedDomain (com.yahoo.athenz.zms.SignedDomain)6 ChangeLogStore (com.yahoo.athenz.zts.store.ChangeLogStore)6 DataStore (com.yahoo.athenz.zts.store.DataStore)6 MockZMSFileChangeLogStore (com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore)6 ZMSFileChangeLogStore (com.yahoo.athenz.zts.store.impl.ZMSFileChangeLogStore)6 HttpServletRequest (javax.servlet.http.HttpServletRequest)6 X509Certificate (java.security.cert.X509Certificate)4 Authority (com.yahoo.athenz.auth.Authority)3 CryptoException (com.yahoo.athenz.auth.util.CryptoException)3 X509CertRequest (com.yahoo.athenz.zts.cert.X509CertRequest)3 PrincipalAuthority (com.yahoo.athenz.auth.impl.PrincipalAuthority)2 PrincipalToken (com.yahoo.athenz.auth.token.PrincipalToken)2