use of com.yahoo.jdisc.http.ConnectorConfig.Ssl in project vespa by vespa-engine.
the class ConnectorFactoryTest method ssl_jks_config_is_validated.
@Test(expectedExceptions = IllegalArgumentException.class)
public void ssl_jks_config_is_validated() {
ConnectorConfig config = new ConnectorConfig(new ConnectorConfig.Builder().ssl(new Ssl.Builder().enabled(true).keyStoreType(JKS).pemKeyStore(new Ssl.PemKeyStore.Builder().keyPath("nonEmpty"))));
ConnectorFactory willThrowException = createConnectorFactory(config);
}
use of com.yahoo.jdisc.http.ConnectorConfig.Ssl in project vespa by vespa-engine.
the class ConnectorFactoryTest method ssl_pem_config_is_validated.
@Test(expectedExceptions = IllegalArgumentException.class)
public void ssl_pem_config_is_validated() {
ConnectorConfig config = new ConnectorConfig(new ConnectorConfig.Builder().ssl(new Ssl.Builder().enabled(true).keyStoreType(PEM).keyStorePath("nonEmpty")));
ConnectorFactory willThrowException = createConnectorFactory(config);
}
use of com.yahoo.jdisc.http.ConnectorConfig.Ssl in project vespa by vespa-engine.
the class ConnectorFactory method newSslConnectionFactory.
private SslConnectionFactory newSslConnectionFactory() {
Ssl sslConfig = connectorConfig.ssl();
SslContextFactory factory = new JDiscSslContextFactory();
sslKeyStoreConfigurator.configure(new DefaultSslKeyStoreContext(factory));
sslTrustStoreConfigurator.configure(new DefaultSslTrustStoreContext(factory));
switch(sslConfig.clientAuth()) {
case NEED_AUTH:
factory.setNeedClientAuth(true);
break;
case WANT_AUTH:
factory.setWantClientAuth(true);
break;
}
if (!sslConfig.prng().isEmpty()) {
factory.setSecureRandomAlgorithm(sslConfig.prng());
}
setStringArrayParameter(factory, sslConfig.excludeProtocol(), ExcludeProtocol::name, SslContextFactory::setExcludeProtocols);
setStringArrayParameter(factory, sslConfig.includeProtocol(), IncludeProtocol::name, SslContextFactory::setIncludeProtocols);
setStringArrayParameter(factory, sslConfig.excludeCipherSuite(), ExcludeCipherSuite::name, SslContextFactory::setExcludeCipherSuites);
setStringArrayParameter(factory, sslConfig.includeCipherSuite(), IncludeCipherSuite::name, SslContextFactory::setIncludeCipherSuites);
factory.setKeyManagerFactoryAlgorithm(sslConfig.sslKeyManagerFactoryAlgorithm());
factory.setProtocol(sslConfig.protocol());
return new SslConnectionFactory(factory, HttpVersion.HTTP_1_1.asString());
}
Aggregations