diff options
author | Jorge Hernandez <jh1730@att.com> | 2018-01-30 18:47:43 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-01-30 18:47:43 +0000 |
commit | 1cd77623db3c66601eee6b6dd7cee7e6f5d5f53d (patch) | |
tree | e29e38f904e32114b5285c6533d69919361f50b1 | |
parent | 7767c5643349e5e6691a07afd5c4acd3ef9d5617 (diff) | |
parent | d6427a753cc4962f92f8d07d8ed184c83dc7c029 (diff) |
Merge "Do not enforce hostname validation"
-rw-r--r-- | controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java index 2540cb27a..dae31c39a 100644 --- a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java +++ b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java @@ -30,6 +30,7 @@ import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.CredentialsProvider; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; +import org.apache.http.conn.ssl.NoopHostnameVerifier; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.CloseableHttpClient; @@ -67,7 +68,11 @@ public class RESTManager { logger.debug(body); try (CloseableHttpClient client = - HttpClientBuilder.create().setDefaultCredentialsProvider(credentials).build()) { + HttpClientBuilder + .create() + .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) + .setDefaultCredentialsProvider(credentials) + .build()) { HttpPost post = new HttpPost(url); if (headers != null) { @@ -111,7 +116,11 @@ public class RESTManager { new UsernamePasswordCredentials(username, password)); try (CloseableHttpClient client = - HttpClientBuilder.create().setDefaultCredentialsProvider(credentials).build()) { + HttpClientBuilder + .create() + .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) + .setDefaultCredentialsProvider(credentials) + .build()) { HttpGet get = new HttpGet(url); if (headers != null) { |