expectAuthenticationError(final String expecte
}
};
}
-
}
diff --git a/test/unit/org/apache/cassandra/transport/MessagePayloadTest.java b/test/unit/org/apache/cassandra/transport/MessagePayloadTest.java
index a50174bd8702..42c6cbd021ba 100644
--- a/test/unit/org/apache/cassandra/transport/MessagePayloadTest.java
+++ b/test/unit/org/apache/cassandra/transport/MessagePayloadTest.java
@@ -127,7 +127,7 @@ public void testMessagePayloadBeta() throws Throwable
nativePort,
ProtocolVersion.V5,
true,
- new EncryptionOptions());
+ new EncryptionOptions.ClientEncryptionOptions());
try
{
client.connect(false);
diff --git a/test/unit/org/apache/cassandra/transport/SimpleClientSslContextFactory.java b/test/unit/org/apache/cassandra/transport/SimpleClientSslContextFactory.java
index 1a6871716a53..468c9cbc17b3 100644
--- a/test/unit/org/apache/cassandra/transport/SimpleClientSslContextFactory.java
+++ b/test/unit/org/apache/cassandra/transport/SimpleClientSslContextFactory.java
@@ -30,12 +30,12 @@
import org.apache.cassandra.config.EncryptionOptions;
import org.apache.cassandra.security.FileBasedSslContextFactory;
-import static org.apache.cassandra.config.EncryptionOptions.ClientAuth.NOT_REQUIRED;
+import static org.apache.cassandra.config.EncryptionOptions.ClientEncryptionOptions.ClientAuth.NOT_REQUIRED;
/**
* A custom implementation of {@link FileBasedSslContextFactory} to be used by tests utilizing {@link SimpleClient}.
*
- * Provides a subtly different implementation of {@link #createNettySslContext(EncryptionOptions.ClientAuth, SocketType, CipherSuiteFilter)}
+ * Provides a subtly different implementation of {@link #createNettySslContext(EncryptionOptions.ClientEncryptionOptions.ClientAuth, SocketType, CipherSuiteFilter)}
* that only configures an {@link SslContext} for clients and most importantly only configures a key manager if an
* outbound keystore is configured, where the existing implementation always does this. This is useful for tests
* that try to create a client that uses encryption but does not provide a certificate.
@@ -49,7 +49,7 @@ public SimpleClientSslContextFactory(Map parameters)
}
@Override
- public SSLContext createJSSESslContext(EncryptionOptions.ClientAuth clientAuth) throws SSLException
+ public SSLContext createJSSESslContext(EncryptionOptions.ClientEncryptionOptions.ClientAuth clientAuth) throws SSLException
{
TrustManager[] trustManagers = null;
if (clientAuth != NOT_REQUIRED)
@@ -76,7 +76,7 @@ public SSLContext createJSSESslContext(EncryptionOptions.ClientAuth clientAuth)
}
@Override
- public SslContext createNettySslContext(EncryptionOptions.ClientAuth clientAuth, SocketType socketType,
+ public SslContext createNettySslContext(EncryptionOptions.ClientEncryptionOptions.ClientAuth clientAuth, SocketType socketType,
CipherSuiteFilter cipherFilter) throws SSLException
{
SslContextBuilder builder = SslContextBuilder.forClient();
diff --git a/test/unit/org/apache/cassandra/transport/TlsTestUtils.java b/test/unit/org/apache/cassandra/transport/TlsTestUtils.java
index 30a6054127ca..76faec85b1eb 100644
--- a/test/unit/org/apache/cassandra/transport/TlsTestUtils.java
+++ b/test/unit/org/apache/cassandra/transport/TlsTestUtils.java
@@ -86,17 +86,18 @@ public class TlsTestUtils
public static String CLIENT_TRUSTSTORE_PATH = "test/conf/cassandra_ssl_test.truststore";
public static String CLIENT_TRUSTSTORE_PASSWORD = "cassandra";
- public static EncryptionOptions getClientEncryptionOptions()
+ public static EncryptionOptions.ClientEncryptionOptions getClientEncryptionOptions()
{
- return new EncryptionOptions(new EncryptionOptions()
+ return new EncryptionOptions.ClientEncryptionOptions(new EncryptionOptions.ClientEncryptionOptions.Builder()
.withEnabled(true)
- .withRequireClientAuth(EncryptionOptions.ClientAuth.OPTIONAL)
+ .withRequireClientAuth(EncryptionOptions.ClientEncryptionOptions.ClientAuth.OPTIONAL)
.withOptional(true)
.withKeyStore(SERVER_KEYSTORE_PATH)
.withKeyStorePassword(SERVER_KEYSTORE_PASSWORD)
.withTrustStore(SERVER_TRUSTSTORE_PATH)
.withTrustStorePassword(SERVER_TRUSTSTORE_PASSWORD)
- .withRequireEndpointVerification(false));
+ .withRequireEndpointVerification(false)
+ .build());
}
public static void configureWithMutualTlsWithPasswordFallbackAuthenticator(Config config)
@@ -129,7 +130,7 @@ public static SSLOptions getSSLOptions(boolean provideClientCert) throws SSLExce
{
return RemoteEndpointAwareJdkSSLOptions.builder()
.withSSLContext(getClientSslContextFactory(provideClientCert)
- .createJSSESslContext(EncryptionOptions.ClientAuth.OPTIONAL))
+ .createJSSESslContext(EncryptionOptions.ClientEncryptionOptions.ClientAuth.OPTIONAL))
.build();
}
@@ -139,7 +140,7 @@ public static SSLOptions getSSLOptions(Path keystorePath, Path truststorePath) t
{
return RemoteEndpointAwareJdkSSLOptions.builder()
.withSSLContext(getClientSslContextFactory(keystorePath, truststorePath)
- .createJSSESslContext(EncryptionOptions.ClientAuth.OPTIONAL))
+ .createJSSESslContext(EncryptionOptions.ClientEncryptionOptions.ClientAuth.OPTIONAL))
.build();
}
catch (SSLException e)
diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsTransport.java b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsTransport.java
index cf629998225b..ccdf0a53b207 100644
--- a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsTransport.java
+++ b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsTransport.java
@@ -44,31 +44,32 @@ public SettingsTransport(TOptions options, SettingsCredentials credentials)
this.credentials = credentials;
}
- public EncryptionOptions getEncryptionOptions()
+ public EncryptionOptions.ClientEncryptionOptions getEncryptionOptions()
{
- EncryptionOptions encOptions = new EncryptionOptions().applyConfig();
+ EncryptionOptions.ClientEncryptionOptions encOptions = new EncryptionOptions.ClientEncryptionOptions().applyConfig();
if (options.trustStore.present())
{
- encOptions = encOptions
- .withEnabled(true)
- .withTrustStore(options.trustStore.value())
- .withTrustStorePassword(options.trustStorePw.setByUser() ? options.trustStorePw.value() : credentials.transportTruststorePassword)
- .withAlgorithm(options.alg.value())
- .withProtocol(options.protocol.value())
- .withCipherSuites(options.ciphers.value().split(","));
+ EncryptionOptions.Builder encOptionsBuilder = new EncryptionOptions.ClientEncryptionOptions.Builder(encOptions)
+ .withEnabled(true)
+ .withTrustStore(options.trustStore.value())
+ .withTrustStorePassword(options.trustStorePw.setByUser() ? options.trustStorePw.value() : credentials.transportTruststorePassword)
+ .withAlgorithm(options.alg.value())
+ .withProtocol(options.protocol.value())
+ .withCipherSuites(options.ciphers.value().split(","));
+
if (options.keyStore.present())
{
- encOptions = encOptions
- .withKeyStore(options.keyStore.value())
- .withKeyStorePassword(options.keyStorePw.setByUser() ? options.keyStorePw.value() : credentials.transportKeystorePassword);
+ encOptionsBuilder.withKeyStore(options.keyStore.value())
+ .withKeyStorePassword(options.keyStorePw.setByUser() ? options.keyStorePw.value() : credentials.transportKeystorePassword);
}
else
{
// mandatory for SSLFactory.createSSLContext(), see CASSANDRA-9325
- encOptions = encOptions
- .withKeyStore(encOptions.truststore)
- .withKeyStorePassword(encOptions.truststore_password != null ? encOptions.truststore_password : credentials.transportTruststorePassword);
+ encOptionsBuilder.withKeyStore(encOptions.truststore)
+ .withKeyStorePassword(encOptions.truststore_password != null ? encOptions.truststore_password : credentials.transportTruststorePassword);
}
+
+ encOptions = encOptionsBuilder.build();
}
return encOptions;
}
diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java b/tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java
index 6aea048b4cc0..f81c4a9787c9 100644
--- a/tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java
+++ b/tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java
@@ -139,7 +139,7 @@ public JavaDriverClient getJavaDriverClient(String keyspace)
if (client != null)
return client;
- EncryptionOptions encOptions = transport.getEncryptionOptions();
+ EncryptionOptions.ClientEncryptionOptions encOptions = transport.getEncryptionOptions();
JavaDriverClient c = new JavaDriverClient(this, node.nodes, port.nativePort, encOptions);
c.connect(mode.compression());
if (keyspace != null)
diff --git a/tools/stress/src/org/apache/cassandra/stress/util/JavaDriverClient.java b/tools/stress/src/org/apache/cassandra/stress/util/JavaDriverClient.java
index 3d72828daf73..f2a92fe5aa7d 100644
--- a/tools/stress/src/org/apache/cassandra/stress/util/JavaDriverClient.java
+++ b/tools/stress/src/org/apache/cassandra/stress/util/JavaDriverClient.java
@@ -41,7 +41,7 @@
import org.apache.cassandra.security.SSLFactory;
import org.apache.cassandra.stress.settings.StressSettings;
-import static org.apache.cassandra.config.EncryptionOptions.ClientAuth.REQUIRED;
+import static org.apache.cassandra.config.EncryptionOptions.ClientEncryptionOptions.ClientAuth.REQUIRED;
public class JavaDriverClient
{
@@ -60,7 +60,7 @@ public class JavaDriverClient
public final int connectionsPerHost;
private final ProtocolVersion protocolVersion;
- private final EncryptionOptions encryptionOptions;
+ private final EncryptionOptions.ClientEncryptionOptions encryptionOptions;
private Cluster cluster;
private Session session;
private final LoadBalancingPolicy loadBalancingPolicy;
@@ -69,15 +69,15 @@ public class JavaDriverClient
public JavaDriverClient(StressSettings settings, String host, int port)
{
- this(settings, Collections.singletonList(host), port, new EncryptionOptions());
+ this(settings, Collections.singletonList(host), port, new EncryptionOptions.ClientEncryptionOptions());
}
public JavaDriverClient(StressSettings settings, List hosts, int port)
{
- this(settings, hosts, port, new EncryptionOptions());
+ this(settings, hosts, port, new EncryptionOptions.ClientEncryptionOptions());
}
- public JavaDriverClient(StressSettings settings, List hosts, int port, EncryptionOptions encryptionOptions)
+ public JavaDriverClient(StressSettings settings, List hosts, int port, EncryptionOptions.ClientEncryptionOptions encryptionOptions)
{
this.protocolVersion = settings.mode.protocolVersion;
this.hosts = hosts;
@@ -85,7 +85,7 @@ public JavaDriverClient(StressSettings settings, List hosts, int port, E
this.username = settings.mode.username;
this.password = settings.mode.password;
this.authProvider = settings.mode.authProvider;
- this.encryptionOptions = new EncryptionOptions(encryptionOptions).applyConfig();
+ this.encryptionOptions = new EncryptionOptions.ClientEncryptionOptions(encryptionOptions).applyConfig();
this.loadBalancingPolicy = loadBalancingPolicy(settings);
this.connectionsPerHost = settings.mode.connectionsPerHost == null ? 8 : settings.mode.connectionsPerHost;