Policy Management Service, support for SEC4 and SEC5 - A1 Jakarta 29/124129/2 1.2.1
authorPatrikBuhr <patrik.buhr@est.tech>
Wed, 8 Sep 2021 13:48:21 +0000 (15:48 +0200)
committerKAPIL SINGAL <ks220y@att.com>
Tue, 14 Sep 2021 17:33:20 +0000 (17:33 +0000)
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 <patrik.buhr@est.tech>
a1-policy-management/config/application.yaml
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClient.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java
a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java

index 6bef52b..a40f172 100644 (file)
@@ -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
 
index ad2e221..c3be9b4 100644 (file)
@@ -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;
     }
index 170ade6..3a24519 100644 (file)
@@ -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<String, RicConfig> 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() //
index beb6e51..1e5d7ff 100644 (file)
@@ -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();