Search in sources :

Example 1 with AthenzIdentityVerifier

use of com.yahoo.vespa.athenz.tls.AthenzIdentityVerifier in project vespa by vespa-engine.

the class AthenzIdentityVerifierTest method verifies_certificate_with_athenz_service_as_common_name.

@Test
public void verifies_certificate_with_athenz_service_as_common_name() throws Exception {
    AthenzIdentity trustedIdentity = new AthenzService("mydomain", "alice");
    AthenzIdentity unknownIdentity = new AthenzService("mydomain", "mallory");
    KeyPair keyPair = createKeyPair();
    AthenzIdentityVerifier verifier = new AthenzIdentityVerifier(singleton(trustedIdentity));
    assertTrue(verifier.verify("hostname", createSslSessionMock(createSelfSignedCertificate(keyPair, trustedIdentity))));
    assertFalse(verifier.verify("hostname", createSslSessionMock(createSelfSignedCertificate(keyPair, unknownIdentity))));
}
Also used : AthenzService(com.yahoo.vespa.athenz.api.AthenzService) KeyPair(java.security.KeyPair) AthenzIdentity(com.yahoo.vespa.athenz.api.AthenzIdentity) AthenzIdentityVerifier(com.yahoo.vespa.athenz.tls.AthenzIdentityVerifier) Test(org.junit.Test)

Aggregations

AthenzIdentity (com.yahoo.vespa.athenz.api.AthenzIdentity)1 AthenzService (com.yahoo.vespa.athenz.api.AthenzService)1 AthenzIdentityVerifier (com.yahoo.vespa.athenz.tls.AthenzIdentityVerifier)1 KeyPair (java.security.KeyPair)1 Test (org.junit.Test)1