From 9ec50cfde6a95090b919e9417db83501c4a35ccd Mon Sep 17 00:00:00 2001 From: PatrikBuhr Date: Wed, 8 Sep 2021 15:48:21 +0200 Subject: Policy Management Service, support for SEC4 and SEC5 - A1 Jakarta Added support for using protocols SEC4 and SEC5 between the PMS and a HTTP proxy in order to make that communication encrypted. Change-Id: Ia0e992d2bc41db67203ec75a94c84aeecf77bdce Issue-ID: CCSDK-3459 Signed-off-by: PatrikBuhr --- a1-policy-management/config/application.yaml | 2 ++ .../oran/a1policymanagementservice/clients/AsyncRestClient.java | 6 +++--- .../a1policymanagementservice/configuration/ApplicationConfig.java | 6 ++++++ .../a1policymanagementservice/configuration/WebClientConfig.java | 3 +++ 4 files changed, 14 insertions(+), 3 deletions(-) (limited to 'a1-policy-management') diff --git a/a1-policy-management/config/application.yaml b/a1-policy-management/config/application.yaml index 6bef52b0..a40f172f 100644 --- a/a1-policy-management/config/application.yaml +++ b/a1-policy-management/config/application.yaml @@ -68,8 +68,10 @@ app: trust-store: /opt/app/policy-agent/etc/cert/truststore.jks # Configuration of usage of HTTP Proxy for the southbound accesses. # The HTTP proxy (if configured) will only be used for accessing NearRT RIC:s + # proxy-type can be either HTTP, SOCKS4 or SOCKS5 http.proxy-host: http.proxy-port: 0 + http.proxy-type: HTTP # path where the service can store data vardata-directory: /var/policy-management-service diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClient.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClient.java index ad2e221f..c3be9b4d 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClient.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClient.java @@ -42,7 +42,6 @@ import org.springframework.web.reactive.function.client.WebClientResponseExcepti import reactor.core.publisher.Mono; import reactor.netty.http.client.HttpClient; -import reactor.netty.transport.ProxyProvider; /** * Generic reactive REST client. @@ -211,8 +210,9 @@ public class AsyncRestClient { } if (isHttpProxyConfigured()) { - httpClient = httpClient.proxy(proxy -> proxy.type(ProxyProvider.Proxy.HTTP) - .host(httpProxyConfig.httpProxyHost()).port(httpProxyConfig.httpProxyPort())); + httpClient = httpClient.proxy(proxy -> proxy.type(httpProxyConfig.httpProxyType()) // + .host(httpProxyConfig.httpProxyHost()) // + .port(httpProxyConfig.httpProxyPort())); } return httpClient; } diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java index 170ade6f..3a245190 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java @@ -33,7 +33,9 @@ import org.onap.ccsdk.oran.a1policymanagementservice.configuration.WebClientConf import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.EnableConfigurationProperties; + import reactor.core.publisher.Flux; +import reactor.netty.transport.ProxyProvider; @EnableConfigurationProperties public class ApplicationConfig { @@ -73,6 +75,9 @@ public class ApplicationConfig { @Value("${app.webclient.http.proxy-port:0}") private int httpProxyPort = 0; + @Value("${app.webclient.http.proxy-type:HTTP}") + private String httpProxyType = "HTTP"; + private Map ricConfigs = new HashMap<>(); @Getter @@ -94,6 +99,7 @@ public class ApplicationConfig { HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() // .httpProxyHost(this.httpProxyHost) // .httpProxyPort(this.httpProxyPort) // + .httpProxyType(ProxyProvider.Proxy.valueOf(this.httpProxyType)) // .build(); this.webClientConfig = ImmutableWebClientConfig.builder() // diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java index beb6e51f..1e5d7ffa 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java @@ -21,6 +21,7 @@ package org.onap.ccsdk.oran.a1policymanagementservice.configuration; import org.immutables.value.Value; +import reactor.netty.transport.ProxyProvider; @Value.Immutable @Value.Style(redactedMask = "####") @@ -47,6 +48,8 @@ public interface WebClientConfig { public String httpProxyHost(); public int httpProxyPort(); + + public ProxyProvider.Proxy httpProxyType(); } public HttpProxyConfig httpProxyConfig(); -- cgit 1.2.3-korg