Feature - sslProtocols setting added #3532

pull/3941/head
Nikita Koksharov 4 years ago
parent 64a81281a2
commit a9d54c36a8

@ -63,8 +63,9 @@ public class RedisClientConfig {
private String sslTruststorePassword;
private URL sslKeystore;
private String sslKeystorePassword;
private String[] sslProtocols;
private NettyHook nettyHook = new DefaultNettyHook();
public RedisClientConfig() {
}
@ -313,4 +314,11 @@ public class RedisClientConfig {
return this;
}
public String[] getSslProtocols() {
return sslProtocols;
}
public RedisClientConfig setSslProtocols(String[] sslProtocols) {
this.sslProtocols = sslProtocols;
return this;
}
}

@ -117,6 +117,7 @@ public class RedisChannelInitializer extends ChannelInitializer<Channel> {
}
SslContextBuilder sslContextBuilder = SslContextBuilder.forClient().sslProvider(provided);
sslContextBuilder.protocols(config.getSslProtocols());
if (config.getSslTruststore() != null) {
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());

@ -86,6 +86,8 @@ public class BaseConfig<T extends BaseConfig<T>> {
private String sslKeystorePassword;
private String[] sslProtocols;
private int pingConnectionInterval = 30000;
private boolean keepAlive;
@ -112,6 +114,7 @@ public class BaseConfig<T extends BaseConfig<T>> {
setSslTruststorePassword(config.getSslTruststorePassword());
setSslKeystore(config.getSslKeystore());
setSslKeystorePassword(config.getSslKeystorePassword());
setSslProtocols(config.getSslProtocols());
setPingConnectionInterval(config.getPingConnectionInterval());
setKeepAlive(config.isKeepAlive());
setTcpNoDelay(config.isTcpNoDelay());
@ -380,6 +383,24 @@ public class BaseConfig<T extends BaseConfig<T>> {
return (T) this;
}
public String[] getSslProtocols() {
return sslProtocols;
}
/**
* Defines SSL protocols.
* Example values: TLSv1.3, TLSv1.2, TLSv1.1, TLSv1
* <p>
* Default is <code>null</code>
*
* @param sslProtocols - protocols
* @return config
*/
public T setSslProtocols(String[] sslProtocols) {
this.sslProtocols = sslProtocols;
return (T) this;
}
public int getPingConnectionInterval() {
return pingConnectionInterval;
}

@ -371,6 +371,7 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
c.setSslTruststorePassword(cfg.getSslTruststorePassword());
c.setSslKeystore(cfg.getSslKeystore());
c.setSslKeystorePassword(cfg.getSslKeystorePassword());
c.setSslProtocols(cfg.getSslProtocols());
c.setRetryInterval(cfg.getRetryInterval());
c.setRetryAttempts(cfg.getRetryAttempts());
@ -441,6 +442,7 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
.setSslTruststorePassword(config.getSslTruststorePassword())
.setSslKeystore(config.getSslKeystore())
.setSslKeystorePassword(config.getSslKeystorePassword())
.setSslProtocols(config.getSslProtocols())
.setClientName(config.getClientName())
.setKeepPubSubOrder(cfg.isKeepPubSubOrder())
.setPingConnectionInterval(config.getPingConnectionInterval())

@ -40,6 +40,7 @@ public class SingleConnectionManager extends MasterSlaveConnectionManager {
newconfig.setSslTruststorePassword(cfg.getSslTruststorePassword());
newconfig.setSslKeystore(cfg.getSslKeystore());
newconfig.setSslKeystorePassword(cfg.getSslKeystorePassword());
newconfig.setSslProtocols(cfg.getSslProtocols());
newconfig.setRetryAttempts(cfg.getRetryAttempts());
newconfig.setRetryInterval(cfg.getRetryInterval());

Loading…
Cancel
Save