use of org.infinispan.persistence.remote.configuration.SecurityConfigurationBuilder in project infinispan by infinispan.
the class RemoteStoreSSLTest method buildConfig.
@Override
protected Configuration buildConfig(ConfigurationBuilder builder) {
serverCacheManager = TestCacheManagerFactory.createCacheManager(new GlobalConfigurationBuilder().defaultCacheName(REMOTE_CACHE), hotRodCacheConfiguration(builder));
ClassLoader cl = RemoteStoreSSLTest.class.getClassLoader();
// Unfortunately BaseNonBlockingStoreTest stops and restarts the store, which can start a second hrServer - prevent that
if (hrServer == null) {
serverCache = serverCacheManager.getCache(REMOTE_CACHE);
TestingUtil.replaceComponent(serverCacheManager, TimeService.class, timeService, true);
SimpleServerAuthenticationProvider sap = new SimpleServerAuthenticationProvider();
HotRodServerConfigurationBuilder serverBuilder = HotRodTestingUtil.getDefaultHotRodConfiguration();
serverBuilder.ssl().enable().requireClientAuth(true).keyStoreFileName(cl.getResource("keystore_server.jks").getPath()).keyStorePassword("secret".toCharArray()).keyAlias("hotrod").trustStoreFileName(cl.getResource("ca.jks").getPath()).trustStorePassword("secret".toCharArray());
serverBuilder.authentication().enable().serverName("localhost").addAllowedMech("EXTERNAL").serverAuthenticationProvider(sap);
hrServer = new HotRodServer();
hrServer.start(serverBuilder.build(), serverCacheManager);
}
SecurityConfigurationBuilder remoteSecurity = builder.persistence().addStore(RemoteStoreConfigurationBuilder.class).remoteCacheName(REMOTE_CACHE).shared(true).segmented(false).remoteSecurity();
remoteSecurity.ssl().enable().keyStoreFileName(cl.getResource("keystore_client.jks").getPath()).keyStorePassword("secret".toCharArray()).trustStoreFileName(cl.getResource("ca.jks").getPath()).trustStorePassword("secret".toCharArray()).addServer().host(hrServer.getHost()).port(hrServer.getPort());
remoteSecurity.authentication().enable().saslMechanism("EXTERNAL");
return builder.build();
}
Aggregations