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(DseGSSAPIAuthProvider.builder().build())
.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 | Class and Description |
---|---|
static class |
DseGSSAPIAuthProvider.Builder |
AuthProvider.NoAuthProvider, AuthProvider.TransitionalModePlainTextAuthenticator
Modifier and Type | Field and Description |
---|---|
static Map<String,String> |
DEFAULT_SASL_PROPERTIES
The default SASL properties:
|
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()
Deprecated.
Use
DseGSSAPIAuthProvider.Builder to create DseGSSAPIAuthProvider instead. |
DseGSSAPIAuthProvider(Configuration loginConfiguration)
Deprecated.
Use
DseGSSAPIAuthProvider.Builder to create DseGSSAPIAuthProvider instead. |
DseGSSAPIAuthProvider(Configuration loginConfiguration,
String saslProtocol)
Deprecated.
Use
DseGSSAPIAuthProvider.Builder to create DseGSSAPIAuthProvider instead. |
DseGSSAPIAuthProvider(String saslProtocol)
Deprecated.
Use
DseGSSAPIAuthProvider.Builder to create DseGSSAPIAuthProvider instead. |
Modifier and Type | Method and Description |
---|---|
static DseGSSAPIAuthProvider.Builder |
builder() |
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
@Deprecated public DseGSSAPIAuthProvider()
DseGSSAPIAuthProvider.Builder
to create DseGSSAPIAuthProvider
instead.DseGSSAPIAuthProvider
with default login configuration options
and default SASL protocol name ("dse").@Deprecated public DseGSSAPIAuthProvider(Configuration loginConfiguration)
DseGSSAPIAuthProvider.Builder
to create DseGSSAPIAuthProvider
instead.DseGSSAPIAuthProvider
with the given login configuration and
default SASL protocol name ("dse").loginConfiguration
- The login configuration to use to create a LoginContext
.@Deprecated public DseGSSAPIAuthProvider(String saslProtocol)
DseGSSAPIAuthProvider.Builder
to create DseGSSAPIAuthProvider
instead.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.@Deprecated public DseGSSAPIAuthProvider(Configuration loginConfiguration, String saslProtocol)
DseGSSAPIAuthProvider.Builder
to create DseGSSAPIAuthProvider
instead.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 static DseGSSAPIAuthProvider.Builder builder()
public Authenticator newAuthenticator(InetSocketAddress host, String authenticator) throws AuthenticationException
AuthProvider
Authenticator
to use when connecting to host
newAuthenticator
in interface AuthProvider
host
- the Cassandra host to connect to.authenticator
- the configured authenticator on the host.AuthenticationException
Copyright © 2012–2019. All rights reserved.