use of org.apache.ignite.ssl.SslContextFactory in project cas by apereo.
the class IgniteTicketRegistry method configureSecureTransport.
private void configureSecureTransport() {
final String nullKey = "NULL";
if (StringUtils.isNotBlank(properties.getKeyStoreFilePath()) && StringUtils.isNotBlank(properties.getKeyStorePassword()) && StringUtils.isNotBlank(properties.getTrustStoreFilePath()) && StringUtils.isNotBlank(properties.getTrustStorePassword())) {
final SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStoreFilePath(properties.getKeyStoreFilePath());
sslContextFactory.setKeyStorePassword(properties.getKeyStorePassword().toCharArray());
if (nullKey.equals(properties.getTrustStoreFilePath()) && nullKey.equals(properties.getTrustStorePassword())) {
sslContextFactory.setTrustManagers(SslContextFactory.getDisabledTrustManager());
} else {
sslContextFactory.setTrustStoreFilePath(properties.getTrustStoreFilePath());
sslContextFactory.setTrustStorePassword(properties.getKeyStorePassword().toCharArray());
}
if (StringUtils.isNotBlank(properties.getKeyAlgorithm())) {
sslContextFactory.setKeyAlgorithm(properties.getKeyAlgorithm());
}
if (StringUtils.isNotBlank(properties.getProtocol())) {
sslContextFactory.setProtocol(properties.getProtocol());
}
if (StringUtils.isNotBlank(properties.getTrustStoreType())) {
sslContextFactory.setTrustStoreType(properties.getTrustStoreType());
}
if (StringUtils.isNotBlank(properties.getKeyStoreType())) {
sslContextFactory.setKeyStoreType(properties.getKeyStoreType());
}
this.igniteConfiguration.setSslContextFactory(sslContextFactory);
}
}
use of org.apache.ignite.ssl.SslContextFactory in project ignite by apache.
the class JavaThinClient method configureSslInCluster.
void configureSslInCluster() {
// tag::cluster-ssl-configuration[]
IgniteConfiguration igniteCfg = new IgniteConfiguration();
ClientConnectorConfiguration clientCfg = new ClientConnectorConfiguration();
clientCfg.setSslEnabled(true);
clientCfg.setUseIgniteSslContextFactory(false);
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStoreFilePath("/path/to/server.jks");
sslContextFactory.setKeyStorePassword("123456".toCharArray());
sslContextFactory.setTrustStoreFilePath("/path/to/trust.jks");
sslContextFactory.setTrustStorePassword("123456".toCharArray());
clientCfg.setSslContextFactory(sslContextFactory);
igniteCfg.setClientConnectorConfiguration(clientCfg);
// end::cluster-ssl-configuration[]
}
use of org.apache.ignite.ssl.SslContextFactory in project ignite by apache.
the class Security method disableCertificateValidation.
@Test
void disableCertificateValidation() {
// tag::disable-validation[]
IgniteConfiguration igniteCfg = new IgniteConfiguration();
SslContextFactory factory = new SslContextFactory();
factory.setKeyStoreFilePath("keystore/node.jks");
factory.setKeyStorePassword("123456".toCharArray());
factory.setTrustManagers(SslContextFactory.getDisabledTrustManager());
igniteCfg.setSslContextFactory(factory);
// end::disable-validation[]
Ignition.start(igniteCfg).close();
}
use of org.apache.ignite.ssl.SslContextFactory in project ignite by apache.
the class GridCommandHandlerSslTest method createSslFactory.
/**
* @return SSL factory.
*/
@NotNull
private SslContextFactory createSslFactory() {
SslContextFactory factory = (SslContextFactory) GridTestUtils.sslFactory();
factory.setCipherSuites(cipherSuites);
return factory;
}
use of org.apache.ignite.ssl.SslContextFactory in project ignite by apache.
the class PlatformConfigurationUtils method writeSslContextFactory.
/**
* Writes the SSL context factory.
*
* @param w Writer.
* @param factory SslContextFactory.
*/
private static void writeSslContextFactory(BinaryRawWriter w, Factory<SSLContext> factory) {
assert w != null;
if (!(factory instanceof SslContextFactory)) {
w.writeBoolean(false);
return;
}
w.writeBoolean(true);
SslContextFactory sslCtxFactory = (SslContextFactory) factory;
w.writeString(sslCtxFactory.getKeyAlgorithm());
w.writeString(sslCtxFactory.getKeyStoreType());
w.writeString(sslCtxFactory.getKeyStoreFilePath());
w.writeString(new String(sslCtxFactory.getKeyStorePassword()));
w.writeString(sslCtxFactory.getProtocol());
w.writeString(sslCtxFactory.getTrustStoreType());
w.writeString(sslCtxFactory.getTrustStoreFilePath());
w.writeString(new String(sslCtxFactory.getTrustStorePassword()));
}
Aggregations