Package com.datastax.driver.core
Class PlainTextAuthProvider
- java.lang.Object
-
- com.datastax.driver.core.PlainTextAuthProvider
-
- All Implemented Interfaces:
AuthProvider,ExtendedAuthProvider
public class PlainTextAuthProvider extends Object implements ExtendedAuthProvider
A simpleAuthProviderimplementation.This provider allows to programmatically define authentication information that will then apply to all hosts. The PlainTextAuthenticator instances it returns support SASL authentication using the PLAIN mechanism for version 2 (or above) of the CQL native protocol.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.datastax.driver.core.AuthProvider
AuthProvider.TransitionalModePlainTextAuthenticator
-
Nested classes/interfaces inherited from interface com.datastax.driver.core.ExtendedAuthProvider
ExtendedAuthProvider.NoAuthProvider
-
-
Field Summary
-
Fields inherited from interface com.datastax.driver.core.AuthProvider
NONE
-
-
Constructor Summary
Constructors Constructor Description PlainTextAuthProvider(String username, String password)Creates a new simple authentication information provider with the supplied credentials.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthenticatornewAuthenticator(EndPoint host, String authenticator)Uses the supplied credentials and the SASL PLAIN mechanism to login to the server.AuthenticatornewAuthenticator(InetSocketAddress host, String authenticator)TheAuthenticatorto use when connecting tohostvoidsetPassword(String password)Changes the password.voidsetUsername(String username)Changes the user name.
-
-
-
Method Detail
-
setUsername
public void setUsername(String username)
Changes the user name.The new credentials will be used for all connections initiated after this method was called.
- Parameters:
username- the new name.
-
setPassword
public void setPassword(String password)
Changes the password.The new credentials will be used for all connections initiated after this method was called.
- Parameters:
password- the new password.
-
newAuthenticator
public Authenticator newAuthenticator(EndPoint host, String authenticator)
Uses the supplied credentials and the SASL PLAIN mechanism to login to the server.- Specified by:
newAuthenticatorin interfaceExtendedAuthProvider- Parameters:
host- the Cassandra host with which we want to authenticateauthenticator- the configured authenticator on the host- Returns:
- an Authenticator instance which can be used to perform authentication negotiations on behalf of the client
-
newAuthenticator
public Authenticator newAuthenticator(InetSocketAddress host, String authenticator) throws AuthenticationException
Description copied from interface:AuthProviderTheAuthenticatorto use when connecting tohost- Specified by:
newAuthenticatorin interfaceAuthProvider- Specified by:
newAuthenticatorin interfaceExtendedAuthProvider- Parameters:
host- the Cassandra host to connect to.authenticator- the configured authenticator on the host.- Returns:
- The authentication implementation to use.
- Throws:
AuthenticationException
-
-