kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 68d7d54014b4c6388a33f9dec0873d091ecf3738a4bcb76aec923b0852bc45f3 |
|---|---|
| Author | olim7t <omichallat+github@gmail.com> · 2016-01-26 18:16 +01:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2016-01-26 18:22 +01:00 |
| Parents | bb936e89652f |
7 files changed
modified driver-dist/pom.xml +0 −6
| @@ -40,12 +40,6 @@ | ||
| 40 | 40 | <artifactId>cassandra-driver-core</artifactId> |
| 41 | 41 | <version>${project.parent.version}</version> |
| 42 | 42 | </dependency> |
| 43 | - | |
| 44 | - <dependency> | |
| 45 | - <groupId>com.datastax.cassandra</groupId> | |
| 46 | - <artifactId>cassandra-driver-dse</artifactId> | |
| 47 | - <version>${project.parent.version}</version> | |
| 48 | - </dependency> | |
| 49 | 43 | </dependencies> |
| 50 | 44 | |
| 51 | 45 | <build> |
modified driver-dist/src/assembly/binary-tarball.xml +0 −1
| @@ -26,7 +26,6 @@ | ||
| 26 | 26 | <useAllReactorProjects>true</useAllReactorProjects> |
| 27 | 27 | <includes> |
| 28 | 28 | <include>com.datastax.cassandra:cassandra-driver-core</include> |
| 29 | - <include>com.datastax.cassandra:cassandra-driver-dse</include> | |
| 30 | 29 | <include>com.datastax.cassandra:cassandra-driver-mapping</include> |
| 31 | 30 | </includes> |
| 32 | 31 | <binaries> |
deleted driver-dse/pom.xml +0 −90
| @@ -1,90 +0,0 @@ | ||
| 1 | -<!-- | |
| 2 | - | |
| 3 | - Copyright (C) 2012-2015 DataStax Inc. | |
| 4 | - | |
| 5 | - Licensed under the Apache License, Version 2.0 (the "License"); | |
| 6 | - you may not use this file except in compliance with the License. | |
| 7 | - You may obtain a copy of the License at | |
| 8 | - | |
| 9 | - http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 | - | |
| 11 | - Unless required by applicable law or agreed to in writing, software | |
| 12 | - distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | - See the License for the specific language governing permissions and | |
| 15 | - limitations under the License. | |
| 16 | - | |
| 17 | ---> | |
| 18 | -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
| 19 | - <modelVersion>4.0.0</modelVersion> | |
| 20 | - <parent> | |
| 21 | - <groupId>com.datastax.cassandra</groupId> | |
| 22 | - <artifactId>cassandra-driver-parent</artifactId> | |
| 23 | - <version>2.0.13-SNAPSHOT</version> | |
| 24 | - </parent> | |
| 25 | - <artifactId>cassandra-driver-dse</artifactId> | |
| 26 | - <packaging>bundle</packaging> | |
| 27 | - <name>DataStax Java Driver for Apache Cassandra - DataStax Enterprise Module</name> | |
| 28 | - <description>Extensions to the CQL driver for use with DataStax Enterprise.</description> | |
| 29 | - <url>https://github.com/datastax/java-driver</url> | |
| 30 | - | |
| 31 | - <properties> | |
| 32 | - <main.basedir>${project.parent.basedir}</main.basedir> | |
| 33 | - </properties> | |
| 34 | - | |
| 35 | - <dependencies> | |
| 36 | - <dependency> | |
| 37 | - <groupId>com.datastax.cassandra</groupId> | |
| 38 | - <artifactId>cassandra-driver-core</artifactId> | |
| 39 | - <version>${project.parent.version}</version> | |
| 40 | - </dependency> | |
| 41 | - </dependencies> | |
| 42 | - | |
| 43 | - <build> | |
| 44 | - <plugins> | |
| 45 | - <plugin> | |
| 46 | - <groupId>org.apache.felix</groupId> | |
| 47 | - <artifactId>maven-bundle-plugin</artifactId> | |
| 48 | - <extensions>true</extensions> | |
| 49 | - <version>2.4.0</version> | |
| 50 | - <configuration> | |
| 51 | - <instructions> | |
| 52 | - <Bundle-SymbolicName>com.datastax.driver.dse</Bundle-SymbolicName> | |
| 53 | - <Bundle-Version>${project.version}</Bundle-Version> | |
| 54 | - <_include>-osgi.bnd</_include> | |
| 55 | - </instructions> | |
| 56 | - <supportedProjectTypes> | |
| 57 | - <supportedProjectType>jar</supportedProjectType> | |
| 58 | - <supportedProjectType>bundle</supportedProjectType> | |
| 59 | - <supportedProjectType>pom</supportedProjectType> | |
| 60 | - </supportedProjectTypes> | |
| 61 | - </configuration> | |
| 62 | - </plugin> | |
| 63 | - </plugins> | |
| 64 | - </build> | |
| 65 | - | |
| 66 | - <licenses> | |
| 67 | - <license> | |
| 68 | - <name>Apache 2</name> | |
| 69 | - <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | |
| 70 | - <distribution>repo</distribution> | |
| 71 | - <comments>Apache License Version 2.0</comments> | |
| 72 | - </license> | |
| 73 | - </licenses> | |
| 74 | - | |
| 75 | - <scm> | |
| 76 | - <connection>scm:git:git@github.com:datastax/java-driver.git</connection> | |
| 77 | - <developerConnection>scm:git:git@github.com:datastax/java-driver.git</developerConnection> | |
| 78 | - <url>https://github.com/datastax/java-driver</url> | |
| 79 | - <tag>HEAD</tag> | |
| 80 | - </scm> | |
| 81 | - | |
| 82 | - <developers> | |
| 83 | - <developer> | |
| 84 | - <name>Various</name> | |
| 85 | - <organization>DataStax</organization> | |
| 86 | - </developer> | |
| 87 | - </developers> | |
| 88 | - | |
| 89 | -</project> | |
| 90 | - |
deleted driver-dse/src/main/java/com/datastax/driver/auth/DseAuthProvider.java +0 −85
| @@ -1,85 +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.AuthProvider; | |
| 19 | -import com.datastax.driver.core.Authenticator; | |
| 20 | -import com.datastax.driver.core.exceptions.AuthenticationException; | |
| 21 | - | |
| 22 | -import java.net.InetSocketAddress; | |
| 23 | - | |
| 24 | -/** | |
| 25 | - * AuthProvider which supplies authenticator instances for clients to connect t | |
| 26 | - * DSE clusters secured with Kerberos | |
| 27 | - * <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 | - * <p/> | |
| 38 | - * See the following documents for further details on the | |
| 39 | - * <a href="https://docs.oracle.com/javase/6/docs/technotes/guides/security/jgss/tutorials/LoginConfigFile.html">JAAS Login Configuration File</a> and the | |
| 40 | - * <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/security/jaas/tutorials/GeneralAcnOnly.html">JAAS Authentication Tutorial</a> | |
| 41 | - * for more on JAAS in general. | |
| 42 | - * <p/> | |
| 43 | - * <h1>Authentication using ticket cache</h1> | |
| 44 | - * Run <code>kinit</code> to obtain a ticket and populate the cache before | |
| 45 | - * connecting. JAAS config: | |
| 46 | - * <p/> | |
| 47 | - * <pre> | |
| 48 | - * DseClient { | |
| 49 | - * com.sun.security.auth.module.Krb5LoginModule required | |
| 50 | - * useTicketCache=true | |
| 51 | - * renewTGT=true; | |
| 52 | - * }; | |
| 53 | - * </pre> | |
| 54 | - * <p/> | |
| 55 | - * <p/> | |
| 56 | - * <h1>Authentication using a keytab file</h1> | |
| 57 | - * To enable authentication using a keytab file, specify its location on disk. | |
| 58 | - * If your keytab contains more than one principal key, you should also specify | |
| 59 | - * which one to select. | |
| 60 | - * <p/> | |
| 61 | - * <pre> | |
| 62 | - * DseClient { | |
| 63 | - * com.sun.security.auth.module.Krb5LoginModule required | |
| 64 | - * useKeyTab=true | |
| 65 | - * keyTab="/path/to/file.keytab" | |
| 66 | - * principal="user@MYDOMAIN.COM"; | |
| 67 | - * }; | |
| 68 | - * </pre> | |
| 69 | - * <p/> | |
| 70 | - * To connect to clusters using internal authentication, use the standard method for | |
| 71 | - * setting credentials. eg: | |
| 72 | - * <p/> | |
| 73 | - * <pre> | |
| 74 | - * Cluster cluster = Cluster.builder() | |
| 75 | - * .addContactPoint(hostname) | |
| 76 | - * .withCredentials("username", "password") | |
| 77 | - * .build(); | |
| 78 | - * </pre> | |
| 79 | - */ | |
| 80 | -public class DseAuthProvider implements AuthProvider { | |
| 81 | - @Override | |
| 82 | - public Authenticator newAuthenticator(InetSocketAddress host) throws AuthenticationException { | |
| 83 | - return new KerberosAuthenticator(host); | |
| 84 | - } | |
| 85 | -} |
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 & 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 pom.xml +0 −1
| @@ -36,7 +36,6 @@ | ||
| 36 | 36 | <modules> |
| 37 | 37 | <module>driver-core</module> |
| 38 | 38 | <module>driver-examples</module> |
| 39 | - <module>driver-dse</module> | |
| 40 | 39 | <module>driver-dist</module> |
| 41 | 40 | </modules> |
| 42 | 41 |