Merge "Print process name with UAT assert error message" into honolulu
authorKAPIL SINGAL <ks220y@att.com>
Wed, 24 Mar 2021 13:13:23 +0000 (13:13 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 24 Mar 2021 13:13:23 +0000 (13:13 +0000)
ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt

index be9b849..5ab8488 100644 (file)
 
 package org.onap.ccsdk.cds.blueprintsprocessor.rest.service
 
+import org.apache.http.conn.ssl.NoopHostnameVerifier
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory
+import org.apache.http.conn.ssl.TrustAllStrategy
+import org.apache.http.impl.client.CloseableHttpClient
+import org.apache.http.impl.client.HttpClients
 import org.apache.http.message.BasicHeader
+import org.apache.http.ssl.SSLContextBuilder
 import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.utils.WebClientUtils
 import org.springframework.http.HttpHeaders
 import org.springframework.http.MediaType
 import java.net.URI
@@ -48,6 +55,17 @@ class BasicAuthRestClientService(
         return uri.resolve(uri).toString()
     }
 
+    override fun httpClient(): CloseableHttpClient {
+        val sslContext = SSLContextBuilder.create()
+
+        sslContext.loadTrustMaterial(TrustAllStrategy.INSTANCE)
+        val csf = SSLConnectionSocketFactory(sslContext.build(), NoopHostnameVerifier())
+        return HttpClients.custom()
+            .addInterceptorFirst(WebClientUtils.logRequest())
+            .addInterceptorLast(WebClientUtils.logResponse())
+            .setSSLSocketFactory(csf).build()
+    }
+
     override fun convertToBasicHeaders(headers: Map<String, String>):
         Array<BasicHeader> {
             val customHeaders: MutableMap<String, String> = headers.toMutableMap()