diff options
author | Morten Tokle <morten.tokle@gmail.com> | 2019-06-21 14:39:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-21 14:39:17 +0200 |
commit | d41f4bf4765936db480ed7246834382bac0d48f3 (patch) | |
tree | 1d0a03b8544dc89cb67f930bb7d2b05ce0e10f0d /config-model/src/main/java/com/yahoo/vespa/model/container/http/ssl/ConfiguredFilebasedSslProvider.java | |
parent | 79efda4ec2def085aa8f9768b0d7c7e98053a73a (diff) |
Revert "mortent/tls config from deploy params"
Diffstat (limited to 'config-model/src/main/java/com/yahoo/vespa/model/container/http/ssl/ConfiguredFilebasedSslProvider.java')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/container/http/ssl/ConfiguredFilebasedSslProvider.java | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/http/ssl/ConfiguredFilebasedSslProvider.java b/config-model/src/main/java/com/yahoo/vespa/model/container/http/ssl/ConfiguredFilebasedSslProvider.java deleted file mode 100644 index 4f84a01ff94..00000000000 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/http/ssl/ConfiguredFilebasedSslProvider.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.model.container.http.ssl; - -import com.yahoo.component.ComponentId; -import com.yahoo.container.bundle.BundleInstantiationSpecification; -import com.yahoo.jdisc.http.ConnectorConfig; -import com.yahoo.jdisc.http.ssl.impl.ConfiguredSslContextFactoryProvider; -import com.yahoo.osgi.provider.model.ComponentModel; -import com.yahoo.vespa.model.container.component.SimpleComponent; - -import java.util.Optional; - -import static com.yahoo.component.ComponentSpecification.fromString; - -/** - * Configure SSL using file references - * - * @author mortent - */ -public class ConfiguredFilebasedSslProvider extends SimpleComponent implements ConnectorConfig.Producer { - public static final String COMPONENT_ID_PREFIX = "configured-ssl-provider@"; - public static final String COMPONENT_CLASS = ConfiguredSslContextFactoryProvider.class.getName(); - public static final String COMPONENT_BUNDLE = "jdisc_http_service"; - - private final String privateKeyPath; - private final String certificatePath; - private final String caCertificatePath; - private final ConnectorConfig.Ssl.ClientAuth.Enum clientAuthentication; - - public ConfiguredFilebasedSslProvider(String servername, String privateKeyPath, String certificatePath, String caCertificatePath, String clientAuthentication) { - super(new ComponentModel( - new BundleInstantiationSpecification(new ComponentId(COMPONENT_ID_PREFIX+servername), - fromString(COMPONENT_CLASS), - fromString(COMPONENT_BUNDLE)))); - this.privateKeyPath = privateKeyPath; - this.certificatePath = certificatePath; - this.caCertificatePath = caCertificatePath; - this.clientAuthentication = mapToConfigEnum(clientAuthentication); - } - - @Override - public void getConfig(ConnectorConfig.Builder builder) { - builder.ssl.enabled(true); - builder.ssl.privateKeyFile(privateKeyPath); - builder.ssl.certificateFile(certificatePath); - builder.ssl.caCertificateFile(Optional.ofNullable(caCertificatePath).orElse("")); - builder.ssl.clientAuth(clientAuthentication); - } - - public SimpleComponent getComponent() { - return new SimpleComponent(new ComponentModel(getComponentId().stringValue(), COMPONENT_CLASS, COMPONENT_BUNDLE)); - } - - private static ConnectorConfig.Ssl.ClientAuth.Enum mapToConfigEnum(String clientAuthValue) { - if ("disabled".equals(clientAuthValue)) { - return ConnectorConfig.Ssl.ClientAuth.Enum.DISABLED; - } else if ("want".equals(clientAuthValue)) { - return ConnectorConfig.Ssl.ClientAuth.Enum.WANT_AUTH; - } else if ("need".equals(clientAuthValue)) { - return ConnectorConfig.Ssl.ClientAuth.Enum.NEED_AUTH; - } else { - return ConnectorConfig.Ssl.ClientAuth.Enum.DISABLED; - } - } -} |