diff options
Diffstat (limited to 'prh-app-server/src')
7 files changed, 88 insertions, 111 deletions
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" } |