public class SSLTestConfig extends Object
SSLConfig and HttpClientUtil.SchemaRegistryProvider for both clients and servers
 that supports reading key/trust store information directly from resource files provided with the
 Solr test-framework classes| Constructor and Description | 
|---|
SSLTestConfig()
Creates an SSLTestConfig that does not use SSL or client authentication 
 | 
SSLTestConfig(boolean useSSL,
             boolean clientAuth)
Create an SSLTestConfig based on a few caller specified options, 
 implicitly assuming  
checkPeerName=false. | 
SSLTestConfig(boolean useSSL,
             boolean clientAuth,
             boolean checkPeerName)
Create an SSLTestConfig based on a few caller specified options. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
static void | 
assumeSslIsSafeToTest()
Helper method for sanity checking if it's safe to use SSL on this JVM 
 | 
org.apache.solr.client.solrj.impl.HttpClientUtil.SchemaRegistryProvider | 
buildClientSchemaRegistryProvider()
Creates a  
HttpClientUtil.SchemaRegistryProvider for HTTP clients to use when communicating with servers 
 which have been configured based on the settings of this object. | 
org.apache.solr.client.solrj.embedded.SSLConfig | 
buildClientSSLConfig()  | 
org.apache.http.conn.ssl.SSLConnectionSocketFactory | 
buildClientSSLConnectionSocketFactory()
Constructs a new SSLConnectionSocketFactory for HTTP clients to use when communicating 
 with servers which have been configured based on the settings of this object. 
 | 
SSLContext | 
buildClientSSLContext()
Builds a new SSLContext for HTTP clients to use when communicating with servers which have 
 been configured based on the settings of this object. 
 | 
org.apache.solr.client.solrj.embedded.SSLConfig | 
buildServerSSLConfig()
Builds a new SSLContext for jetty servers which have been configured based on the settings of 
 this object. 
 | 
boolean | 
getCheckPeerName()
If true, then servers hostname/ip should be validated against the SSL Cert metadata 
 | 
boolean | 
isClientAuthMode()  | 
boolean | 
isSSLMode()
All other settings on this object are ignored unless this is true 
 | 
public SSLTestConfig()
public SSLTestConfig(boolean useSSL,
                     boolean clientAuth)
checkPeerName=false.  
 As needed, keystore/truststore information will be pulled from a hardcoded resource file provided by the solr test-framework
useSSL - - whether SSL should be required.clientAuth - - whether client authentication should be required.public SSLTestConfig(boolean useSSL,
                     boolean clientAuth,
                     boolean checkPeerName)
checkPeerName:
 true - A keystore resource file will be used that specifies 
     a CN of localhost and a SAN IP of 127.0.0.1, to 
     ensure that all connections should be valid regardless of what machine runs the tests.false - A keystore resource file will be used that specifies 
     a bogus hostname in the CN and reserved IP as the SAN, since no (valid) tests using this 
     SSLTestConfig should care what CN/SAN are.useSSL - - whether SSL should be required.clientAuth - - whether client authentication should be required.checkPeerName - - whether the client should validate the 'peer name' of the SSL Certificate (and which testing Cert should be used)HttpClientUtil.SYS_PROP_CHECK_PEER_NAMEpublic boolean getCheckPeerName()
public boolean isSSLMode()
public boolean isClientAuthMode()
public org.apache.solr.client.solrj.impl.HttpClientUtil.SchemaRegistryProvider buildClientSchemaRegistryProvider()
HttpClientUtil.SchemaRegistryProvider for HTTP clients to use when communicating with servers 
 which have been configured based on the settings of this object.  When isSSLMode() is true, this 
 SchemaRegistryProvider will only support HTTPS (no HTTP scheme) using the 
 appropriate certs.  When isSSLMode() is false, only HTTP (no HTTPS scheme) will be 
 supported.public SSLContext buildClientSSLContext() throws KeyManagementException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException
SecureRandom instance to prevent tests from blocking 
 due to lack of entropy, also explicitly allows the use of self-signed 
 certificates (since that's what is almost always used during testing).public org.apache.solr.client.solrj.embedded.SSLConfig buildClientSSLConfig()
public org.apache.solr.client.solrj.embedded.SSLConfig buildServerSSLConfig()
SecureRandom instance to prevent tests from blocking 
 due to lack of entropy, also explicitly allows the use of self-signed 
 certificates (since that's what is almost always used during testing).
 almost always used during testing).public org.apache.http.conn.ssl.SSLConnectionSocketFactory buildClientSSLConnectionSocketFactory()
isSSLMode() is true.public static void assumeSslIsSafeToTest()
org.junit.internal.AssumptionViolatedException - if this JVM is known to have SSL problemsCopyright © 2000-2019 Apache Software Foundation. All Rights Reserved.