diff --git a/client/pom.xml b/client/pom.xml index d0ae4a78..12441eb9 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -5,9 +5,9 @@ io.split.client java-client-parent - 4.16.0 + 4.17.0-rc1 - 4.16.0 + 4.17.0-rc1 java-client jar Java Client diff --git a/client/src/main/java/io/split/client/SplitFactoryImpl.java b/client/src/main/java/io/split/client/SplitFactoryImpl.java index 978f1603..2e1ffe78 100644 --- a/client/src/main/java/io/split/client/SplitFactoryImpl.java +++ b/client/src/main/java/io/split/client/SplitFactoryImpl.java @@ -523,24 +523,7 @@ protected static SplitHttpClient buildSplitHttpClient(String apiToken, SplitClie SDKMetadata sdkMetadata, RequestDecorator requestDecorator) throws URISyntaxException { - SSLContext sslContext; - if (config.proxyMTLSAuth() != null) { - _log.debug("Proxy setup using mTLS"); - try { - KeyStore keyStore = KeyStore.getInstance("PKCS12"); - InputStream keystoreStream = java.nio.file.Files.newInputStream(Paths.get(config.proxyMTLSAuth().getP12File())); - keyStore.load(keystoreStream, config.proxyMTLSAuth().getP12FilePassKey().toCharArray()); - sslContext = SSLContexts.custom() - .loadKeyMaterial(keyStore, config.proxyMTLSAuth().getP12FilePassKey().toCharArray()) - .build(); - } catch (Exception e) { - _log.error("Exception caught while processing p12 file for Proxy mTLS auth: ", e); - _log.warn("Ignoring p12 mTLS config and switching to default context"); - sslContext = SSLContexts.createSystemDefault(); - } - } else { - sslContext = SSLContexts.createSystemDefault(); - } + SSLContext sslContext = buildSSLContext(config); SSLConnectionSocketFactory sslSocketFactory = SSLConnectionSocketFactoryBuilder.create() .setSslContext(sslContext) @@ -585,8 +568,10 @@ private static CloseableHttpClient buildSSEdHttpClient(String apiToken, SplitCli .setConnectTimeout(Timeout.ofMilliseconds(SSE_CONNECT_TIMEOUT)) .build(); + SSLContext sslContext = buildSSLContext(config); + SSLConnectionSocketFactory sslSocketFactory = SSLConnectionSocketFactoryBuilder.create() - .setSslContext(SSLContexts.createSystemDefault()) + .setSslContext(sslContext) .setTlsVersions(TLS.V_1_1, TLS.V_1_2) .build(); @@ -613,6 +598,28 @@ private static CloseableHttpClient buildSSEdHttpClient(String apiToken, SplitCli return httpClientbuilder.build(); } + private static SSLContext buildSSLContext(SplitClientConfig config) { + SSLContext sslContext; + if (config.proxyMTLSAuth() != null) { + _log.debug("Proxy setup using mTLS"); + try { + KeyStore keyStore = KeyStore.getInstance("PKCS12"); + InputStream keystoreStream = java.nio.file.Files.newInputStream(Paths.get(config.proxyMTLSAuth().getP12File())); + keyStore.load(keystoreStream, config.proxyMTLSAuth().getP12FilePassKey().toCharArray()); + sslContext = SSLContexts.custom() + .loadKeyMaterial(keyStore, config.proxyMTLSAuth().getP12FilePassKey().toCharArray()) + .build(); + } catch (Exception e) { + _log.error("Exception caught while processing p12 file for Proxy mTLS auth: ", e); + _log.warn("Ignoring p12 mTLS config and switching to default context"); + sslContext = SSLContexts.createSystemDefault(); + } + } else { + sslContext = SSLContexts.createSystemDefault(); + } + return sslContext; + } + private static HttpClientBuilder setupProxy(HttpClientBuilder httpClientbuilder, SplitClientConfig config) { _log.info("Initializing Split SDK with proxy settings"); DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(config.proxy()); diff --git a/okhttp-modules/pom.xml b/okhttp-modules/pom.xml index a8645f9c..a474be3a 100644 --- a/okhttp-modules/pom.xml +++ b/okhttp-modules/pom.xml @@ -5,10 +5,10 @@ java-client-parent io.split.client - 4.16.0 + 4.17.0-rc1 4.0.0 - 4.16.0 + 4.17.0-rc1 okhttp-modules jar http-modules diff --git a/pluggable-storage/pom.xml b/pluggable-storage/pom.xml index 21b0bdac..b67933fe 100644 --- a/pluggable-storage/pom.xml +++ b/pluggable-storage/pom.xml @@ -6,7 +6,7 @@ java-client-parent io.split.client - 4.16.0 + 4.17.0-rc1 2.1.0 diff --git a/pom.xml b/pom.xml index 7b21f1ec..5650bbc4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.split.client java-client-parent - 4.16.0 + 4.17.0-rc1 diff --git a/redis-wrapper/pom.xml b/redis-wrapper/pom.xml index 301739ce..679f5502 100644 --- a/redis-wrapper/pom.xml +++ b/redis-wrapper/pom.xml @@ -6,7 +6,7 @@ java-client-parent io.split.client - 4.16.0 + 4.17.0-rc1 redis-wrapper 3.1.1 diff --git a/testing/pom.xml b/testing/pom.xml index 0fae6cdf..9c01ba09 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -9,7 +9,7 @@ java-client-testing jar - 4.16.0 + 4.17.0-rc1 Java Client For Testing Testing suite for Java SDK for Split