aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules
diff options
context:
space:
mode:
authorClaudio D. Gasparini <claudio.gasparini@intl.att.com>2021-03-23 18:39:35 +0100
committerClaudio D. Gasparini <claudio.gasparini@intl.att.com>2021-03-23 19:45:13 +0100
commitf13c7c4cb1fd32d5f0d36a909285cab2c4337cf9 (patch)
tree381b7e3c9ee76de63df045db6e9cbc3fbee69a5d /ms/blueprintsprocessor/modules
parent91c1deec281ece8aa72b2afd9cc68b2d63c38189 (diff)
Fix Certificate Exception when using BasicAuthRestClientService
by using TrustAllStrategy Issue-ID: CCSDK-3234 Signed-off-by: Claudio D. Gasparini <claudio.gasparini@intl.att.com> Change-Id: I7ee63739b4f1d7a4ddbc618ba660704aa058752a
Diffstat (limited to 'ms/blueprintsprocessor/modules')
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt18
1 files changed, 18 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt
index be9b849f6..5ab848893 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt
@@ -16,8 +16,15 @@
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()
2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
tosca_definitions_version: tosca_simple_yaml_1_1
metadata:
  invariantUUID: eb48e8b6-1ad6-48c1-91d2-f77c5792a624
  UUID: 4ded12c9-0565-446a-82f6-eac26b0d4031
  name: VnfVirtualLink
  description: VnfVirtualLink
  type: VL
  category: Generic
  subcategory: Infrastructure
  resourceVendor: ATT (Tosca)
  resourceVendorRelease: 1.0.0.wd03
  resourceVendorModelNumber: ''
imports:
- nodes:
    file: nodes.yml
- datatypes:
    file: data.yml
- capabilities:
    file: capabilities.yml
- relationships:
    file: relationships.yml
- groups:
    file: groups.yml
- policies:
    file: policies.yml
- annotations:
    file: annotations.yml
node_types:
  tosca.nodes.nfv.VnfVirtualLink:
    derived_from: tosca.nodes.Root
    description: VnfVirtualLink
    properties:
      vl_profile:
        type: tosca.datatypes.nfv.VlProfile
      description:
        type: string
      test_access:
        type: list
        entry_schema:
          type: string
      connectivity_type:
        type: tosca.datatypes.nfv.ConnectivityType
    capabilities:
      virtual_linkable:
        type: tosca.capabilities.nfv.VirtualLinkable
        occurrences:
        - 1
        - UNBOUNDED
        valid_source_types: [
          ]
      monitoring_parameter:
        type: tosca.capabilities.nfv.Metric
        occurrences:
        - 0
        - UNBOUNDED
        valid_source_types: [
          ]