public class PlainTextAuthProvider extends Object implements ExtendedAuthProvider
AuthProvider
implementation.
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.
AuthProvider.NoAuthProvider, AuthProvider.TransitionalModePlainTextAuthenticator
NONE
Constructor and Description |
---|
PlainTextAuthProvider(String username,
String password)
Creates a new simple authentication information provider with the supplied credentials.
|
Modifier and Type | Method and Description |
---|---|
Authenticator |
newAuthenticator(EndPoint host,
String authenticator)
Uses the supplied credentials and the SASL PLAIN mechanism to login to the server.
|
Authenticator |
newAuthenticator(InetSocketAddress host,
String authenticator)
The
Authenticator to use when connecting to host |
void |
setPassword(String password)
Changes the password.
|
void |
setUsername(String username)
Changes the user name.
|
public void setUsername(String username)
The new credentials will be used for all connections initiated after this method was called.
username
- the new name.public void setPassword(String password)
The new credentials will be used for all connections initiated after this method was called.
password
- the new password.public Authenticator newAuthenticator(EndPoint host, String authenticator)
newAuthenticator
in interface ExtendedAuthProvider
host
- the Cassandra host with which we want to authenticateauthenticator
- the configured authenticator on the hostpublic Authenticator newAuthenticator(InetSocketAddress host, String authenticator) throws AuthenticationException
AuthProvider
Authenticator
to use when connecting to host
newAuthenticator
in interface AuthProvider
newAuthenticator
in interface ExtendedAuthProvider
host
- the Cassandra host to connect to.authenticator
- the configured authenticator on the host.AuthenticationException
Copyright © 2012–2019. All rights reserved.