Skip to content

Commit 5d33eb3

Browse files
authored
Merge pull request #594 from splitio/development
Release 4.17.0
2 parents 6de4559 + 18adba3 commit 5d33eb3

File tree

19 files changed

+716
-40
lines changed

19 files changed

+716
-40
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
4.17.0 (Aug 22, 2025)
2+
- Added a maximum size payload when posting unique keys telemetry in batches
3+
- Added ProxyConfiguration parameter to support proxies, including Harness Forward Proxy, allowing also for more secured authentication options: MTLS, Bearer token and user/password authentication. Read more in our docs.
4+
15
4.16.1 (Jul 21, 2025)
26
- Fixed vulnerabilities:
37
- Upgraded org.apache.commons-commons-lang3 to 3.18.0

client/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<parent>
66
<groupId>io.split.client</groupId>
77
<artifactId>java-client-parent</artifactId>
8-
<version>4.16.1</version>
8+
<version>4.17.0</version>
99
</parent>
10-
<version>4.16.1</version>
10+
<version>4.17.0</version>
1111
<artifactId>java-client</artifactId>
1212
<packaging>jar</packaging>
1313
<name>Java Client</name>
@@ -24,7 +24,7 @@
2424
<version>0.8.0</version>
2525
<extensions>true</extensions>
2626
<configuration>
27-
<ignorePublishedComponents>true</ignorePublishedComponents>
27+
<ignorePublishedComponents>false</ignorePublishedComponents>
2828
<publishingServerId>central</publishingServerId>
2929
<autoPublish>false</autoPublish>
3030
<waitUntil>published</waitUntil>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package io.split.client;
2+
3+
import io.split.client.dtos.BearerCredentialsProvider;
4+
import org.apache.hc.client5.http.auth.AuthScope;
5+
import org.apache.hc.client5.http.auth.BearerToken;
6+
import org.apache.hc.client5.http.auth.Credentials;
7+
import org.apache.hc.core5.http.protocol.HttpContext;
8+
9+
class HttpClientDynamicCredentials implements org.apache.hc.client5.http.auth.CredentialsProvider {
10+
11+
private final BearerCredentialsProvider _bearerCredentialsProvider;
12+
13+
public HttpClientDynamicCredentials (BearerCredentialsProvider bearerCredentialsProvider) {
14+
_bearerCredentialsProvider = bearerCredentialsProvider;
15+
}
16+
17+
@Override
18+
public Credentials getCredentials(AuthScope authScope, HttpContext context) {
19+
20+
// This Provider is invoked every time a request is made.
21+
// This should invoke a user-custom provider responsible for:
22+
return new BearerToken(_bearerCredentialsProvider.getToken());
23+
}
24+
25+
}
26+

client/src/main/java/io/split/client/SplitClientConfig.java

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.split.client;
22

3+
import io.split.client.dtos.ProxyConfiguration;
34
import io.split.client.impressions.ImpressionListener;
45
import io.split.client.impressions.ImpressionsManager;
56
import io.split.client.utils.FileTypeEnum;
@@ -8,6 +9,7 @@
89
import io.split.storages.enums.OperationMode;
910
import io.split.storages.enums.StorageMode;
1011
import org.apache.hc.core5.http.HttpHost;
12+
import org.slf4j.LoggerFactory;
1113
import pluggable.CustomStorageWrapper;
1214

1315
import java.io.IOException;
@@ -27,13 +29,22 @@
2729
*/
2830
public class SplitClientConfig {
2931

32+
private static final org.slf4j.Logger _log = LoggerFactory.getLogger(SplitClientConfig.class);
3033
public static final String LOCALHOST_DEFAULT_FILE = "split.yaml";
3134
public static final String SDK_ENDPOINT = "https://sdk.split.io";
3235
public static final String EVENTS_ENDPOINT = "https://events.split.io";
3336
public static final String AUTH_ENDPOINT = "https://auth.split.io/api/v2/auth";
3437
public static final String STREAMING_ENDPOINT = "https://streaming.split.io/sse";
3538
public static final String TELEMETRY_ENDPOINT = "https://telemetry.split.io/api/v1";
3639

40+
public static class HttpScheme {
41+
private HttpScheme() {
42+
throw new IllegalStateException("Utility class");
43+
}
44+
public static final String HTTP = "http";
45+
public static final String HTTPS = "https";
46+
}
47+
3748
private final String _endpoint;
3849
private final String _eventsEndpoint;
3950

@@ -82,6 +93,7 @@ public class SplitClientConfig {
8293
private final ThreadFactory _threadFactory;
8394

8495
// Proxy configs
96+
private final ProxyConfiguration _proxyConfiguration;
8597
private final HttpHost _proxy;
8698
private final String _proxyUsername;
8799
private final String _proxyPassword;
@@ -118,6 +130,7 @@ private SplitClientConfig(String endpoint,
118130
HttpHost proxy,
119131
String proxyUsername,
120132
String proxyPassword,
133+
ProxyConfiguration proxyConfiguration,
121134
int eventsQueueSize,
122135
long eventSendIntervalInMillis,
123136
int maxStringLength,
@@ -171,6 +184,7 @@ private SplitClientConfig(String endpoint,
171184
_proxy = proxy;
172185
_proxyUsername = proxyUsername;
173186
_proxyPassword = proxyPassword;
187+
_proxyConfiguration = proxyConfiguration;
174188
_eventsQueueSize = eventsQueueSize;
175189
_eventSendIntervalInMillis = eventSendIntervalInMillis;
176190
_maxStringLength = maxStringLength;
@@ -302,6 +316,10 @@ public String proxyPassword() {
302316
return _proxyPassword;
303317
}
304318

319+
public ProxyConfiguration proxyConfiguration() {
320+
return _proxyConfiguration;
321+
}
322+
305323
public long eventSendIntervalInMillis() {
306324
return _eventSendIntervalInMillis;
307325
}
@@ -417,8 +435,8 @@ public boolean isSdkEndpointOverridden() {
417435
}
418436

419437
public CustomHttpModule alternativeHTTPModule() { return _alternativeHTTPModule; }
420-
public static final class Builder {
421438

439+
public static final class Builder {
422440
private String _endpoint = SDK_ENDPOINT;
423441
private boolean _endpointSet = false;
424442
private String _eventsEndpoint = EVENTS_ENDPOINT;
@@ -442,6 +460,7 @@ public static final class Builder {
442460
private int _proxyPort = -1;
443461
private String _proxyUsername;
444462
private String _proxyPassword;
463+
private ProxyConfiguration _proxyConfiguration;
445464
private int _eventsQueueSize = 500;
446465
private long _eventSendIntervalInMillis = 30 * (long)1000;
447466
private int _maxStringLength = 250;
@@ -734,32 +753,44 @@ public Builder waitBeforeShutdown(int waitTime) {
734753

735754
/**
736755
* The host location of the proxy. Default is localhost.
756+
* @deprecated
757+
* This method is deprecated.
758+
* <p> Use {@link ProxyConfiguration)} instead.
737759
*
738760
* @param proxyHost location of the proxy
739761
* @return this builder
740762
*/
763+
@Deprecated
741764
public Builder proxyHost(String proxyHost) {
742765
_proxyHost = proxyHost;
743766
return this;
744767
}
745768

746769
/**
747770
* The port of the proxy. Default is -1.
771+
* @deprecated
772+
* This method is deprecated.
773+
* <p> Use {@link ProxyConfiguration)} instead.
748774
*
749775
* @param proxyPort port for the proxy
750776
* @return this builder
751777
*/
778+
@Deprecated
752779
public Builder proxyPort(int proxyPort) {
753780
_proxyPort = proxyPort;
754781
return this;
755782
}
756783

757784
/**
758785
* Set the username for authentication against the proxy (if proxy settings are enabled). (Optional).
786+
* @deprecated
787+
* This method is deprecated.
788+
* <p> Use {@link ProxyConfiguration)} instead.
759789
*
760790
* @param proxyUsername
761791
* @return this builder
762792
*/
793+
@Deprecated
763794
public Builder proxyUsername(String proxyUsername) {
764795
_proxyUsername = proxyUsername;
765796
return this;
@@ -776,6 +807,17 @@ public Builder proxyPassword(String proxyPassword) {
776807
return this;
777808
}
778809

810+
/**
811+
* Set the mtls authentication against the proxy (if proxy settings are enabled). (Optional).
812+
*
813+
* @param proxyConfiguration
814+
* @return this builder
815+
*/
816+
public Builder proxyConfiguration(ProxyConfiguration proxyConfiguration) {
817+
_proxyConfiguration = proxyConfiguration;
818+
return this;
819+
}
820+
779821
/**
780822
* Disables running destroy() on shutdown by default.
781823
*
@@ -927,7 +969,7 @@ public Builder operationMode(OperationMode mode) {
927969

928970
/**
929971
*
930-
* @param storage mode
972+
* @param mode
931973
* @return this builder
932974
*/
933975
public Builder storageMode(StorageMode mode) {
@@ -1096,6 +1138,26 @@ private void verifyAlternativeClient() {
10961138
}
10971139
}
10981140

1141+
private void verifyProxy() {
1142+
if (_proxyConfiguration == null)
1143+
return;
1144+
1145+
if (_proxyPort != -1) {
1146+
_log.warn("Both the deprecated proxy configuration methods (`proxyHost`, `proxyPort`, `proxyUsername`, or `proxyPassword`) " +
1147+
"and the new `ProxyConfiguration` builder are being used. `ProxyConfiguration` will take precedence.");
1148+
}
1149+
1150+
if (!(_proxyConfiguration.getHost().getSchemeName().equals(HttpScheme.HTTP) ||
1151+
_proxyConfiguration.getHost().getSchemeName().equals(HttpScheme.HTTPS))) {
1152+
throw new IllegalArgumentException("Proxy scheme must be either http or https.");
1153+
}
1154+
1155+
if ((_proxyConfiguration.getP12File() != null && _proxyConfiguration.getPassKey() == null) ||
1156+
(_proxyConfiguration.getP12File() == null && _proxyConfiguration.getPassKey() != null)) {
1157+
throw new IllegalArgumentException("Proxy mTLS must have p12 file path and name, and pass phrase.");
1158+
}
1159+
}
1160+
10991161
public SplitClientConfig build() {
11001162

11011163
verifyRates();
@@ -1108,6 +1170,8 @@ public SplitClientConfig build() {
11081170

11091171
verifyAlternativeClient();
11101172

1173+
verifyProxy();
1174+
11111175
if (_numThreadsForSegmentFetch <= 0) {
11121176
throw new IllegalArgumentException("Number of threads for fetching segments MUST be greater than zero");
11131177
}
@@ -1133,6 +1197,7 @@ public SplitClientConfig build() {
11331197
proxy(),
11341198
_proxyUsername,
11351199
_proxyPassword,
1200+
_proxyConfiguration,
11361201
_eventsQueueSize,
11371202
_eventSendIntervalInMillis,
11381203
_maxStringLength,

0 commit comments

Comments
 (0)