com.datastax.driver.core.ExtendedAuthProvider Maven / Gradle / Ivy
/*
* Copyright DataStax, Inc.
*
* This software can be used solely with DataStax Enterprise. Please consult the license at
* http://www.datastax.com/terms/datastax-dse-driver-license-terms
*/
package com.datastax.driver.core;
import com.datastax.driver.core.exceptions.AuthenticationException;
import java.net.InetSocketAddress;
/**
* An auth provider that represents the host as an {@link EndPoint} instead of a raw {@link
* InetSocketAddress}.
*
* This interface exists solely for backward compatibility: it wasn't possible to change {@link
* AuthProvider} directly, because it would have broken every 3rd-party implementation.
*
*
All built-in providers now implement this interface, and it is recommended that new
* implementations do too.
*
*
When the driver calls an auth provider, it will check if it implements this interface. If so,
* it will call {@link #newAuthenticator(EndPoint, String)}; otherwise it will convert the endpoint
* into an address with {@link EndPoint#resolve()} and call {@link
* AuthProvider#newAuthenticator(InetSocketAddress, String)}.
*/
public interface ExtendedAuthProvider extends AuthProvider {
/**
* The {@code Authenticator} to use when connecting to {@code endpoint}.
*
* @param endPoint the Cassandra host to connect to.
* @param authenticator the configured authenticator on the host.
* @return The authentication implementation to use.
*/
Authenticator newAuthenticator(EndPoint endPoint, String authenticator)
throws AuthenticationException;
/**
* @deprecated the driver will never call this method on {@link ExtendedAuthProvider} instances.
* Implementors should throw {@link AssertionError}.
*/
@Override
@Deprecated
Authenticator newAuthenticator(InetSocketAddress host, String authenticator)
throws AuthenticationException;
}