diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2024-04-10 14:02:33 +0100 |
---|---|---|
committer | adheli.tavares <adheli.tavares@est.tech> | 2024-04-10 14:02:48 +0100 |
commit | 691631b842b18c04ed3ff230e15594b138d7b329 (patch) | |
tree | 37cba0a29b03c2939be77d11fa0e73d46ec2014d /gui-server/src | |
parent | b84171a5e9e6c24afc29ed7bec7d3bf1e57120f0 (diff) |
Dependency management update
- including dependencies to pom.xml files only where they are used,
avoiding extra dependencies being added in all packages.
Issue-ID: POLICY-4945
Change-Id: Ib92fcae59a3da6fa3bf3d4a5e741ca1b012c4a40
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'gui-server/src')
-rw-r--r-- | gui-server/src/main/java/org/onap/policy/gui/server/config/BaseRestTemplateConfig.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gui-server/src/main/java/org/onap/policy/gui/server/config/BaseRestTemplateConfig.java b/gui-server/src/main/java/org/onap/policy/gui/server/config/BaseRestTemplateConfig.java index 289a629..0fe4673 100644 --- a/gui-server/src/main/java/org/onap/policy/gui/server/config/BaseRestTemplateConfig.java +++ b/gui-server/src/main/java/org/onap/policy/gui/server/config/BaseRestTemplateConfig.java @@ -1,7 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Copyright (C) 2022-2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,10 +29,10 @@ import lombok.Setter; import org.apache.hc.client5.http.impl.classic.HttpClients; import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder; import org.apache.hc.client5.http.ssl.NoopHostnameVerifier; +import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory; import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder; import org.apache.hc.client5.http.ssl.TrustAllStrategy; import org.apache.hc.core5.ssl.SSLContextBuilder; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -78,15 +77,16 @@ public class BaseRestTemplateConfig { sslContext = new SSLContextBuilder().loadTrustMaterial(trustStore.getURL(), trustStorePassword).build(); } - HostnameVerifier hostnameVerifier; + SSLConnectionSocketFactory csf; if (disableSslHostnameCheck) { - hostnameVerifier = new NoopHostnameVerifier(); + HostnameVerifier hostnameVerifier = new NoopHostnameVerifier(); + csf = SSLConnectionSocketFactoryBuilder.create() + .setSslContext(sslContext).setHostnameVerifier(hostnameVerifier).build(); } else { - hostnameVerifier = SSLConnectionSocketFactory.getDefaultHostnameVerifier(); + csf = SSLConnectionSocketFactoryBuilder.create() + .setSslContext(sslContext).build(); } - var csf = SSLConnectionSocketFactoryBuilder.create() - .setSslContext(sslContext).setHostnameVerifier(hostnameVerifier).build(); var httpClientBuilder = PoolingHttpClientConnectionManagerBuilder.create().setSSLSocketFactory(csf).build(); var httpClient = HttpClients.custom().setConnectionManager(httpClientBuilder).build(); var requestFactory = new HttpComponentsClientHttpRequestFactory(); |