diff options
Diffstat (limited to 'sdc-distribution-client/src/main')
3 files changed, 42 insertions, 1 deletions
diff --git a/sdc-distribution-client/src/main/java/org/onap/sdc/api/consumer/IConfiguration.java b/sdc-distribution-client/src/main/java/org/onap/sdc/api/consumer/IConfiguration.java index a8ce1c7..be2a4cd 100644 --- a/sdc-distribution-client/src/main/java/org/onap/sdc/api/consumer/IConfiguration.java +++ b/sdc-distribution-client/src/main/java/org/onap/sdc/api/consumer/IConfiguration.java @@ -173,6 +173,24 @@ public interface IConfiguration { String getKeyStorePassword(); /** + * Return full path to TrustStore. + * + * @return Trust store path + */ + default String getTrustStorePath() { + return System.getenv().getOrDefault("TRUSTSTORE_PATH", "/var/run/secrets/truststore.jks"); + } + + /** + * Return the password for the TrustStore Key Store + * + * @return TrustStore password + */ + default String getTrustStorePassword(){ + return System.getenv().getOrDefault("TRUSTSTORE_PASSWORD", "changeit"); + } + + /** * Sets whether SDC server TLS authentication is activated. If set to false, Key * Store path and password are not needed to be set. * diff --git a/sdc-distribution-client/src/main/java/org/onap/sdc/impl/Configuration.java b/sdc-distribution-client/src/main/java/org/onap/sdc/impl/Configuration.java index dd67656..add4185 100644 --- a/sdc-distribution-client/src/main/java/org/onap/sdc/impl/Configuration.java +++ b/sdc-distribution-client/src/main/java/org/onap/sdc/impl/Configuration.java @@ -45,6 +45,8 @@ public class Configuration implements IConfiguration { private String comsumerID; private String keyStorePath; private String keyStorePassword; + private String trustStorePath; + private String trustStorePassword; private boolean activateServerTLSAuth; private final boolean filterInEmptyResources; private Boolean useHttpsWithSDC; @@ -72,6 +74,8 @@ public class Configuration implements IConfiguration { this.useHttpsWithSDC = other.isUseHttpsWithSDC(); this.keyStorePath = other.getKeyStorePath(); this.keyStorePassword = other.getKeyStorePassword(); + this.trustStorePath = other.getTrustStorePath(); + this.trustStorePassword = other.getTrustStorePassword(); this.activateServerTLSAuth = other.activateServerTLSAuth(); this.filterInEmptyResources = other.isFilterInEmptyResources(); this.httpProxyHost = other.getHttpProxyHost(); @@ -114,6 +118,16 @@ public class Configuration implements IConfiguration { } @Override + public String getTrustStorePath() { + return trustStorePath; + } + + @Override + public String getTrustStorePassword() { + return trustStorePassword; + } + + @Override public Boolean isUseHttpsWithSDC() { return useHttpsWithSDC; } @@ -271,6 +285,14 @@ public class Configuration implements IConfiguration { this.keyStorePassword = keyStorePassword; } + public void setTrustStorePath(String trustStorePath) { + this.trustStorePath = trustStorePath; + } + + public void setTrustStorePassword(String trustStorePassword) { + this.trustStorePassword = trustStorePassword; + } + public void setactivateServerTLSAuth(boolean activateServerTLSAuth) { this.activateServerTLSAuth = activateServerTLSAuth; } @@ -321,7 +343,7 @@ public class Configuration implements IConfiguration { + ", environmentName=" + environmentName + ", comsumerID=" + comsumerID + ", keyStorePath=" + keyStorePath - + ", keyStorePassword=" + keyStorePassword + + ", trustStorePath=" + trustStorePath + ", activateServerTLSAuth=" + activateServerTLSAuth + ", filterInEmptyResources=" + filterInEmptyResources + ", consumeProduceStatusTopic=" + consumeProduceStatusTopic diff --git a/sdc-distribution-client/src/main/java/org/onap/sdc/utils/kafka/SdcKafkaConsumer.java b/sdc-distribution-client/src/main/java/org/onap/sdc/utils/kafka/SdcKafkaConsumer.java index f87b7aa..982ba5d 100644 --- a/sdc-distribution-client/src/main/java/org/onap/sdc/utils/kafka/SdcKafkaConsumer.java +++ b/sdc-distribution-client/src/main/java/org/onap/sdc/utils/kafka/SdcKafkaConsumer.java @@ -32,6 +32,7 @@ import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecords; import org.apache.kafka.clients.consumer.KafkaConsumer; import org.apache.kafka.common.config.SaslConfigs; +import org.apache.kafka.common.config.SslConfigs; import org.apache.kafka.common.errors.InvalidGroupIdException; import org.onap.sdc.impl.Configuration; import org.slf4j.Logger; |