@Override public SecurityConfiguration get() { SecurityConfigurationBuilder securityBuilder = new ConfigurationBuilder().security(); SSLContext sslContext = (this.sslContextDependency != null) ? this.sslContextDependency.get() : null; securityBuilder.ssl().sslContext(sslContext).enabled(sslContext != null); return securityBuilder.create(); } }
public SecurityConfigurationHelper withSni(String sni) { this.security().ssl().sniHostName(sni); return this; }
@Override public SecurityConfiguration get() { SecurityConfigurationBuilder securityBuilder = new ConfigurationBuilder().security(); SSLContext sslContext = (this.sslContextDependency != null) ? this.sslContextDependency.get() : null; securityBuilder.ssl().sslContext(sslContext).enabled(sslContext != null); return securityBuilder.create(); } }
private static ConfigurationBuilder withSni(ConfigurationBuilder cb, String sniHostName, String trustorePath, char[] password) { cb = withSsl(cb, trustorePath, password); cb.security().ssl().sniHostName(sniHostName); return cb; } }
public SecurityConfigurationHelper withDefaultSsl() { this.security().ssl().enable() .keyStoreFileName(DEFAULT_KEYSTORE_PATH) .keyStorePassword(DEFAULT_KEYSTORE_PASSWORD.toCharArray()) .trustStoreFileName(DEFAULT_TRUSTSTORE_PATH) .trustStorePassword(DEFAULT_TRUSTSTORE_PASSWORD.toCharArray()); return this; }
private static ConfigurationBuilder withSsl(ConfigurationBuilder cb, String trustorePath, char[] password) { cb.security() .ssl() .enabled(true) .trustStoreFileName(trustorePath) .trustStorePassword(password); return cb; }
private ConfigurationBuilder securityConfig(final String keystoreName, final String truststoreName, RemoteInfinispanServer server) { ConfigurationBuilder builder = ITestUtils.createConfigBuilder(server.getHotrodEndpoint().getInetAddress().getHostName(), server.getHotrodEndpoint().getPort()); builder.security().ssl().enable().keyStoreFileName(ITestUtils.SERVER_CONFIG_DIR + File.separator + keystoreName) .keyStorePassword("secret".toCharArray()) .trustStoreFileName(ITestUtils.SERVER_CONFIG_DIR + File.separator + truststoreName) .trustStorePassword("secret".toCharArray()).maxRetries(3); return builder; }
public TestCluster build() { List<HotRodServer> hotRodServers = new ArrayList<>(); List<EmbeddedCacheManager> embeddedCacheManagers = new ArrayList<>(); for (int i = 0; i < numMembers; i++) { GlobalConfigurationBuilder gcb = new GlobalConfigurationBuilder(); gcb.transport().defaultTransport().clusterName(name); EmbeddedCacheManager clusteredCacheManager = createClusteredCacheManager(gcb, getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC)); caches.entrySet().forEach(entry -> clusteredCacheManager.defineConfiguration(entry.getKey(), entry.getValue().build())); embeddedCacheManagers.add(clusteredCacheManager); hotRodServers.add(HotRodClientTestingUtil.startHotRodServer(clusteredCacheManager, hotRodBuilder)); } int port = hotRodServers.get(0).getPort(); org.infinispan.client.hotrod.configuration.ConfigurationBuilder build = new org.infinispan.client.hotrod.configuration.ConfigurationBuilder(); build.addServer().port(port).host("localhost"); if (trustStoreFileName != null) { build.security().ssl().enable().trustStoreFileName(trustStoreFileName).trustStorePassword(trustStorePassword); } if (keyStoreFileName != null) { build.security().ssl().keyStoreFileName(keyStoreFileName).keyStorePassword(keyStorePassword); } return new TestCluster(hotRodServers, embeddedCacheManagers, new RemoteCacheManager(build.build())); }
@Test public void testViaDirectConfig() throws Exception { ConfigurationBuilder builder = new ConfigurationBuilder(); String hostname = ispnServer.getHotrodEndpoint().getInetAddress().getHostName(); builder.addServer().host(hostname).port(ispnServer.getHotrodEndpoint().getPort()); builder.security().ssl().enable().trustStoreFileName(DEFAULT_TRUSTSTORE_PATH).trustStorePassword(DEFAULT_TRUSTSTORE_PASSWORD.toCharArray()); remoteCacheManager = new RemoteCacheManager(builder.build()); remoteCache = remoteCacheManager.getCache(RemoteCacheManager.DEFAULT_CACHE_NAME); testPutGet(remoteCache); testSize(remoteCache); }
@Test public void testViaSslContextSetup() throws Exception { ConfigurationBuilder builder = new ConfigurationBuilder(); String hostname = ispnServer.getHotrodEndpoint().getInetAddress().getHostName(); builder.addServer().host(hostname).port(ispnServer.getHotrodEndpoint().getPort()); SSLContext cont = SslContextFactory.getContext(null, null, DEFAULT_TRUSTSTORE_PATH, DEFAULT_TRUSTSTORE_PASSWORD.toCharArray()); builder.security().ssl().sslContext(cont).enable(); remoteCacheManager = new RemoteCacheManager(builder.build()); remoteCache = remoteCacheManager.getCache(RemoteCacheManager.DEFAULT_CACHE_NAME); testPutGet(remoteCache); testSize(remoteCache); } }
public void initRCM() { controller.start(ARQ_NODE_1_ID); final SecurityConfigurationHelper cb = new SecurityConfigurationHelper(SASL_MECH).forIspnServer(server1).withServerName(TEST_SERVER_NAME).withDefaultSsl(); cb.security().ssl().keyAlias("client1"); rcm = new RemoteCacheManager(cb.forExternalAuth().build(), true); controller.stop(ARQ_NODE_1_ID); isInitialized = true; }