public class DseGSSAPIAuthProvider extends Object implements AuthProvider
AuthProvider that provides GSSAPI authenticator instances for clients to connect
to DSE clusters secured with DseAuthenticator.
To create a cluster using this auth provider, declare the following:
Cluster cluster = Cluster.builder()
.addContactPoint(hostname)
.withAuthProvider(new DseGSSAPIAuthProvider())
.build();
java.security.auth.login.config system property or by adding a
login.config.url.n entry in the java.security properties
file.
Alternatively a Configuration object can be provided using DseGSSAPIAuthProvider(Configuration) to
set the JAAS configuration programmatically.
See the following documents for further details:
kinit to obtain a ticket and populate the cache before
connecting. JAAS config:
DseClient {
com.sun.security.auth.module.Krb5LoginModule required
useTicketCache=true
renewTGT=true;
};
DseClient {
com.sun.security.auth.module.Krb5LoginModule required
useKeyTab=true
keyTab="/path/to/file.keytab"
principal="user@MYDOMAIN.COM";
};
"dse"".
Important: the SASL protocol name should match the username of the
Kerberos service principal used by the DSE server.
This information is specified in the dse.yaml file by the service_principal option under the
kerberos_options
section, and may vary from one DSE installation to another – especially if you
installed DSE with an automated package installer.
For example, if your dse.yaml file contains the following:
kerberos_options:
...
service_principal: cassandra/my.host.com@MY.REALM.COM
The correct SASL protocol name to use when authenticating against this DSE server is "cassandra".
Should you need to change the SASL protocol name, use one of the methods below:
DseGSSAPIAuthProvider(String) or DseGSSAPIAuthProvider(Configuration, String);dse.sasl.protocol system property when starting your application,
e.g. -Ddse.sasl.protocol=cassandra.dse.sasl.protocol system property.| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_SASL_PROTOCOL_NAME
The default SASL protocol name used by this auth provider.
|
static String |
SASL_PROTOCOL_NAME_PROPERTY
The name of the system property to use to specify the SASL protocol name.
|
NONE| Constructor and Description |
|---|
DseGSSAPIAuthProvider()
Creates an instance of
DseGSSAPIAuthProvider with default login configuration options and default
SASL protocol name ("dse"). |
DseGSSAPIAuthProvider(Configuration loginConfiguration)
Creates an instance of
DseGSSAPIAuthProvider with the given login configuration and default
SASL protocol name ("dse"). |
DseGSSAPIAuthProvider(Configuration loginConfiguration,
String saslProtocol)
Creates an instance of
DseGSSAPIAuthProvider with the given login configuration and the given
SASL protocol name. |
DseGSSAPIAuthProvider(String saslProtocol)
Creates an instance of
DseGSSAPIAuthProvider with default login configuration and the given
SASL protocol name. |
| Modifier and Type | Method and Description |
|---|---|
Authenticator |
newAuthenticator(InetSocketAddress host,
String authenticator)
The
Authenticator to use when connecting to host |
public static final String DEFAULT_SASL_PROTOCOL_NAME
public static final String SASL_PROTOCOL_NAME_PROPERTY
public DseGSSAPIAuthProvider()
DseGSSAPIAuthProvider with default login configuration options and default
SASL protocol name ("dse").public DseGSSAPIAuthProvider(Configuration loginConfiguration)
DseGSSAPIAuthProvider with the given login configuration and default
SASL protocol name ("dse").loginConfiguration - The login configuration to use to create a LoginContext.public DseGSSAPIAuthProvider(String saslProtocol)
DseGSSAPIAuthProvider with default login configuration and the given
SASL protocol name.saslProtocol - The SASL protocol name to use; should match the username of the
Kerberos service principal used by the DSE server.public DseGSSAPIAuthProvider(Configuration loginConfiguration, String saslProtocol)
DseGSSAPIAuthProvider with the given login configuration and the given
SASL protocol name.loginConfiguration - The login configuration to use to create a LoginContext.saslProtocol - The SASL protocol name to use; should match the username of the
Kerberos service principal used by the DSE server.public Authenticator newAuthenticator(InetSocketAddress host, String authenticator) throws AuthenticationException
AuthProviderAuthenticator to use when connecting to hostnewAuthenticator in interface AuthProviderhost - the Cassandra host to connect to.authenticator - the configured authenticator on the host.AuthenticationException