aboutsummaryrefslogtreecommitdiffstats
path: root/certServiceClient/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'certServiceClient/src/main')
-rw-r--r--certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/ClientConfigurationEnvs.java3
-rw-r--r--certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvsForClient.java4
-rw-r--r--certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/factory/ClientConfigurationFactory.java3
-rw-r--r--certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/model/ClientConfiguration.java17
4 files changed, 24 insertions, 3 deletions
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/ClientConfigurationEnvs.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/ClientConfigurationEnvs.java
index 779e65bb..f8a0e91a 100644
--- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/ClientConfigurationEnvs.java
+++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/ClientConfigurationEnvs.java
@@ -24,5 +24,6 @@ public enum ClientConfigurationEnvs {
REQUEST_URL,
REQUEST_TIMEOUT,
OUTPUT_PATH,
- CA_NAME
+ CA_NAME,
+ OUTPUT_TYPE
}
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvsForClient.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvsForClient.java
index 59fd5efc..dedd4d6b 100644
--- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvsForClient.java
+++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvsForClient.java
@@ -40,6 +40,10 @@ public class EnvsForClient {
return readEnv(ClientConfigurationEnvs.CA_NAME);
}
+ public Optional<String> getOutputType() {
+ return readEnv(ClientConfigurationEnvs.OUTPUT_TYPE);
+ }
+
private Optional<String> readEnv(ClientConfigurationEnvs envName) {
return envProvider.readEnvVariable(envName.toString());
}
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/factory/ClientConfigurationFactory.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/factory/ClientConfigurationFactory.java
index a03ded6c..793799e2 100644
--- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/factory/ClientConfigurationFactory.java
+++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/factory/ClientConfigurationFactory.java
@@ -57,6 +57,9 @@ public class ClientConfigurationFactory extends AbstractConfigurationFactory<Cli
.map(configuration::setCaName)
.orElseThrow(() -> new ClientConfigurationException(ClientConfigurationEnvs.CA_NAME + " is invalid."));
+ envsForClient.getOutputType()
+ .map(configuration::setOutputType);
+
LOGGER.info("Successful validation of Client configuration. Configuration data: {}", configuration.toString());
return configuration;
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/model/ClientConfiguration.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/model/ClientConfiguration.java
index 2ac481dc..78fa1b4b 100644
--- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/model/ClientConfiguration.java
+++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/model/ClientConfiguration.java
@@ -26,16 +26,19 @@ public class ClientConfiguration implements ConfigurationModel {
private static final Integer DEFAULT_TIMEOUT_MS = 30000;
private static final String DEFAULT_REQUEST_URL = "https://aaf-cert-service:8443/v1/certificate/";
+ private static final String DEFAULT_OUTPUT_TYPE = "P12";
private String urlToCertService;
private Integer requestTimeout;
private String certsOutputPath;
private String caName;
+ private String outputType;
public ClientConfiguration() {
urlToCertService = DEFAULT_REQUEST_URL;
requestTimeout = DEFAULT_TIMEOUT_MS;
+ outputType = DEFAULT_OUTPUT_TYPE;
}
@@ -75,12 +78,22 @@ public class ClientConfiguration implements ConfigurationModel {
return this;
}
+ public String getOutputType() {
+ return outputType;
+ }
+
+ public ClientConfiguration setOutputType(String outputType) {
+ this.outputType = outputType;
+ return this;
+ }
+
@Override
public String toString() {
- return String.format("%s: %s, %s: %s, %s: %s, %s: %s",
+ return String.format("%s: %s, %s: %s, %s: %s, %s: %s, %s: %s",
ClientConfigurationEnvs.REQUEST_URL, urlToCertService,
ClientConfigurationEnvs.REQUEST_TIMEOUT, requestTimeout,
ClientConfigurationEnvs.OUTPUT_PATH, certsOutputPath,
- ClientConfigurationEnvs.CA_NAME, caName);
+ ClientConfigurationEnvs.CA_NAME, caName,
+ ClientConfigurationEnvs.OUTPUT_TYPE, outputType);
}
}