use of org.apache.ignite.ssl.SslContextFactory in project cas by apereo.
the class IgniteTicketRegistryConfiguration method buildSecureTransportForIgniteConfiguration.
protected static SslContextFactory buildSecureTransportForIgniteConfiguration(final CasConfigurationProperties casProperties) {
val properties = casProperties.getTicket().getRegistry().getIgnite();
val nullKey = "NULL";
if (StringUtils.hasText(properties.getKeyStoreFilePath()) && StringUtils.hasText(properties.getKeyStorePassword()) && StringUtils.hasText(properties.getTrustStoreFilePath()) && StringUtils.hasText(properties.getTrustStorePassword())) {
val 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.getTrustStorePassword().toCharArray());
}
if (org.apache.commons.lang3.StringUtils.isNotBlank(properties.getKeyAlgorithm())) {
sslContextFactory.setKeyAlgorithm(properties.getKeyAlgorithm());
}
if (org.apache.commons.lang3.StringUtils.isNotBlank(properties.getProtocol())) {
sslContextFactory.setProtocol(properties.getProtocol());
}
if (org.apache.commons.lang3.StringUtils.isNotBlank(properties.getTrustStoreType())) {
sslContextFactory.setTrustStoreType(properties.getTrustStoreType());
}
if (org.apache.commons.lang3.StringUtils.isNotBlank(properties.getKeyStoreType())) {
sslContextFactory.setKeyStoreType(properties.getKeyStoreType());
}
return sslContextFactory;
}
return null;
}
use of org.apache.ignite.ssl.SslContextFactory in project ignite by apache.
the class NodeSslConnectionMetricTest method sslContextFactory.
/**
* Creates {@link SslContextFactory} with specified options.
*/
private SslContextFactory sslContextFactory(String keyStore, String trustStore, String cipherSuite, String protocol) {
SslContextFactory res = (SslContextFactory) sslTrustedFactory(keyStore, trustStore);
if (cipherSuite != null)
res.setCipherSuites(cipherSuite);
res.setProtocols(protocol);
return res;
}
use of org.apache.ignite.ssl.SslContextFactory in project ignite by apache.
the class ClientSslParametersTest method createSslFactory.
/**
* @return SSL factory.
*/
@NotNull
private SslContextFactory createSslFactory() {
SslContextFactory factory = (SslContextFactory) GridTestUtils.sslFactory();
factory.setCipherSuites(cipherSuites);
factory.setProtocols(protocols);
return factory;
}
use of org.apache.ignite.ssl.SslContextFactory in project ignite by apache.
the class Security method ssl.
@Test
void ssl() {
// tag::ssl-context-factory[]
IgniteConfiguration igniteCfg = new IgniteConfiguration();
SslContextFactory factory = new SslContextFactory();
factory.setKeyStoreFilePath("keystore/node.jks");
factory.setKeyStorePassword("123456".toCharArray());
factory.setTrustStoreFilePath("keystore/trust.jks");
factory.setTrustStorePassword("123456".toCharArray());
factory.setProtocol("TLSv1.3");
igniteCfg.setSslContextFactory(factory);
// end::ssl-context-factory[]
Ignition.start(igniteCfg).close();
}
use of org.apache.ignite.ssl.SslContextFactory in project ignite by apache.
the class JdbcThinConnectionAdditionalSecurityTest method getTestSslContextFactory.
/**
* @return Test SSL context factory.
*/
private static Factory<SSLContext> getTestSslContextFactory() {
SslContextFactory factory = new SslContextFactory();
factory.setKeyStoreFilePath(SRV_KEY_STORE_PATH);
factory.setKeyStorePassword("123456".toCharArray());
factory.setTrustStoreFilePath(TRUST_KEY_STORE_PATH);
factory.setTrustStorePassword("123456".toCharArray());
return factory;
}
Aggregations