From 8330d0e6c2cf1d9d8215e13b928530c2277fa974 Mon Sep 17 00:00:00 2001 From: Maciej Wejs Date: Tue, 6 Nov 2018 12:07:12 +0100 Subject: SSL implementation for PRH to AAI calls Change-Id: Ic9777760346258afb40610fa9c9bc261964752cf Issue-ID: DCAEGEN2-950 Signed-off-by: Maciej Wejs --- .../dcaegen2/services/prh/configuration/AppConfig.java | 18 +++++++++--------- .../services/prh/configuration/PrhAppConfig.java | 7 +++---- .../dcaegen2/services/prh/tasks/AaiProducerTask.java | 3 ++- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'prh-app-server/src/main/java/org/onap') 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 643462f1..191294fd 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 @@ -174,16 +174,16 @@ public class AppConfig extends PrhAppConfig { .consumerId(Optional.ofNullable(consumerId).filter(isEmpty.negate()) .orElse(dmaapConsumerConfiguration.consumerId())) .keyFile( - Optional.ofNullable(keyFile).filter(p -> !p.isEmpty()) + Optional.ofNullable(keyFile).filter(isEmpty.negate()) .orElse(dmaapConsumerConfiguration.keyFile())) .trustStore( - Optional.ofNullable(trustStore).filter(p -> !p.isEmpty()) + Optional.ofNullable(trustStore).filter(isEmpty.negate()) .orElse(dmaapConsumerConfiguration.trustStore())) .trustStorePassword( Optional.ofNullable(trustStorePassword).filter(isEmpty.negate()) .orElse(dmaapConsumerConfiguration.trustStorePassword())) .keyStore( - Optional.ofNullable(keyStore).filter(p -> !p.isEmpty()) + Optional.ofNullable(keyStore).filter(isEmpty.negate()) .orElse(dmaapConsumerConfiguration.keyStore())) .keyStorePassword( Optional.ofNullable(keyStorePassword).filter(isEmpty.negate()) @@ -216,16 +216,16 @@ public class AppConfig extends PrhAppConfig { Optional.ofNullable(aaiPnfPath).filter(isEmpty.negate()).orElse(aaiClientConfiguration.aaiPnfPath())) .aaiHeaders(aaiClientConfiguration.aaiHeaders()) .keyFile( - Optional.ofNullable(keyFile).filter(p -> !p.isEmpty()) + Optional.ofNullable(keyFile).filter(isEmpty.negate()) .orElse(aaiClientConfiguration.keyFile())) .trustStore( - Optional.ofNullable(trustStore).filter(p -> !p.isEmpty()) + Optional.ofNullable(trustStore).filter(isEmpty.negate()) .orElse(aaiClientConfiguration.trustStore())) .trustStorePassword( Optional.ofNullable(trustStorePassword).filter(isEmpty.negate()) .orElse(aaiClientConfiguration.trustStorePassword())) .keyStore( - Optional.ofNullable(keyStore).filter(p -> !p.isEmpty()) + Optional.ofNullable(keyStore).filter(isEmpty.negate()) .orElse(aaiClientConfiguration.keyStore())) .keyStorePassword( Optional.ofNullable(keyStorePassword).filter(isEmpty.negate()) @@ -261,16 +261,16 @@ public class AppConfig extends PrhAppConfig { Optional.ofNullable(producerDmaapUserPassword).filter(isEmpty.negate()) .orElse(dmaapPublisherConfiguration.dmaapUserPassword())) .keyFile( - Optional.ofNullable(keyFile).filter(p -> !p.isEmpty()) + Optional.ofNullable(keyFile).filter(isEmpty.negate()) .orElse(dmaapPublisherConfiguration.keyFile())) .trustStore( - Optional.ofNullable(trustStore).filter(p -> !p.isEmpty()) + Optional.ofNullable(trustStore).filter(isEmpty.negate()) .orElse(dmaapPublisherConfiguration.trustStore())) .trustStorePassword( Optional.ofNullable(trustStorePassword).filter(isEmpty.negate()) .orElse(dmaapPublisherConfiguration.trustStorePassword())) .keyStore( - Optional.ofNullable(keyStore).filter(p -> !p.isEmpty()) + Optional.ofNullable(keyStore).filter(isEmpty.negate()) .orElse(dmaapPublisherConfiguration.keyStore())) .keyStorePassword( Optional.ofNullable(keyStorePassword).filter(isEmpty.negate()) diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java index 54c63532..2b4b201a 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java @@ -95,11 +95,10 @@ public abstract class PrhAppConfig implements Config { try (InputStream inputStream = resourceFile.getInputStream()) { JsonElement rootElement = getJsonElement(parser, inputStream); if (rootElement.isJsonObject()) { - JsonObject jsonObject = concatenateJsonObjects( - rootElement.getAsJsonObject().getAsJsonObject(CONFIG).getAsJsonObject(AAI).getAsJsonObject(AAI_CONFIG), - rootElement.getAsJsonObject().getAsJsonObject(CONFIG).getAsJsonObject(SECURITY)); aaiClientConfiguration = deserializeType(gsonBuilder, - jsonObject, + concatenateJsonObjects( + rootElement.getAsJsonObject().getAsJsonObject(CONFIG).getAsJsonObject(AAI).getAsJsonObject(AAI_CONFIG), + rootElement.getAsJsonObject().getAsJsonObject(CONFIG).getAsJsonObject(SECURITY)), AaiClientConfiguration.class); dmaapConsumerConfiguration = deserializeType(gsonBuilder, concatenateJsonObjects( diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTask.java index efa4f66f..54a8ad89 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTask.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTask.java @@ -27,6 +27,7 @@ import org.onap.dcaegen2.services.prh.exceptions.PrhTaskException; import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel; import org.onap.dcaegen2.services.prh.service.AaiReactiveWebClient; import org.onap.dcaegen2.services.prh.service.producer.AaiProducerReactiveHttpClient; +import org.onap.dcaegen2.services.prh.ssl.SslFactory; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Mono; @@ -46,6 +47,6 @@ public abstract class AaiProducerTask { throws PrhTaskException, SSLException; WebClient buildWebClient() throws SSLException { - return new AaiReactiveWebClient().fromConfiguration(resolveConfiguration()).build(); + return new AaiReactiveWebClient(new SslFactory(), resolveConfiguration()).build(); } } -- cgit 1.2.3-korg