summaryrefslogtreecommitdiffstats
path: root/adaptors/mdsal-resource
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2021-07-09 10:20:56 -0400
committerKAPIL SINGAL <ks220y@att.com>2021-07-09 17:22:17 +0000
commit4e4988af6aa561d4950711322941cab8c2d2c895 (patch)
tree65c6190636ffa13092badc58b5f1d16dc56db65c /adaptors/mdsal-resource
parent2ab339240c1d0bd8246bebb75d12c4849dd9e4c5 (diff)
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 <dtimoney@att.com> Change-Id: I83cec989102620b52a227b7ca71efb92227d834c
Diffstat (limited to 'adaptors/mdsal-resource')
-rw-r--r--adaptors/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/RestService.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/adaptors/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/RestService.java b/adaptors/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/RestService.java
index ebddc24ae..7f90ab43d 100644
--- a/adaptors/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/RestService.java
+++ b/adaptors/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/RestService.java
@@ -22,6 +22,7 @@
package org.onap.ccsdk.sli.adaptors.resource.mdsal;
import org.apache.commons.codec.binary.Base64;
+import org.onap.ccsdk.sli.core.utils.common.AcceptIpAddressHostNameVerifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
@@ -90,8 +91,8 @@ public class RestService {
try {
HttpURLConnection conn = getRestConnection(fullUrl, method);
if (conn instanceof HttpsURLConnection) {
- HostnameVerifier hostnameVerifier = (hostname, session) -> true;
- ((HttpsURLConnection) conn).setHostnameVerifier(hostnameVerifier);
+ // Safely disable host name verification if host is an IP address or 'localhost'
+ ((HttpsURLConnection) conn).setHostnameVerifier(new AcceptIpAddressHostNameVerifier());
}
// Write message