Reputation: 23
I want to ask if we can pass username and password in database connection url Example:
jdbc:cassandra:keyspace=keyspace1;host=host;port=port;user=user;password=password;
I'm using cdata drivers for apache cassandra. And if yes, how can i create a user with password whom I'll via the connection url? And no, the documentation on datastax is not helping me out.
Upvotes: 1
Views: 2002
Reputation: 784
In short, yes. Set the AuthScheme Connection property to 'Basic' and set the User and Password connection properties, in addition to the other necessary properties:
jdbc:cassandra:AuthSchem=BASIC;User=<username>;Password=<password>;...
@Aaron offers the solution for creating the first user: How do you create the first user in Cassandra DB
From the online CData JDBC Driver for Cassandra help:
The driver supports Basic authentication with login credentials and the additional authentication features of DataStax Enterprise (DSE) Cassandra. The following sections detail connection properties your authentication method may require.
You need to set AuthScheme to the value corresponding to the authenticator configured for your system. You specify the authenticator in the authenticator property in the cassandra.yaml file. This file is typically found in
/etc/dse/cassandra
. or through the DSE Unified Authenticator on DSE Cassandra.Basic Authentication
Basic authentication is supported through Cassandra's built-in default PasswordAuthenticator.
- Set the AuthScheme property to 'BASIC' and set the User and Password properties.
- In the cassandra.yaml file, set the authenticator property to 'PasswordAuthenticator'.
Kerberos Authentication
Kerberos authentication is supported through DataStax Enterprise Unified Authentication.
- Set the AuthScheme property to 'KERBEROS' and set the User and Password properties.
- Set the KerberosKDC, KerberosRealm, and KerberosSPN properties.
- In the cassandra.yaml file, set the authenticator property to "com.datastax.bdp.cassandra.auth.DseAuthenticator".
- Modify the authentication_options section in the dse.yaml file, specifying the default_schema and other_schemas properties as 'kerberos'.
- Modify the kerberos_options section in the dse.yaml file, specifying the keytab, service_principle, http_principle and qop properties
LDAP Authentication
LDAP authentication is supported through DataStax Enterprise Unified Authentication.
- Set the AuthScheme property to 'LDAP' and set the User and Password properties.
- In the cassandra.yaml file, set the authenticator property to "com.datastax.bdp.cassandra.auth.DseAuthenticator".
- Modify the authentication_options section in the dse.yaml file, specifying the default_schema and other_schemas properties as 'ldap'.
- Modify the ldap_options section in the dse.yaml file, specifying the server_host, server_port, search_dn, search_password, user_search_base, and user_search_filter properties
Using PKI
You can specify a client certificate to authenticate the driver with SSLClientCert, SSLClientCertType, SSLClientCertSubject, and SSLClientCertPassword.
Upvotes: 1