From 4e4988af6aa561d4950711322941cab8c2d2c895 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Fri, 9 Jul 2021 10:20:56 -0400 Subject: Add host name verifier that accepts IP addresses Add a host name verifier that handles IP addresses as special cases, so that they can be safely ignored in lab environments Issue-ID: CCSDK-3196 Signed-off-by: Dan Timoney Change-Id: I83cec989102620b52a227b7ca71efb92227d834c --- .../onap/ccsdk/sli/adaptors/base/http/AbstractHttpAdapter.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'adaptors/base/http') diff --git a/adaptors/base/http/provider/src/main/java/org/onap/ccsdk/sli/adaptors/base/http/AbstractHttpAdapter.java b/adaptors/base/http/provider/src/main/java/org/onap/ccsdk/sli/adaptors/base/http/AbstractHttpAdapter.java index 65cbdd764..0950ceba8 100644 --- a/adaptors/base/http/provider/src/main/java/org/onap/ccsdk/sli/adaptors/base/http/AbstractHttpAdapter.java +++ b/adaptors/base/http/provider/src/main/java/org/onap/ccsdk/sli/adaptors/base/http/AbstractHttpAdapter.java @@ -10,6 +10,7 @@ import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLSession; import javax.ws.rs.client.ClientBuilder; +import org.onap.ccsdk.sli.core.utils.common.AcceptIpAddressHostNameVerifier; import org.onap.ccsdk.sli.core.utils.common.EnvProperties; import org.onap.logging.filter.base.MetricLogClientFilter; import org.onap.logging.filter.base.PayloadLoggingClientFilter; @@ -32,12 +33,8 @@ public abstract class AbstractHttpAdapter { } private void defaultHostNameVerifier() { - clientBuilder.hostnameVerifier(new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { - return true; - } - }); + // Perform host name verification EXCEPT if 'host' is IP address + clientBuilder.hostnameVerifier(new AcceptIpAddressHostNameVerifier()); } protected void enableMetricLogging() { -- cgit 1.2.3-korg