diff options
author | Alexis de Talhouët <adetalhouet89@gmail.com> | 2018-01-29 10:38:40 -0500 |
---|---|---|
committer | Alexis de Talhouët <adetalhouet89@gmail.com> | 2018-01-29 11:16:00 -0500 |
commit | d6427a753cc4962f92f8d07d8ed184c83dc7c029 (patch) | |
tree | 57509890d8886cfeb3c1856f4cb3b78d30f0e163 /controlloop/common/model-impl/rest/src/main | |
parent | e285764b0eddab0d4195128f55a9f524beee3f05 (diff) |
Do not enforce hostname validation
Change-Id: I1c4e5d58126e35a64140c91c0c3afda5e9b3a5bd
Issue-ID: POLICY-510
Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
Diffstat (limited to 'controlloop/common/model-impl/rest/src/main')
-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) { |