summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej Wejs <maciej.wejs@nokia.com>2018-11-06 16:38:46 +0100
committerMaciej Wejs <maciej.wejs@nokia.com>2018-11-06 16:38:46 +0100
commitf4f1318b19c90016c70a0af457020361733b69f3 (patch)
tree679399be0e90df7f2e24fd054a6a6d2918f62d75
parent8a762124d24555d50ce7455398ca3ac02fde1076 (diff)
Names change of SSL config params
Change-Id: I719b38b76fec976c459bfca6ffdc6dd9c1d7b00c Issue-ID: DCAEGEN2-953 Signed-off-by: Maciej Wejs <maciej.wejs@nokia.com>
-rw-r--r--prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/config/AaiClientConfiguration.java11
-rw-r--r--prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClient.java24
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java100
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParser.java36
-rw-r--r--prh-app-server/src/main/resources/prh_endpoints.json9
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java27
-rw-r--r--prh-app-server/src/test/resources/correct_config.json9
-rw-r--r--prh-app-server/src/test/resources/flattened_configuration.json9
-rw-r--r--prh-app-server/src/test/resources/incorrect_config.json9
-rw-r--r--prh-commons/src/main/java/org/onap/dcaegen2/services/prh/ssl/SslFactory.java30
-rw-r--r--prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/config/DmaapCustomConfig.java21
-rw-r--r--prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPReactiveWebClientFactory.java4
-rw-r--r--prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapConsumerConfigurationTest.java25
-rw-r--r--prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapPublisherConfigurationTest.java24
-rw-r--r--prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPReactiveWebClientFactoryTest.java8
15 files changed, 156 insertions, 190 deletions
diff --git a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/config/AaiClientConfiguration.java b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/config/AaiClientConfiguration.java
index 706c328a..23e621fe 100644
--- a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/config/AaiClientConfiguration.java
+++ b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/config/AaiClientConfiguration.java
@@ -63,19 +63,16 @@ public abstract class AaiClientConfiguration implements Serializable {
public abstract Map<String, String> aaiHeaders();
@Value.Parameter
- public abstract String keyFile();
+ public abstract String trustStorePath();
@Value.Parameter
- public abstract String trustStore();
+ public abstract String trustStorePasswordPath();
@Value.Parameter
- public abstract String trustStorePassword();
+ public abstract String keyStorePath();
@Value.Parameter
- public abstract String keyStore();
-
- @Value.Parameter
- public abstract String keyStorePassword();
+ public abstract String keyStorePasswordPath();
@Value.Parameter
public abstract Boolean enableAaiCertAuth();
diff --git a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClient.java b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClient.java
index ad57ba47..2d1a7ac4 100644
--- a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClient.java
+++ b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClient.java
@@ -48,10 +48,10 @@ public class AaiReactiveWebClient {
private final String aaiUserPassword;
private final Map<String, String> aaiHeaders;
private final Boolean enableAaiCertAuth;
- private final String trustStore;
- private final String trustStorePassword;
- private final String keyStore;
- private final String keyStorePassword;
+ private final String trustStorePath;
+ private final String trustStorePasswordPath;
+ private final String keyStorePath;
+ private final String keyStorePasswordPath;
private final SslFactory sslFactory;
/**
@@ -64,10 +64,10 @@ public class AaiReactiveWebClient {
this.aaiUserName = configuration.aaiUserName();
this.aaiUserPassword = configuration.aaiUserPassword();
this.aaiHeaders = configuration.aaiHeaders();
- this.trustStore = configuration.trustStore();
- this.trustStorePassword = configuration.trustStorePassword();
- this.keyStore = configuration.keyStore();
- this.keyStorePassword = configuration.keyStorePassword();
+ this.trustStorePath = configuration.trustStorePath();
+ this.trustStorePasswordPath = configuration.trustStorePasswordPath();
+ this.keyStorePath = configuration.keyStorePath();
+ this.keyStorePasswordPath = configuration.keyStorePasswordPath();
this.enableAaiCertAuth = configuration.enableAaiCertAuth();
this.sslFactory = sslFactory;
}
@@ -97,10 +97,10 @@ public class AaiReactiveWebClient {
private SslContext createSslContext() throws SSLException {
if (enableAaiCertAuth) {
return sslFactory.createSecureContext(
- keyStore,
- keyStorePassword,
- trustStore,
- trustStorePassword
+ keyStorePath,
+ keyStorePasswordPath,
+ trustStorePath,
+ trustStorePasswordPath
);
}
return sslFactory.createInsecureContext();
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java
index 191294fd..9d199a14 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java
@@ -119,20 +119,17 @@ public class AppConfig extends PrhAppConfig {
@Value("${aai.aaiClientConfiguration.aaiPnfPath:}")
public String aaiPnfPath;
- @Value("${security.keyFile:}")
- public String keyFile;
+ @Value("${security.trustStorePath:}")
+ public String trustStorePath;
- @Value("${security.trustStore:}")
- public String trustStore;
+ @Value("${security.trustStorePasswordPath:}")
+ public String trustStorePasswordPath;
- @Value("${security.trustStorePassword:}")
- public String trustStorePassword;
+ @Value("${security.keyStorePath:}")
+ public String keyStorePath;
- @Value("${security.keyStore:}")
- public String keyStore;
-
- @Value("${security.keyStorePassword:}")
- public String keyStorePassword;
+ @Value("${security.keyStorePasswordPath:}")
+ public String keyStorePasswordPath;
@Value("${security.enableAaiCertAuth:}")
public Boolean enableAaiCertAuth;
@@ -173,21 +170,18 @@ public class AppConfig extends PrhAppConfig {
.orElse(dmaapConsumerConfiguration.consumerGroup()))
.consumerId(Optional.ofNullable(consumerId).filter(isEmpty.negate())
.orElse(dmaapConsumerConfiguration.consumerId()))
- .keyFile(
- Optional.ofNullable(keyFile).filter(isEmpty.negate())
- .orElse(dmaapConsumerConfiguration.keyFile()))
- .trustStore(
- Optional.ofNullable(trustStore).filter(isEmpty.negate())
- .orElse(dmaapConsumerConfiguration.trustStore()))
- .trustStorePassword(
- Optional.ofNullable(trustStorePassword).filter(isEmpty.negate())
- .orElse(dmaapConsumerConfiguration.trustStorePassword()))
- .keyStore(
- Optional.ofNullable(keyStore).filter(isEmpty.negate())
- .orElse(dmaapConsumerConfiguration.keyStore()))
- .keyStorePassword(
- Optional.ofNullable(keyStorePassword).filter(isEmpty.negate())
- .orElse(dmaapConsumerConfiguration.keyStorePassword()))
+ .trustStorePath(
+ Optional.ofNullable(trustStorePath).filter(isEmpty.negate())
+ .orElse(dmaapConsumerConfiguration.trustStorePath()))
+ .trustStorePasswordPath(
+ Optional.ofNullable(trustStorePasswordPath).filter(isEmpty.negate())
+ .orElse(dmaapConsumerConfiguration.trustStorePasswordPath()))
+ .keyStorePath(
+ Optional.ofNullable(keyStorePath).filter(isEmpty.negate())
+ .orElse(dmaapConsumerConfiguration.keyStorePath()))
+ .keyStorePasswordPath(
+ Optional.ofNullable(keyStorePasswordPath).filter(isEmpty.negate())
+ .orElse(dmaapConsumerConfiguration.keyStorePasswordPath()))
.enableDmaapCertAuth(
Optional.ofNullable(enableDmaapCertAuth).filter(p -> !p.toString().isEmpty())
.orElse(dmaapConsumerConfiguration.enableDmaapCertAuth()))
@@ -215,21 +209,18 @@ public class AppConfig extends PrhAppConfig {
.aaiPnfPath(
Optional.ofNullable(aaiPnfPath).filter(isEmpty.negate()).orElse(aaiClientConfiguration.aaiPnfPath()))
.aaiHeaders(aaiClientConfiguration.aaiHeaders())
- .keyFile(
- Optional.ofNullable(keyFile).filter(isEmpty.negate())
- .orElse(aaiClientConfiguration.keyFile()))
- .trustStore(
- Optional.ofNullable(trustStore).filter(isEmpty.negate())
- .orElse(aaiClientConfiguration.trustStore()))
- .trustStorePassword(
- Optional.ofNullable(trustStorePassword).filter(isEmpty.negate())
- .orElse(aaiClientConfiguration.trustStorePassword()))
- .keyStore(
- Optional.ofNullable(keyStore).filter(isEmpty.negate())
- .orElse(aaiClientConfiguration.keyStore()))
- .keyStorePassword(
- Optional.ofNullable(keyStorePassword).filter(isEmpty.negate())
- .orElse(aaiClientConfiguration.keyStorePassword()))
+ .trustStorePath(
+ Optional.ofNullable(trustStorePath).filter(isEmpty.negate())
+ .orElse(aaiClientConfiguration.trustStorePath()))
+ .trustStorePasswordPath(
+ Optional.ofNullable(trustStorePasswordPath).filter(isEmpty.negate())
+ .orElse(aaiClientConfiguration.trustStorePasswordPath()))
+ .keyStorePath(
+ Optional.ofNullable(keyStorePath).filter(isEmpty.negate())
+ .orElse(aaiClientConfiguration.keyStorePath()))
+ .keyStorePasswordPath(
+ Optional.ofNullable(keyStorePasswordPath).filter(isEmpty.negate())
+ .orElse(aaiClientConfiguration.keyStorePasswordPath()))
.enableAaiCertAuth(
Optional.ofNullable(enableAaiCertAuth).filter(p -> !p.toString().isEmpty())
.orElse(aaiClientConfiguration.enableAaiCertAuth()))
@@ -260,21 +251,18 @@ public class AppConfig extends PrhAppConfig {
.dmaapUserPassword(
Optional.ofNullable(producerDmaapUserPassword).filter(isEmpty.negate())
.orElse(dmaapPublisherConfiguration.dmaapUserPassword()))
- .keyFile(
- Optional.ofNullable(keyFile).filter(isEmpty.negate())
- .orElse(dmaapPublisherConfiguration.keyFile()))
- .trustStore(
- Optional.ofNullable(trustStore).filter(isEmpty.negate())
- .orElse(dmaapPublisherConfiguration.trustStore()))
- .trustStorePassword(
- Optional.ofNullable(trustStorePassword).filter(isEmpty.negate())
- .orElse(dmaapPublisherConfiguration.trustStorePassword()))
- .keyStore(
- Optional.ofNullable(keyStore).filter(isEmpty.negate())
- .orElse(dmaapPublisherConfiguration.keyStore()))
- .keyStorePassword(
- Optional.ofNullable(keyStorePassword).filter(isEmpty.negate())
- .orElse(dmaapPublisherConfiguration.keyStorePassword()))
+ .trustStorePath(
+ Optional.ofNullable(trustStorePath).filter(isEmpty.negate())
+ .orElse(dmaapPublisherConfiguration.trustStorePath()))
+ .trustStorePasswordPath(
+ Optional.ofNullable(trustStorePasswordPath).filter(isEmpty.negate())
+ .orElse(dmaapPublisherConfiguration.trustStorePasswordPath()))
+ .keyStorePath(
+ Optional.ofNullable(keyStorePath).filter(isEmpty.negate())
+ .orElse(dmaapPublisherConfiguration.keyStorePath()))
+ .keyStorePasswordPath(
+ Optional.ofNullable(keyStorePasswordPath).filter(isEmpty.negate())
+ .orElse(dmaapPublisherConfiguration.keyStorePasswordPath()))
.enableDmaapCertAuth(
Optional.ofNullable(enableDmaapCertAuth).filter(p -> !p.toString().isEmpty())
.orElse(dmaapPublisherConfiguration.enableDmaapCertAuth()))
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParser.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParser.java
index 2e57256e..660cdebb 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParser.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParser.java
@@ -33,11 +33,10 @@ import org.onap.dcaegen2.services.prh.config.ImmutableDmaapPublisherConfiguratio
*/
class CloudConfigParser {
- private static final String SECURITY_KEY_FILE = "security.keyFile";
- private static final String SECURITY_TRUST_STORE = "security.trustStore";
- private static final String SECURITY_KEY_STORE = "security.keyStore";
- private static final String KEY_STORE_PASS = "security.keyStorePassword";
- private static final String TRUST_STORE_PASS = "security.trustStorePassword";
+ private static final String SECURITY_TRUST_STORE_PATH = "security.trustStorePath";
+ private static final String SECURITY_TRUST_STORE_PASS_PATH = "security.trustStorePasswordPath";
+ private static final String SECURITY_KEY_STORE_PATH = "security.keyStorePath";
+ private static final String SECURITY_KEY_STORE_PASS_PATH = "security.keyStorePasswordPath";
private final JsonObject jsonObject;
CloudConfigParser(JsonObject jsonObject) {
@@ -53,11 +52,10 @@ class CloudConfigParser {
.dmaapContentType(jsonObject.get("dmaap.dmaapProducerConfiguration.dmaapContentType").getAsString())
.dmaapHostName(jsonObject.get("dmaap.dmaapProducerConfiguration.dmaapHostName").getAsString())
.dmaapUserName(jsonObject.get("dmaap.dmaapProducerConfiguration.dmaapUserName").getAsString())
- .keyFile(jsonObject.get(SECURITY_KEY_FILE).getAsString())
- .trustStore(jsonObject.get(SECURITY_TRUST_STORE).getAsString())
- .trustStorePassword(jsonObject.get(TRUST_STORE_PASS).getAsString())
- .keyStore(jsonObject.get(SECURITY_KEY_STORE).getAsString())
- .keyStorePassword(jsonObject.get(KEY_STORE_PASS).getAsString())
+ .trustStorePath(jsonObject.get(SECURITY_TRUST_STORE_PATH).getAsString())
+ .trustStorePasswordPath(jsonObject.get(SECURITY_TRUST_STORE_PASS_PATH).getAsString())
+ .keyStorePath(jsonObject.get(SECURITY_KEY_STORE_PATH).getAsString())
+ .keyStorePasswordPath(jsonObject.get(SECURITY_KEY_STORE_PASS_PATH).getAsString())
.enableDmaapCertAuth(jsonObject.get("security.enableDmaapCertAuth").getAsBoolean())
.build();
}
@@ -73,11 +71,10 @@ class CloudConfigParser {
.aaiUserPassword(jsonObject.get("aai.aaiClientConfiguration.aaiUserPassword").getAsString())
.aaiProtocol(jsonObject.get("aai.aaiClientConfiguration.aaiProtocol").getAsString())
.aaiBasePath(jsonObject.get("aai.aaiClientConfiguration.aaiBasePath").getAsString())
- .keyFile(jsonObject.get(SECURITY_KEY_FILE).getAsString())
- .trustStore(jsonObject.get(SECURITY_TRUST_STORE).getAsString())
- .trustStorePassword(jsonObject.get(TRUST_STORE_PASS).getAsString())
- .keyStore(jsonObject.get(SECURITY_KEY_STORE).getAsString())
- .keyStorePassword(jsonObject.get(KEY_STORE_PASS).getAsString())
+ .trustStorePath(jsonObject.get(SECURITY_TRUST_STORE_PATH).getAsString())
+ .trustStorePasswordPath(jsonObject.get(SECURITY_TRUST_STORE_PASS_PATH).getAsString())
+ .keyStorePath(jsonObject.get(SECURITY_KEY_STORE_PATH).getAsString())
+ .keyStorePasswordPath(jsonObject.get(SECURITY_KEY_STORE_PASS_PATH).getAsString())
.enableAaiCertAuth(jsonObject.get("security.enableAaiCertAuth").getAsBoolean())
.build();
}
@@ -95,11 +92,10 @@ class CloudConfigParser {
.dmaapProtocol(jsonObject.get("dmaap.dmaapConsumerConfiguration.dmaapProtocol").getAsString())
.consumerId(jsonObject.get("dmaap.dmaapConsumerConfiguration.consumerId").getAsString())
.consumerGroup(jsonObject.get("dmaap.dmaapConsumerConfiguration.consumerGroup").getAsString())
- .keyFile(jsonObject.get(SECURITY_KEY_FILE).getAsString())
- .trustStore(jsonObject.get(SECURITY_TRUST_STORE).getAsString())
- .trustStorePassword(jsonObject.get(TRUST_STORE_PASS).getAsString())
- .keyStore(jsonObject.get(SECURITY_KEY_STORE).getAsString())
- .keyStorePassword(jsonObject.get(KEY_STORE_PASS).getAsString())
+ .trustStorePath(jsonObject.get(SECURITY_TRUST_STORE_PATH).getAsString())
+ .trustStorePasswordPath(jsonObject.get(SECURITY_TRUST_STORE_PASS_PATH).getAsString())
+ .keyStorePath(jsonObject.get(SECURITY_KEY_STORE_PATH).getAsString())
+ .keyStorePasswordPath(jsonObject.get(SECURITY_KEY_STORE_PASS_PATH).getAsString())
.enableDmaapCertAuth(jsonObject.get("security.enableDmaapCertAuth").getAsBoolean())
.build();
}
diff --git a/prh-app-server/src/main/resources/prh_endpoints.json b/prh-app-server/src/main/resources/prh_endpoints.json
index 75917f12..2e224833 100644
--- a/prh-app-server/src/main/resources/prh_endpoints.json
+++ b/prh-app-server/src/main/resources/prh_endpoints.json
@@ -44,11 +44,10 @@
}
},
"security": {
- "keyFile" : "/opt/app/prh/local/org.onap.prh.keyfile",
- "trustStore" : "change it",
- "trustStorePassword" : "change it",
- "keyStore" : "change it",
- "keyStorePassword" : "change it",
+ "trustStorePath" : "change it",
+ "trustStorePasswordPath" : "change it",
+ "keyStorePath" : "change it",
+ "keyStorePasswordPath" : "change it",
"enableAaiCertAuth" : "false",
"enableDmaapCertAuth" : "false"
}
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java
index 88aa434c..37463575 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java
@@ -36,11 +36,10 @@ public class TestAppConfiguration {
.dmaapProtocol("http")
.dmaapUserName("admin")
.dmaapUserPassword("admin")
- .keyFile("/opt/app/prh/local/org.onap.prh.keyfile")
- .trustStore("/opt/app/prh/local/org.onap.prh.trust.jks")
- .trustStorePassword("change_it")
- .keyStore("/opt/app/prh/local/org.onap.prh.p12")
- .keyStorePassword("change_it")
+ .trustStorePath("/opt/app/prh/local/org.onap.prh.trust.jks")
+ .trustStorePasswordPath("change_it")
+ .keyStorePath("/opt/app/prh/local/org.onap.prh.p12")
+ .keyStorePasswordPath("change_it")
.enableDmaapCertAuth(false)
.dmaapTopicName("/events/unauthenticated.SEC_OTHER_OUTPUT")
.timeoutMs(-1)
@@ -56,11 +55,10 @@ public class TestAppConfiguration {
.dmaapProtocol("http")
.dmaapUserName("admin")
.dmaapUserPassword("admin")
- .keyFile("/opt/app/prh/local/org.onap.prh.keyfile")
- .trustStore("/opt/app/prh/local/org.onap.prh.trust.jks")
- .trustStorePassword("change_it")
- .keyStore("/opt/app/prh/local/org.onap.prh.p12")
- .keyStorePassword("change_it")
+ .trustStorePath("/opt/app/prh/local/org.onap.prh.trust.jks")
+ .trustStorePasswordPath("change_it")
+ .keyStorePath("/opt/app/prh/local/org.onap.prh.p12")
+ .keyStorePasswordPath("change_it")
.enableDmaapCertAuth(false)
.dmaapTopicName("/events/unauthenticated.PNF_READY")
.build();
@@ -76,11 +74,10 @@ public class TestAppConfiguration {
.aaiIgnoreSslCertificateErrors(true)
.aaiBasePath("/aai/v12")
.aaiPnfPath("/network/pnfs/pnf")
- .keyFile("/opt/app/prh/local/org.onap.prh.keyfile")
- .trustStore("/opt/app/prh/local/org.onap.prh.trust.jks")
- .trustStorePassword("change_it")
- .keyStore("/opt/app/prh/local/org.onap.prh.p12")
- .keyStorePassword("change_it")
+ .trustStorePath("/opt/app/prh/local/org.onap.prh.trust.jks")
+ .trustStorePasswordPath("change_it")
+ .keyStorePath("/opt/app/prh/local/org.onap.prh.p12")
+ .keyStorePasswordPath("change_it")
.enableAaiCertAuth(false)
.build();
}
diff --git a/prh-app-server/src/test/resources/correct_config.json b/prh-app-server/src/test/resources/correct_config.json
index d250114d..5c80bc99 100644
--- a/prh-app-server/src/test/resources/correct_config.json
+++ b/prh-app-server/src/test/resources/correct_config.json
@@ -45,11 +45,10 @@
}
},
"security": {
- "keyFile": "/opt/app/prh/local/org.onap.prh.keyfile",
- "trustStore": "/opt/app/prh/local/org.onap.prh.trust.jks",
- "trustStorePassword": "change it",
- "keyStore": "/opt/app/prh/local/org.onap.prh.p12",
- "keyStorePassword": "change it",
+ "trustStorePath": "/opt/app/prh/local/org.onap.prh.trust.jks",
+ "trustStorePasswordPath": "change it",
+ "keyStorePath": "/opt/app/prh/local/org.onap.prh.p12",
+ "keyStorePasswordPath": "change it",
"enableAaiCertAuth": "false",
"enableDmaapCertAuth": "false"
}
diff --git a/prh-app-server/src/test/resources/flattened_configuration.json b/prh-app-server/src/test/resources/flattened_configuration.json
index 6584a594..f8def2ef 100644
--- a/prh-app-server/src/test/resources/flattened_configuration.json
+++ b/prh-app-server/src/test/resources/flattened_configuration.json
@@ -25,11 +25,10 @@
"aai.aaiClientConfiguration.aaiProtocol": "https",
"dmaap.dmaapProducerConfiguration.dmaapUserName": "admin",
"dmaap.dmaapProducerConfiguration.dmaapUserPassword": "admin",
- "security.keyFile": "/opt/app/prh/local/org.onap.prh.keyfile",
- "security.trustStore": "/opt/app/prh/local/org.onap.prh.trust.jks",
- "security.trustStorePassword": "change_it",
- "security.keyStore": "/opt/app/prh/local/org.onap.prh.p12",
- "security.keyStorePassword": "change_it",
+ "security.trustStorePath": "/opt/app/prh/local/org.onap.prh.trust.jks",
+ "security.trustStorePasswordPath": "change_it",
+ "security.keyStorePath": "/opt/app/prh/local/org.onap.prh.p12",
+ "security.keyStorePasswordPath": "change_it",
"security.enableAaiCertAuth": false,
"security.enableDmaapCertAuth": false
} \ No newline at end of file
diff --git a/prh-app-server/src/test/resources/incorrect_config.json b/prh-app-server/src/test/resources/incorrect_config.json
index f320d982..a682402d 100644
--- a/prh-app-server/src/test/resources/incorrect_config.json
+++ b/prh-app-server/src/test/resources/incorrect_config.json
@@ -45,11 +45,10 @@
}
},
"security": {
- "keyFile": "/opt/app/prh/local/org.onap.prh.keyfile",
- "trustStore": "/opt/app/prh/local/org.onap.prh.trust.jks",
- "trustStorePassword": "change it",
- "keyStore": "/opt/app/prh/local/org.onap.prh.p12",
- "keyStorePassword": "change it",
+ "trustStorePath": "/opt/app/prh/local/org.onap.prh.trust.jks",
+ "trustStorePasswordPath": "change it",
+ "keyStorePath": "/opt/app/prh/local/org.onap.prh.p12",
+ "keyStorePasswordPath": "change it",
"enableAaiCertAuth": "false",
"enableDmaapCertAuth": "false"
}
diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/ssl/SslFactory.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/ssl/SslFactory.java
index 6ffff1b9..891bcb73 100644
--- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/ssl/SslFactory.java
+++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/ssl/SslFactory.java
@@ -38,16 +38,16 @@ public class SslFactory {
private static final Logger LOGGER = LoggerFactory.getLogger(SslFactory.class);
- public SslContext createSecureContext(String keyStoreFilename,
- String keyStorePassword,
- String trustStoreFilename,
- String trustStorePassword) throws SSLException {
- LOGGER.info("Creating secure ssl context for: {} {}", keyStoreFilename, trustStoreFilename);
+ public SslContext createSecureContext(String keyStorePath,
+ String keyStorePasswordPath,
+ String trustStorePath,
+ String trustStorePasswordPath) throws SSLException {
+ LOGGER.info("Creating secure ssl context for: {} {}", keyStorePath, trustStorePath);
try {
return SslContextBuilder
.forClient()
- .keyManager(keyManagerFactory(keyStoreFilename, loadPasswordFromFile(keyStorePassword)))
- .trustManager(trustManagerFactory(trustStoreFilename, loadPasswordFromFile(trustStorePassword)))
+ .keyManager(keyManagerFactory(keyStorePath, loadPasswordFromFile(keyStorePasswordPath)))
+ .trustManager(trustManagerFactory(trustStorePath, loadPasswordFromFile(trustStorePasswordPath)))
.build();
} catch (Exception ex) {
throw new SSLException(ex);
@@ -62,27 +62,27 @@ public class SslFactory {
.build();
}
- private KeyManagerFactory keyManagerFactory(String fileName, String password) throws Exception {
+ private KeyManagerFactory keyManagerFactory(String path, String password) throws Exception {
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
- kmf.init(loadKeyStoreFromFile(fileName, password),
+ kmf.init(loadKeyStoreFromFile(path, password),
password.toCharArray());
return kmf;
}
- private TrustManagerFactory trustManagerFactory(String fileName, String password) throws Exception {
+ private TrustManagerFactory trustManagerFactory(String path, String password) throws Exception {
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
- tmf.init(loadKeyStoreFromFile(fileName, password));
+ tmf.init(loadKeyStoreFromFile(path, password));
return tmf;
}
- private KeyStore loadKeyStoreFromFile(String fileName, String keyStorePassword) throws Exception {
+ private KeyStore loadKeyStoreFromFile(String path, String keyStorePassword) throws Exception {
KeyStore ks = KeyStore.getInstance("jks");
- ks.load(getResource(fileName), keyStorePassword.toCharArray());
+ ks.load(getResource(path), keyStorePassword.toCharArray());
return ks;
}
- private InputStream getResource(String fileName) throws Exception {
- return new FileInputStream(fileName);
+ private InputStream getResource(String path) throws Exception {
+ return new FileInputStream(path);
}
private String loadPasswordFromFile(String path) throws Exception {
diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/config/DmaapCustomConfig.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/config/DmaapCustomConfig.java
index 8691111d..7084d9c1 100644
--- a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/config/DmaapCustomConfig.java
+++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/config/DmaapCustomConfig.java
@@ -50,19 +50,16 @@ public interface DmaapCustomConfig extends Serializable {
String dmaapContentType();
@Value.Parameter
- String keyFile();
+ String trustStorePath();
@Value.Parameter
- String trustStore();
+ String trustStorePasswordPath();
@Value.Parameter
- String trustStorePassword();
+ String keyStorePath();
@Value.Parameter
- String keyStore();
-
- @Value.Parameter
- String keyStorePassword();
+ String keyStorePasswordPath();
@Value.Parameter
Boolean enableDmaapCertAuth();
@@ -83,15 +80,13 @@ public interface DmaapCustomConfig extends Serializable {
B dmaapContentType(String dmaapContentType);
- B keyFile(String keyFile);
-
- B trustStore(String trustStore);
+ B trustStorePath(String trustStorePath);
- B trustStorePassword(String trustStorePass);
+ B trustStorePasswordPath(String trustStorePasswordPath);
- B keyStore(String keyStore);
+ B keyStorePath(String keyStore);
- B keyStorePassword(String keyStorePass);
+ B keyStorePasswordPath(String keyStorePass);
B enableDmaapCertAuth(Boolean enableDmaapCertAuth);
diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPReactiveWebClientFactory.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPReactiveWebClientFactory.java
index 68dda512..ed88efb5 100644
--- a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPReactiveWebClientFactory.java
+++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPReactiveWebClientFactory.java
@@ -74,8 +74,8 @@ public class DMaaPReactiveWebClientFactory {
private SslContext createSslContext(DmaapConsumerConfiguration consumerConfiguration) throws SSLException {
if (consumerConfiguration.enableDmaapCertAuth()) {
return sslFactory.createSecureContext(
- consumerConfiguration.keyStore(), consumerConfiguration.keyStorePassword(),
- consumerConfiguration.trustStore(), consumerConfiguration.trustStorePassword()
+ consumerConfiguration.keyStorePath(), consumerConfiguration.keyStorePasswordPath(),
+ consumerConfiguration.trustStorePath(), consumerConfiguration.trustStorePasswordPath()
);
}
return sslFactory.createInsecureContext();
diff --git a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapConsumerConfigurationTest.java b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapConsumerConfigurationTest.java
index 01d470a0..54193edd 100644
--- a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapConsumerConfigurationTest.java
+++ b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapConsumerConfigurationTest.java
@@ -44,11 +44,10 @@ class DmaapConsumerConfigurationTest {
String consumerGroup = "other";
Integer timeoutMs = 1000;
Integer messageLimit = 1000;
- String keyFile = "keyFile";
- String trustStore = "trustStore";
- String trustStorePass = "trustPass";
- String keyStore = "keyStore";
- String keyStorePass = "keyPass";
+ String trustStorePath = "trustStorePath";
+ String trustStorePasswordPath = "trustStorePasswordPath";
+ String keyStorePath = "keyStorePath";
+ String keyStorePasswordPath = "keyStorePasswordPath";
Boolean enableDmaapCertAuth = true;
// When
@@ -64,11 +63,10 @@ class DmaapConsumerConfigurationTest {
.consumerGroup(consumerGroup)
.timeoutMs(timeoutMs)
.messageLimit(messageLimit)
- .keyFile(keyFile)
- .trustStore(trustStore)
- .trustStorePassword(trustStorePass)
- .keyStore(keyStore)
- .keyStorePassword(keyStorePass)
+ .trustStorePath(trustStorePath)
+ .trustStorePasswordPath(trustStorePasswordPath)
+ .keyStorePath(keyStorePath)
+ .keyStorePasswordPath(keyStorePasswordPath)
.enableDmaapCertAuth(enableDmaapCertAuth)
.build();
@@ -76,9 +74,10 @@ class DmaapConsumerConfigurationTest {
assertEquals("DmaapConsumerConfiguration{"
+ "consumerId=1, consumerGroup=other, timeoutMs=1000, messageLimit=1000, dmaapHostName=localhost, "
+ "dmaapPortNumber=2222, dmaapTopicName=temp, dmaapProtocol=http, dmaapUserName=admin, "
- + "dmaapUserPassword=admin, dmaapContentType=application/json, keyFile=keyFile, "
- + "trustStore=trustStore, trustStorePassword=trustPass, keyStore=keyStore, "
- + "keyStorePassword=keyPass, enableDmaapCertAuth=true}", configuration.toString());
+ + "dmaapUserPassword=admin, dmaapContentType=application/json, "
+ + "trustStorePath=trustStorePath, trustStorePasswordPath=trustStorePasswordPath, "
+ + "keyStorePath=keyStorePath, keyStorePasswordPath=keyStorePasswordPath, enableDmaapCertAuth=true}",
+ configuration.toString());
}
}
diff --git a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapPublisherConfigurationTest.java b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapPublisherConfigurationTest.java
index d6471381..472abec5 100644
--- a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapPublisherConfigurationTest.java
+++ b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapPublisherConfigurationTest.java
@@ -41,11 +41,10 @@ class DmaapPublisherConfigurationTest {
String dmaapUserName = "admin";
String dmaapUserPassword = "admin";
String dmaapContentType = "application/json";
- String keyFile = "keyFile";
- String trustStore = "trustStore";
- String trustStorePass = "trustPass";
- String keyStore = "keyStore";
- String keyStorePass = "keyPass";
+ String trustStorePath = "trustStorePath";
+ String trustStorePasswordPath = "trustStorePasswordPath";
+ String keyStorePath = "keyStorePath";
+ String keyStorePasswordPath = "keyStorePasswordPath";
Boolean enableDmaapCertAuth = true;
// When
@@ -57,19 +56,18 @@ class DmaapPublisherConfigurationTest {
.dmaapUserName(dmaapUserName)
.dmaapUserPassword(dmaapUserPassword)
.dmaapContentType(dmaapContentType)
- .keyFile(keyFile)
- .trustStore(trustStore)
- .trustStorePassword(trustStorePass)
- .keyStore(keyStore)
- .keyStorePassword(keyStorePass)
+ .trustStorePath(trustStorePath)
+ .trustStorePasswordPath(trustStorePasswordPath)
+ .keyStorePath(keyStorePath)
+ .keyStorePasswordPath(keyStorePasswordPath)
.enableDmaapCertAuth(enableDmaapCertAuth)
.build();
// Then
assertEquals("DmaapPublisherConfiguration{dmaapHostName=localhost, dmaapPortNumber=2222, "
+ "dmaapTopicName=temp, dmaapProtocol=http, dmaapUserName=admin, dmaapUserPassword=admin, "
- + "dmaapContentType=application/json, keyFile=keyFile, trustStore=trustStore, "
- + "trustStorePassword=trustPass, keyStore=keyStore, keyStorePassword=keyPass, "
- + "enableDmaapCertAuth=true}", configuration.toString());
+ + "dmaapContentType=application/json, trustStorePath=trustStorePath, "
+ + "trustStorePasswordPath=trustStorePasswordPath, keyStorePath=keyStorePath, "
+ + "keyStorePasswordPath=keyStorePasswordPath, enableDmaapCertAuth=true}", configuration.toString());
}
}
diff --git a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPReactiveWebClientFactoryTest.java b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPReactiveWebClientFactoryTest.java
index 887d5d33..b2cd84c6 100644
--- a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPReactiveWebClientFactoryTest.java
+++ b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPReactiveWebClientFactoryTest.java
@@ -77,10 +77,10 @@ class DMaaPReactiveWebClientFactoryTest {
private DmaapConsumerConfiguration givenDmaapConfigurationWithSslEnabled() {
DmaapConsumerConfiguration dmaapConsumerConfiguration = mock(DmaapConsumerConfiguration.class);
when(dmaapConsumerConfiguration.enableDmaapCertAuth()).thenReturn(true);
- when(dmaapConsumerConfiguration.keyStore()).thenReturn(KEY_STORE);
- when(dmaapConsumerConfiguration.keyStorePassword()).thenReturn(KEY_STORE_PASS);
- when(dmaapConsumerConfiguration.trustStore()).thenReturn(TRUST_STORE);
- when(dmaapConsumerConfiguration.trustStorePassword()).thenReturn(TRUST_STORE_PASS);
+ when(dmaapConsumerConfiguration.keyStorePath()).thenReturn(KEY_STORE);
+ when(dmaapConsumerConfiguration.keyStorePasswordPath()).thenReturn(KEY_STORE_PASS);
+ when(dmaapConsumerConfiguration.trustStorePath()).thenReturn(TRUST_STORE);
+ when(dmaapConsumerConfiguration.trustStorePasswordPath()).thenReturn(TRUST_STORE_PASS);
return dmaapConsumerConfiguration;
}
} \ No newline at end of file