use of org.infinispan.server.core.configuration.SslConfiguration in project infinispan by infinispan.
the class HotRodSslFunctionalTest method connectClient.
@Override
protected HotRodClient connectClient(byte protocolVersion) {
SslConfiguration ssl = hotRodServer.getConfiguration().ssl();
SSLContext sslContext = new SslContextFactory().keyStoreFileName(ssl.keyStoreFileName()).keyStorePassword(ssl.keyStorePassword()).keyStoreType("pkcs12").trustStoreFileName(ssl.trustStoreFileName()).trustStorePassword(ssl.trustStorePassword()).trustStoreType("pkcs12").getContext();
SSLEngine sslEngine = SslContextFactory.getEngine(sslContext, true, false);
return new HotRodClient(hotRodServer.getHost(), hotRodServer.getPort(), cacheName, HotRodClient.DEFAULT_TIMEOUT_SECONDS, protocolVersion, sslEngine);
}
use of org.infinispan.server.core.configuration.SslConfiguration in project infinispan by infinispan.
the class NettyChannelInitializer method initializeChannel.
@Override
public void initializeChannel(Channel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast("iprules", ipRulesHandler);
if (statsHandler != null) {
pipeline.addLast("stats", statsHandler);
}
SslConfiguration ssl = server.getConfiguration().ssl();
if (ssl.enabled()) {
ApplicationProtocolConfig alpnConfig = getAlpnConfiguration();
// add default domain mapping
JdkSslContext defaultNettySslContext = SslUtils.createNettySslContext(ssl, ssl.sniDomainsConfiguration().get(SslConfiguration.DEFAULT_SNI_DOMAIN), alpnConfig);
DomainNameMappingBuilder<JdkSslContext> domainMappingBuilder = new DomainNameMappingBuilder<>(defaultNettySslContext);
// and the rest
ssl.sniDomainsConfiguration().forEach((k, v) -> {
if (!SslConfiguration.DEFAULT_SNI_DOMAIN.equals(k)) {
domainMappingBuilder.add(k, SslUtils.createNettySslContext(ssl, v, alpnConfig));
}
});
pipeline.addLast("sni", new SniHandler(domainMappingBuilder.build()));
}
if (decoder != null) {
// We can not use `decoder` here. Each invocation creates a new instance of decoder and it seems
// it can not be shared between pipelines.
// See https://issues.jboss.org/browse/ISPN-7765 for more details.
pipeline.addLast("decoder", server.getDecoder());
}
if (encoder != null) {
pipeline.addLast("encoder", encoder);
}
}
Aggregations