Search in sources :

Example 1 with Authenticator

use of com.datastax.driver.core.Authenticator in project zipkin by openzipkin.

the class SessionFactoryTest method usernamePassword_impliesNullDelimitedUtf8Bytes.

@Test
public void usernamePassword_impliesNullDelimitedUtf8Bytes() {
    Authenticator authenticator = buildCluster(Cassandra3Storage.builder().username("bob").password("secret").build()).getConfiguration().getProtocolOptions().getAuthProvider().newAuthenticator(new InetSocketAddress("localhost", 8080), null);
    byte[] SASLhandshake = { 0, 'b', 'o', 'b', 0, 's', 'e', 'c', 'r', 'e', 't' };
    assertThat(authenticator.initialResponse()).isEqualTo(SASLhandshake);
}
Also used : InetSocketAddress(java.net.InetSocketAddress) Authenticator(com.datastax.driver.core.Authenticator) Test(org.junit.Test)

Example 2 with Authenticator

use of com.datastax.driver.core.Authenticator in project cassandra by apache.

the class PasswordAuthenticatorTest method testDecodeIllegalUserAndPwd.

private void testDecodeIllegalUserAndPwd(String username, String password) {
    SaslNegotiator negotiator = authenticator.newSaslNegotiator(null);
    Authenticator clientAuthenticator = (new PlainTextAuthProvider(username, password)).newAuthenticator((EndPoint) null, null);
    negotiator.evaluateResponse(clientAuthenticator.initialResponse());
    negotiator.getAuthenticatedUser();
}
Also used : SaslNegotiator(org.apache.cassandra.auth.PasswordAuthenticator.SaslNegotiator) PlainTextAuthProvider(com.datastax.driver.core.PlainTextAuthProvider) Authenticator(com.datastax.driver.core.Authenticator)

Example 3 with Authenticator

use of com.datastax.driver.core.Authenticator in project zipkin by openzipkin.

the class SessionFactoryTest method usernamePassword_impliesNullDelimitedUtf8Bytes.

@Test
public void usernamePassword_impliesNullDelimitedUtf8Bytes() {
    Authenticator authenticator = buildCluster(CassandraStorage.builder().username("bob").password("secret").build()).getConfiguration().getProtocolOptions().getAuthProvider().newAuthenticator(new InetSocketAddress("localhost", 8080), null);
    byte[] SASLhandshake = { 0, 'b', 'o', 'b', 0, 's', 'e', 'c', 'r', 'e', 't' };
    assertThat(authenticator.initialResponse()).isEqualTo(SASLhandshake);
}
Also used : InetSocketAddress(java.net.InetSocketAddress) Authenticator(com.datastax.driver.core.Authenticator) Test(org.junit.Test)

Aggregations

Authenticator (com.datastax.driver.core.Authenticator)3 InetSocketAddress (java.net.InetSocketAddress)2 Test (org.junit.Test)2 PlainTextAuthProvider (com.datastax.driver.core.PlainTextAuthProvider)1 SaslNegotiator (org.apache.cassandra.auth.PasswordAuthenticator.SaslNegotiator)1