Elffuss BraidHub

kikocis/java-driver public

JAVA-1014 New AuthProvider implementations for DSE 5.0
Changeseta755b028aecd4f5f621802f9c888fa4ca85ea17b3da03a2cb6782e5a4d8cbb82
AuthorMike Adamson <madamson@datastax.com> · 2015-12-15 10:56 UTC
CommitterMike Adamson <madamson@datastax.com> · 2015-12-17 16:49 UTC
Parentseb582d920b5c

Browse the files at this changeset

7 files changed

added driver-dse/src/main/java/com/datastax/driver/auth/BaseDseAuthenticator.java +69 −0
@@ -0,0 +1,69 @@
1+/*
2+ * Copyright (C) 2012-2015 DataStax Inc.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+package com.datastax.driver.auth;
17+
18+import com.datastax.driver.core.Authenticator;
19+
20+/**
21+ * Base class for {@link Authenticator} implementations that want to make use of
22+ * the authentication scheme negotiation in the DseAuthenticator
23+ */
24+abstract class BaseDseAuthenticator implements Authenticator {
25+ private static final String DSE_AUTHENTICATOR = "com.datastax.bdp.cassandra.auth.DseAuthenticator";
26+ private final String authenticator;
27+
28+ protected BaseDseAuthenticator(String authenticator) {
29+ this.authenticator = authenticator;
30+ }
31+
32+ /**
33+ * Return a byte array containing the required SASL mechanism.
34+ * This should be one of:
35+ * <ul>
36+ * <li>"PLAIN".getBytes(Charsets.UTF_8);</li>
37+ * <li>"GSSAPI".getBytes(Charsets.UTF_8);</li>
38+ * </ul>
39+ *
40+ * @return a byte array containing the SASL mechanism
41+ */
42+ public abstract byte[] getMechanism();
43+
44+ /**
45+ * Return a byte array containing the expected successful server challenge.
46+ * This should be one of:
47+ * <ul>
48+ * <li>"PLAIN-START".getBytes(Charsets.UTF_8);</li>
49+ * <li>"GSSAPI-START".getBytes(Charsets.UTF_8);</li>
50+ * </ul>
51+ *
52+ * @return a byte array containing the server challenge
53+ */
54+ public abstract byte[] getInitialServerChallenge();
55+
56+ public byte[] initialResponse() {
57+ if (isDseAuthenticator())
58+ return getMechanism();
59+ else
60+ return evaluateChallenge(getInitialServerChallenge());
61+ }
62+
63+ public void onAuthenticationSuccess(byte[] token) {
64+ }
65+
66+ private boolean isDseAuthenticator() {
67+ return authenticator.equals(DSE_AUTHENTICATOR);
68+ }
69+}
modified driver-dse/src/main/java/com/datastax/driver/auth/DseAuthProvider.java +4 −63
@@ -15,70 +15,11 @@
1515 */
1616 package com.datastax.driver.auth;
1717
18-import com.datastax.driver.core.AuthProvider;
19-import com.datastax.driver.core.Authenticator;
20-import com.datastax.driver.core.exceptions.AuthenticationException;
21-
22-import java.net.InetSocketAddress;
23-
2418 /**
25- * AuthProvider which supplies authenticator instances for clients to connect t
26- * DSE clusters secured with Kerberos
19+ * @deprecated in favor of {@link DseGSSAPIAuthProvider}
2720 * <p/>
28- * The SASL protocol name defaults to "dse"; should you need to change that
29- * it can be overridden using the <code>dse.sasl.protocol</code> system property.
30- * <p/>
31- * Keytab and ticket cache settings are specified using a standard JAAS
32- * configuration file. The location of the file can be set using the
33- * <code>java.security.auth.login.config</code> system property or by adding a
34- * <code>login.config.url.n</code> entry in the <code>java.security</code> properties
35- * file.
36- * <p/>
37- * See the following documents for further details on the
38- * <a href="https://docs.oracle.com/javase/6/docs/technotes/guides/security/jgss/tutorials/LoginConfigFile.html">JAAS Login Configuration File</a> and the
39- * <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/security/jaas/tutorials/GeneralAcnOnly.html">JAAS Authentication Tutorial</a>
40- * for more on JAAS in general.
41- * <p/>
42- * <h1>Authentication using ticket cache</h1>
43- * Run <code>kinit</code> to obtain a ticket and populate the cache before
44- * connecting. JAAS config:
45- * <p/>
46- * <pre>
47- * DseClient {
48- * com.sun.security.auth.module.Krb5LoginModule required
49- * useTicketCache=true
50- * renewTGT=true;
51- * };
52- * </pre>
53- * <p/>
54- * <p/>
55- * <h1>Authentication using a keytab file</h1>
56- * To enable authentication using a keytab file, specify its location on disk.
57- * If your keytab contains more than one principal key, you should also specify
58- * which one to select.
59- * <p/>
60- * <pre>
61- * DseClient {
62- * com.sun.security.auth.module.Krb5LoginModule required
63- * useKeyTab=true
64- * keyTab="/path/to/file.keytab"
65- * principal="user@MYDOMAIN.COM";
66- * };
67- * </pre>
68- * <p/>
69- * To connect to clusters using internal authentication, use the standard method for
70- * setting credentials. eg:
71- * <p/>
72- * <pre>
73- * Cluster cluster = Cluster.builder()
74- * .addContactPoint(hostname)
75- * .withCredentials("username", "password")
76- * .build();
77- * </pre>
21+ * Please look at {@link DseGSSAPIAuthProvider} documentation for configuration
7822 */
79-public class DseAuthProvider implements AuthProvider {
80- @Override
81- public Authenticator newAuthenticator(InetSocketAddress host, String authenticator) throws AuthenticationException {
82- return new KerberosAuthenticator(host);
83- }
23+@Deprecated
24+public class DseAuthProvider extends DseGSSAPIAuthProvider {
8425 }
added driver-dse/src/main/java/com/datastax/driver/auth/DseGSSAPIAuthProvider.java +156 −0
@@ -0,0 +1,156 @@
1+/*
2+ * Copyright (C) 2012-2015 DataStax Inc.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+package com.datastax.driver.auth;
17+
18+import com.datastax.driver.core.AuthProvider;
19+import com.datastax.driver.core.Authenticator;
20+import com.datastax.driver.core.exceptions.AuthenticationException;
21+import com.google.common.base.Charsets;
22+import com.google.common.collect.ImmutableMap;
23+
24+import javax.security.auth.Subject;
25+import javax.security.auth.login.LoginContext;
26+import javax.security.auth.login.LoginException;
27+import javax.security.sasl.Sasl;
28+import javax.security.sasl.SaslClient;
29+import javax.security.sasl.SaslException;
30+import java.net.InetSocketAddress;
31+import java.security.PrivilegedActionException;
32+import java.security.PrivilegedExceptionAction;
33+import java.util.Arrays;
34+import java.util.Map;
35+
36+/**
37+ * AuthProvider that provides GSSAPI authenticator instances for clients to connect
38+ * to DSE clusters secured with the DseAuthenticator.
39+ * <p/>
40+ * <h1>Kerberos Authentication</h1>
41+ * The SASL protocol name defaults to "dse"; should you need to change that
42+ * it can be overridden using the <code>dse.sasl.protocol</code> system property.
43+ * <p/>
44+ * Keytab and ticket cache settings are specified using a standard JAAS
45+ * configuration file. The location of the file can be set using the
46+ * <code>java.security.auth.login.config</code> system property or by adding a
47+ * <code>login.config.url.n</code> entry in the <code>java.security</code> properties
48+ * file.
49+ * <p/>
50+ * See the following documents for further details on the
51+ * <a href="https://docs.oracle.com/javase/6/docs/technotes/guides/security/jgss/tutorials/LoginConfigFile.html">JAAS Login Configuration File</a> and the
52+ * <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/security/jaas/tutorials/GeneralAcnOnly.html">JAAS Authentication Tutorial</a>
53+ * for more on JAAS in general.
54+ * <p/>
55+ * <h1>Authentication using ticket cache</h1>
56+ * Run <code>kinit</code> to obtain a ticket and populate the cache before
57+ * connecting. JAAS config:
58+ * <p/>
59+ * <pre>
60+ * DseClient {
61+ * com.sun.security.auth.module.Krb5LoginModule required
62+ * useTicketCache=true
63+ * renewTGT=true;
64+ * };
65+ * </pre>
66+ * <p/>
67+ * <p/>
68+ * <h1>Authentication using a keytab file</h1>
69+ * To enable authentication using a keytab file, specify its location on disk.
70+ * If your keytab contains more than one principal key, you should also specify
71+ * which one to select.
72+ * <p/>
73+ * <pre>
74+ * DseClient {
75+ * com.sun.security.auth.module.Krb5LoginModule required
76+ * useKeyTab=true
77+ * keyTab="/path/to/file.keytab"
78+ * principal="user@MYDOMAIN.COM";
79+ * };
80+ * </pre>
81+ * To create a cluster using this auth provider:
82+ * <pre>
83+ * Cluster cluster = Cluster.builder()
84+ * .addContactPoint(hostname)
85+ * .withAuthProvider(new DseGSSAPIAuthProvider())
86+ * .build();
87+ * </pre>
88+ */
89+public class DseGSSAPIAuthProvider implements AuthProvider {
90+ public Authenticator newAuthenticator(InetSocketAddress host, String authenticator) throws AuthenticationException {
91+ return new GSSAPIAuthenticator(authenticator, host);
92+ }
93+
94+ private static class GSSAPIAuthenticator extends BaseDseAuthenticator {
95+ private static final String JAAS_CONFIG_ENTRY = "DseClient";
96+ private static final String[] SUPPORTED_MECHANISMS = new String[]{"GSSAPI"};
97+ private static final String SASL_PROTOCOL_NAME = "dse";
98+ private static final String SASL_PROTOCOL_NAME_PROPERTY = "dse.sasl.protocol";
99+ private static final Map<String, String> DEFAULT_PROPERTIES =
100+ ImmutableMap.<String, String>builder().put(Sasl.SERVER_AUTH, "true")
101+ .put(Sasl.QOP, "auth")
102+ .build();
103+ private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
104+ private static final byte[] MECHANISM = "GSSAPI".getBytes(Charsets.UTF_8);
105+ private static final byte[] SERVER_INITIAL_CHALLENGE = "GSSAPI-START".getBytes(Charsets.UTF_8);
106+
107+ private final Subject subject;
108+ private final SaslClient saslClient;
109+
110+ public GSSAPIAuthenticator(String authenticator, InetSocketAddress host) {
111+ super(authenticator);
112+ try {
113+ LoginContext login = new LoginContext(JAAS_CONFIG_ENTRY);
114+ login.login();
115+ subject = login.getSubject();
116+ saslClient = Sasl.createSaslClient(SUPPORTED_MECHANISMS,
117+ null,
118+ System.getProperty(SASL_PROTOCOL_NAME_PROPERTY, SASL_PROTOCOL_NAME),
119+ host.getAddress().getCanonicalHostName(),
120+ DEFAULT_PROPERTIES,
121+ null);
122+ } catch (LoginException e) {
123+ throw new RuntimeException(e);
124+ } catch (SaslException e) {
125+ throw new RuntimeException(e);
126+ }
127+ }
128+
129+ public byte[] getMechanism() {
130+ return MECHANISM.clone();
131+ }
132+
133+ public byte[] getInitialServerChallenge() {
134+ return SERVER_INITIAL_CHALLENGE.clone();
135+ }
136+
137+ public byte[] evaluateChallenge(byte[] challenge) {
138+ if (Arrays.equals(SERVER_INITIAL_CHALLENGE, challenge)) {
139+ if (!saslClient.hasInitialResponse()) {
140+ return EMPTY_BYTE_ARRAY;
141+ }
142+ challenge = EMPTY_BYTE_ARRAY;
143+ }
144+ final byte[] internalChallenge = challenge;
145+ try {
146+ return Subject.doAs(subject, new PrivilegedExceptionAction<byte[]>() {
147+ public byte[] run() throws SaslException {
148+ return saslClient.evaluateChallenge(internalChallenge);
149+ }
150+ });
151+ } catch (PrivilegedActionException e) {
152+ throw new RuntimeException(e.getException());
153+ }
154+ }
155+ }
156+}
added driver-dse/src/main/java/com/datastax/driver/auth/DsePlainTextAuthProvider.java +87 −0
@@ -0,0 +1,87 @@
1+/*
2+ * Copyright (C) 2012-2015 DataStax Inc.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+package com.datastax.driver.auth;
17+
18+import com.datastax.driver.core.AuthProvider;
19+import com.datastax.driver.core.Authenticator;
20+import com.datastax.driver.core.exceptions.AuthenticationException;
21+import com.google.common.base.Charsets;
22+
23+import java.net.InetSocketAddress;
24+import java.util.Arrays;
25+
26+import static com.google.common.base.Preconditions.checkNotNull;
27+
28+/**
29+ * AuthProvider that provides plain text authenticator instances for clients to connect
30+ * to DSE clusters secured with the DseAuthenticator.
31+ * <p/>
32+ * To create a cluster using this auth provider:
33+ * <pre>
34+ * Cluster cluster = Cluster.builder()
35+ * .addContactPoint(hostname)
36+ * .withAuthProvider(new DsePlainTextAuthProvider("username", "password"))
37+ * .build();
38+ * </pre>
39+ */
40+public class DsePlainTextAuthProvider implements AuthProvider {
41+ private final String username;
42+ private final String password;
43+
44+ public DsePlainTextAuthProvider(String username, String password) {
45+ checkNotNull(username, "username cannot be null");
46+ checkNotNull(password, "password cannot be null");
47+ this.username = username;
48+ this.password = password;
49+ }
50+
51+ public Authenticator newAuthenticator(InetSocketAddress host, String authenticator) throws AuthenticationException {
52+ return new PlainTextAuthenticator(authenticator, username, password);
53+ }
54+
55+ private static class PlainTextAuthenticator extends BaseDseAuthenticator {
56+ private static final byte[] MECHANISM = "PLAIN".getBytes(Charsets.UTF_8);
57+ private static final byte[] SERVER_INITIAL_CHALLENGE = "PLAIN-START".getBytes(Charsets.UTF_8);
58+ private final byte[] username;
59+ private final byte[] password;
60+
61+ public PlainTextAuthenticator(String authenticator, String username, String password) {
62+ super(authenticator);
63+ this.username = username.getBytes(Charsets.UTF_8);
64+ this.password = password.getBytes(Charsets.UTF_8);
65+ }
66+
67+ public byte[] getMechanism() {
68+ return MECHANISM.clone();
69+ }
70+
71+ public byte[] getInitialServerChallenge() {
72+ return SERVER_INITIAL_CHALLENGE.clone();
73+ }
74+
75+ public byte[] evaluateChallenge(byte[] challenge) {
76+ if (Arrays.equals(SERVER_INITIAL_CHALLENGE, challenge)) {
77+ byte[] token = new byte[username.length + password.length + 2];
78+ token[0] = 0;
79+ System.arraycopy(username, 0, token, 1, username.length);
80+ token[username.length + 1] = 0;
81+ System.arraycopy(password, 0, token, username.length + 2, password.length);
82+ return token;
83+ }
84+ throw new RuntimeException("Incorrect challenge from server");
85+ }
86+ }
87+}
deleted driver-dse/src/main/java/com/datastax/driver/auth/KerberosAuthenticator.java +0 −89
@@ -1,89 +0,0 @@
1-/*
2- * Copyright (C) 2012-2015 DataStax Inc.
3- *
4- * Licensed under the Apache License, Version 2.0 (the "License");
5- * you may not use this file except in compliance with the License.
6- * You may obtain a copy of the License at
7- *
8- * http://www.apache.org/licenses/LICENSE-2.0
9- *
10- * Unless required by applicable law or agreed to in writing, software
11- * distributed under the License is distributed on an "AS IS" BASIS,
12- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13- * See the License for the specific language governing permissions and
14- * limitations under the License.
15- */
16-package com.datastax.driver.auth;
17-
18-import com.datastax.driver.core.Authenticator;
19-import org.slf4j.Logger;
20-import org.slf4j.LoggerFactory;
21-
22-import javax.security.auth.Subject;
23-import javax.security.auth.login.LoginContext;
24-import javax.security.auth.login.LoginException;
25-import java.net.InetSocketAddress;
26-
27-/**
28- * Responsible for authenticating with secured DSE services using Kerberos
29- * over GSSAPI &amp; SASL. The actual SASL negotiation is delegated to a
30- * PrivilegedSaslClient which performs the priviledged actions on behalf
31- * of the logged in user.
32- */
33-public class KerberosAuthenticator implements Authenticator {
34- private static final Logger logger = LoggerFactory.getLogger(KerberosAuthenticator.class);
35-
36- public static final String JAAS_CONFIG_ENTRY = "DseClient";
37- public static final String[] SUPPORTED_MECHANISMS = new String[]{"GSSAPI"};
38- public static final String SASL_PROTOCOL_NAME = "dse";
39- public static final String SASL_PROTOCOL_NAME_PROPERTY = "dse.sasl.protocol";
40-
41- private final PrivilegedSaslClient saslClient;
42-
43- public KerberosAuthenticator(InetSocketAddress host) {
44- saslClient = new PrivilegedSaslClient(loginSubject(),
45- SUPPORTED_MECHANISMS,
46- null,
47- System.getProperty(SASL_PROTOCOL_NAME_PROPERTY, SASL_PROTOCOL_NAME),
48- host.getAddress().getCanonicalHostName(),
49- PrivilegedSaslClient.DEFAULT_PROPERTIES,
50- null);
51- }
52-
53- private Subject loginSubject() {
54- Subject subject = new Subject();
55- try {
56- LoginContext login = new LoginContext(JAAS_CONFIG_ENTRY, subject);
57- login.login();
58- return subject;
59- } catch (LoginException e) {
60- throw new RuntimeException(e);
61- }
62- }
63-
64- @Override
65- public byte[] initialResponse() {
66- return saslClient.getInitialResponse();
67- }
68-
69- @Override
70- public byte[] evaluateChallenge(byte[] challenge) {
71- byte[] response = saslClient.evaluateChallenge(challenge);
72- if (response == null) {
73- // If we generate a null response, then authentication has completed (if
74- // not, warn), and return without sending a response back to the server.
75- logger.trace("Response to server is null: authentication should now be complete.");
76- if (!saslClient.isComplete()) {
77- String error = "Client generated a null sasl response, but authentication is not complete.";
78- logger.error(error);
79- throw new RuntimeException(error);
80- }
81- }
82- return response;
83- }
84-
85- @Override
86- public void onAuthenticationSuccess(byte[] token) {
87- // no-op
88- }
89-}
deleted driver-dse/src/main/java/com/datastax/driver/auth/PrivilegedSaslClient.java +0 −144
@@ -1,144 +0,0 @@
1-/*
2- * Copyright (C) 2012-2015 DataStax Inc.
3- *
4- * Licensed under the Apache License, Version 2.0 (the "License");
5- * you may not use this file except in compliance with the License.
6- * You may obtain a copy of the License at
7- *
8- * http://www.apache.org/licenses/LICENSE-2.0
9- *
10- * Unless required by applicable law or agreed to in writing, software
11- * distributed under the License is distributed on an "AS IS" BASIS,
12- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13- * See the License for the specific language governing permissions and
14- * limitations under the License.
15- */
16-package com.datastax.driver.auth;
17-
18-import org.slf4j.Logger;
19-import org.slf4j.LoggerFactory;
20-
21-import javax.security.auth.Subject;
22-import javax.security.auth.callback.CallbackHandler;
23-import javax.security.sasl.Sasl;
24-import javax.security.sasl.SaslClient;
25-import javax.security.sasl.SaslException;
26-import java.security.PrivilegedAction;
27-import java.util.HashMap;
28-import java.util.Map;
29-
30-/**
31- * Wrapper around {@code SaslClient}, which performs necessary parts of
32- * the authentication protocol as {@code PrivilegedAction}s with the
33- * assumed identity of the {@code Subject} supplied in the constructor.
34- */
35-public class PrivilegedSaslClient {
36- private static final Logger logger = LoggerFactory.getLogger(PrivilegedSaslClient.class);
37-
38- public static final Map<String, String> DEFAULT_PROPERTIES = new HashMap<String, String>() {{
39- put(Sasl.SERVER_AUTH, "true");
40- put(Sasl.QOP, "auth");
41- }};
42- private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
43-
44- /**
45- * Used to respond to server challenges with SASL tokens
46- * represented as byte arrays.
47- */
48- private final SaslClient saslClient;
49-
50- /**
51- * The identity we intend to use when we authenticate with the server
52- */
53- private Subject clientIdentity;
54-
55- public PrivilegedSaslClient(final Subject clientIdentity,
56- final String[] mechanisms,
57- final String authzId,
58- final String protocol,
59- final String hostname,
60- final Map<String, String> properties,
61- final CallbackHandler callbackHandler) {
62- logger.trace("Initalising SASL client");
63- this.clientIdentity = clientIdentity;
64- saslClient = Subject.doAs(this.clientIdentity, new PrivilegedAction<SaslClient>() {
65- @Override
66- public javax.security.sasl.SaslClient run() {
67- try {
68- return Sasl.createSaslClient(
69- mechanisms,
70- authzId,
71- protocol,
72- hostname,
73- properties,
74- callbackHandler);
75- } catch (Exception e) {
76- logger.error("Error initialising SASL client", e);
77- throw new RuntimeException(e);
78- }
79- }
80- });
81- logger.trace("SASL client initialised");
82- }
83-
84-
85- /**
86- * Generate an initial token to start the SASL handshake with server.
87- *
88- * @return SaslTokenRequestMessage message to be sent to server.
89- */
90- public byte[] getInitialResponse() {
91- logger.trace("Initialising SASL handshake from client");
92- byte[] initialResponse = null;
93- if (saslClient.hasInitialResponse()) {
94- initialResponse = Subject.doAs(clientIdentity, new PrivilegedAction<byte[]>() {
95- @Override
96- public byte[] run() {
97- try {
98- return saslClient.evaluateChallenge(EMPTY_BYTE_ARRAY);
99- } catch (Exception e) {
100- throw new RuntimeException(e);
101- }
102- }
103- });
104- }
105- return initialResponse;
106- }
107-
108- /**
109- * Respond to server's SASL token
110- *
111- * @param challenge contains server's SASL token
112- * @return client's response SASL token, which will be null if authentication is complete
113- */
114- public byte[] evaluateChallenge(final byte[] challenge) {
115- logger.trace("Evaluating SASL server token");
116- if (saslClient.isComplete()) {
117- return null;
118- }
119- byte[] retval = Subject.doAs(clientIdentity, new PrivilegedAction<byte[]>() {
120- @Override
121- public byte[] run() {
122- try {
123- logger.trace("SASL client evaluating challenge");
124- byte[] retval = saslClient.evaluateChallenge(challenge);
125- logger.trace("SASL client is complete = " + saslClient.isComplete());
126- return retval;
127- } catch (SaslException e) {
128- logger.error("Failed to generate response to SASL server's token:", e);
129- throw new RuntimeException(e);
130- }
131- }
132- });
133- return retval;
134- }
135-
136- /**
137- * Is the SASL negotiation with the server complete
138- *
139- * @return true iff SASL authentication has successfully completed
140- */
141- public boolean isComplete() {
142- return saslClient.isComplete();
143- }
144-}
modified upgrade_guide/README.md +17 −12
@@ -55,7 +55,7 @@
5555
5656 <p>The driver runtime behavior changes in the following situations:</p>
5757 * By default, the driver now returns _mutable_, _non thread-safe_ instances for CQL collection types;
58- This affects methods `getList`, `getSet`, `getMap`, `getObject` and `get` for all instances of
58+ This affects methods `getList`, `getSet`, `getMap`, `getObject` and `get` for all instances of
5959 `GettableByIndexData` and `GettableByNameData` (`Row`, `BoundStatement`, `TupleValue` and `UDTValue`)
6060 * `RuntimeException`s thrown during serialization or deserialization might not be
6161 the same ones as before, due to the newly-introduced `CodecNotFoundException`
@@ -203,18 +203,18 @@
203203
204204 21. The mapper annotation `@Enumerated` has been removed, users should now
205205 use the newly-introduced `driver-extras` module to get automatic
206- enum-to-CQL mappings. Two new codecs provide the same functionality:
206+ enum-to-CQL mappings. Two new codecs provide the same functionality:
207207 `EnumOrdinalCodec` and `EnumNameCodec`:
208-
209- ```java
208+
209+ ```java
210210 enum Foo {...}
211211 enum Bar {...}
212-
212+
213213 // register the appropriate codecs
214214 CodecRegistry.DEFAULT_INSTANCE
215215 .register(new EnumOrdinalCodec<Foo>(Foo.class))
216216 .register(new EnumNameCodec<Bar>(Bar.class))
217-
217+
218218 // the following mappings are handled out-of-the-box
219219 @Table
220220 public class MyPojo {
@@ -223,22 +223,27 @@
223223 ...
224224 }
225225 ```
226-
226+
227227 22. The interface `IdempotenceAwarePreparedStatement` has been removed
228- and now the `PreparedStatement` interface exposes 2 new methods,
228+ and now the `PreparedStatement` interface exposes 2 new methods,
229229 `setIdempotent(Boolean)` and `isIdempotent()`.
230230
231-22. `RetryPolicy` and `ExtendedRetryPolicy` (introduced in 2.1.10)
232- were merged together; as a consequence, `RetryPolicy` now has one
231+23. `RetryPolicy` and `ExtendedRetryPolicy` (introduced in 2.1.10)
232+ were merged together; as a consequence, `RetryPolicy` now has one
233233 more method: `onRequestError`; see
234234 [JAVA-819](https://datastax-oss.atlassian.net/browse/JAVA-819) for
235235 more information. Furthermore, `FallthroughRetryPolicy` now returns
236236 `RetryDecision.rethrow()` when `onRequestError` is called.
237-
237+
238+24. 'DseAuthProvider' has been deprecated and is now replaced by
239+ 'DseGSSAPIAuthProvider' for kerberos authentication. 'DsePlainTextAuthProvider'
240+ has been introduced to handle plain text authentication with the
241+ 'DseAuthenticator'.
242+
238243
239244 ### 2.1.8
240245
241-2.1.8 is binary-compatible with 2.1.7 but introduces a small change in the
246+2.1.8 is binary-compatible with 2.1.7 but introduces a small change in the
242247 driver's behavior:
243248
244249 1. The list of contact points provided at startup is now shuffled before trying