From 605fa6cedd43482cb5ca871a8b54f59683f5d560 Mon Sep 17 00:00:00 2001 From: Jonathan Platt Date: Tue, 20 Jul 2021 10:13:48 -0400 Subject: Use host name verifier that accepts IP addresses Modify 'SdncOdlConnection.java' to use a hostname verfier that handles IP addresses as special cases, so that they can be safely ignored in lab environments Issue-ID: SDNC-1497 Signed-off-by: Jonathan Platt Change-Id: I73ca672226b055eb7d6896ec260777261f9bb455 --- .../org/onap/sdnc/northbound/asyncrequests/SdncOdlConnection.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'optical-service/provider') diff --git a/optical-service/provider/src/main/java/org/onap/sdnc/northbound/asyncrequests/SdncOdlConnection.java b/optical-service/provider/src/main/java/org/onap/sdnc/northbound/asyncrequests/SdncOdlConnection.java index 860e84bb..accdb4e9 100644 --- a/optical-service/provider/src/main/java/org/onap/sdnc/northbound/asyncrequests/SdncOdlConnection.java +++ b/optical-service/provider/src/main/java/org/onap/sdnc/northbound/asyncrequests/SdncOdlConnection.java @@ -32,6 +32,7 @@ import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLSession; import org.apache.commons.codec.binary.Base64; +import org.onap.ccsdk.sli.core.utils.common.AcceptIpAddressHostNameVerifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -105,12 +106,7 @@ public class SdncOdlConnection { httpConn.setUseCaches(false); if (httpConn instanceof HttpsURLConnection) { - HostnameVerifier hostnameVerifier = new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { - return true; - } - }; + HostnameVerifier hostnameVerifier = new AcceptIpAddressHostNameVerifier(); ((HttpsURLConnection) httpConn).setHostnameVerifier(hostnameVerifier); } -- cgit 1.2.3-korg