Search in sources :

Example 1 with Ssl

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);
}
Also used : ConnectorConfig(com.yahoo.jdisc.http.ConnectorConfig) Ssl(com.yahoo.jdisc.http.ConnectorConfig.Ssl) Test(org.testng.annotations.Test)

Example 2 with Ssl

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);
}
Also used : ConnectorConfig(com.yahoo.jdisc.http.ConnectorConfig) Ssl(com.yahoo.jdisc.http.ConnectorConfig.Ssl) Test(org.testng.annotations.Test)

Example 3 with Ssl

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());
}
Also used : ExcludeProtocol(com.yahoo.jdisc.http.ConnectorConfig.Ssl.ExcludeProtocol) DefaultSslTrustStoreContext(com.yahoo.jdisc.http.ssl.DefaultSslTrustStoreContext) SslContextFactory(org.eclipse.jetty.util.ssl.SslContextFactory) DefaultSslKeyStoreContext(com.yahoo.jdisc.http.ssl.DefaultSslKeyStoreContext) IncludeProtocol(com.yahoo.jdisc.http.ConnectorConfig.Ssl.IncludeProtocol) IncludeCipherSuite(com.yahoo.jdisc.http.ConnectorConfig.Ssl.IncludeCipherSuite) ExcludeCipherSuite(com.yahoo.jdisc.http.ConnectorConfig.Ssl.ExcludeCipherSuite) SslConnectionFactory(org.eclipse.jetty.server.SslConnectionFactory) Ssl(com.yahoo.jdisc.http.ConnectorConfig.Ssl)

Aggregations

Ssl (com.yahoo.jdisc.http.ConnectorConfig.Ssl)3 ConnectorConfig (com.yahoo.jdisc.http.ConnectorConfig)2 Test (org.testng.annotations.Test)2 ExcludeCipherSuite (com.yahoo.jdisc.http.ConnectorConfig.Ssl.ExcludeCipherSuite)1 ExcludeProtocol (com.yahoo.jdisc.http.ConnectorConfig.Ssl.ExcludeProtocol)1 IncludeCipherSuite (com.yahoo.jdisc.http.ConnectorConfig.Ssl.IncludeCipherSuite)1 IncludeProtocol (com.yahoo.jdisc.http.ConnectorConfig.Ssl.IncludeProtocol)1 DefaultSslKeyStoreContext (com.yahoo.jdisc.http.ssl.DefaultSslKeyStoreContext)1 DefaultSslTrustStoreContext (com.yahoo.jdisc.http.ssl.DefaultSslTrustStoreContext)1 SslConnectionFactory (org.eclipse.jetty.server.SslConnectionFactory)1 SslContextFactory (org.eclipse.jetty.util.ssl.SslContextFactory)1