use of org.apache.solr.util.SSLTestConfig in project lucene-solr by apache.
the class SolrTestCaseJ4 method buildSSLConfig.
private static SSLTestConfig buildSSLConfig() {
SSLRandomizer sslRandomizer = SSLRandomizer.getSSLRandomizerForClass(RandomizedContext.current().getTargetClass());
if (Constants.MAC_OS_X) {
// see SOLR-9039
// If a solution is found to remove this, please make sure to also update
// TestMiniSolrCloudClusterSSL.testSslAndClientAuth as well.
sslRandomizer = new SSLRandomizer(sslRandomizer.ssl, 0.0D, (sslRandomizer.debug + " w/ MAC_OS_X supressed clientAuth"));
}
SSLTestConfig result = sslRandomizer.createSSLTestConfig();
log.info("Randomized ssl ({}) and clientAuth ({}) via: {}", result.isSSLMode(), result.isClientAuthMode(), sslRandomizer.debug);
return result;
}
use of org.apache.solr.util.SSLTestConfig in project lucene-solr by apache.
the class TestMiniSolrCloudClusterSSL method testSslAndClientAuth.
public void testSslAndClientAuth() throws Exception {
assumeFalse("SOLR-9039: SSL w/clientAuth does not work on MAC_OS_X", Constants.MAC_OS_X);
final SSLTestConfig sslConfig = new SSLTestConfig(true, true);
HttpClientUtil.setSchemaRegistryProvider(sslConfig.buildClientSchemaRegistryProvider());
System.setProperty(ZkStateReader.URL_SCHEME, "https");
checkClusterWithNodeReplacement(sslConfig);
}
use of org.apache.solr.util.SSLTestConfig in project lucene-solr by apache.
the class TestMiniSolrCloudClusterSSL method testNoSsl.
public void testNoSsl() throws Exception {
final SSLTestConfig sslConfig = new SSLTestConfig(false, false);
HttpClientUtil.setSchemaRegistryProvider(sslConfig.buildClientSchemaRegistryProvider());
System.setProperty(ZkStateReader.URL_SCHEME, "http");
checkClusterWithNodeReplacement(sslConfig);
}
use of org.apache.solr.util.SSLTestConfig in project lucene-solr by apache.
the class TestMiniSolrCloudClusterSSL method getSslAwareClientWithNoClientCerts.
/**
* Returns a new HttpClient that supports both HTTP and HTTPS (with the default test truststore), but
* has no keystore -- so servers requiring client authentication should fail.
*/
private static CloseableHttpClient getSslAwareClientWithNoClientCerts() throws Exception {
// NOTE: This method explicitly does *NOT* use HttpClientUtil code because that
// will muck with the global static HttpClientBuilder / SchemeRegistryProvider
// and we can't do that and still test the entire purpose of what we are trying to test here.
final SSLTestConfig clientConfig = new SSLTestConfig(true, false);
final SSLConnectionSocketFactory sslFactory = clientConfig.buildClientSSLConnectionSocketFactory();
assert null != sslFactory;
final Registry<ConnectionSocketFactory> socketFactoryReg = RegistryBuilder.<ConnectionSocketFactory>create().register("https", sslFactory).register("http", PlainConnectionSocketFactory.INSTANCE).build();
final HttpClientBuilder builder = HttpClientBuilder.create();
builder.setConnectionManager(new PoolingHttpClientConnectionManager(socketFactoryReg));
return builder.build();
}
use of org.apache.solr.util.SSLTestConfig in project lucene-solr by apache.
the class SSLMigrationTest method test.
@Test
public void test() throws Exception {
//Migrate from HTTP -> HTTPS -> HTTP
assertReplicaInformation("http");
testMigrateSSL(new SSLTestConfig(true, false));
testMigrateSSL(new SSLTestConfig(false, false));
}
Aggregations