use of org.apache.zookeeper.server.MockServerCnxn in project zookeeper by apache.
the class X509AuthTest method testTrustedAuth.
@Test
public void testTrustedAuth() {
X509AuthenticationProvider provider = createProvider(clientCert);
MockServerCnxn cnxn = new MockServerCnxn();
cnxn.clientChain = new X509Certificate[] { clientCert };
Assert.assertEquals(KeeperException.Code.OK, provider.handleAuthentication(cnxn, null));
}
use of org.apache.zookeeper.server.MockServerCnxn in project zookeeper by apache.
the class X509AuthTest method testUntrustedAuth.
@Test
public void testUntrustedAuth() {
X509AuthenticationProvider provider = createProvider(clientCert);
MockServerCnxn cnxn = new MockServerCnxn();
cnxn.clientChain = new X509Certificate[] { unknownCert };
Assert.assertEquals(KeeperException.Code.AUTHFAILED, provider.handleAuthentication(cnxn, null));
}
use of org.apache.zookeeper.server.MockServerCnxn in project zookeeper by apache.
the class X509AuthTest method testSuperAuth.
@Test
public void testSuperAuth() {
X509AuthenticationProvider provider = createProvider(superCert);
MockServerCnxn cnxn = new MockServerCnxn();
cnxn.clientChain = new X509Certificate[] { superCert };
Assert.assertEquals(KeeperException.Code.OK, provider.handleAuthentication(cnxn, null));
Assert.assertEquals("super", cnxn.getAuthInfo().get(0).getScheme());
}
Aggregations