Skip to content

Commit 27682ee

Browse files
author
zxBCN Valeriu_Tuguran,Constantin (IT EDP) EXTERNAL
committed
Add marketplace api client.
1 parent 636cc1c commit 27682ee

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

external-service-marketplace/src/main/java/org/opendevstack/apiservice/externalservice/marketplace/client/MarketplaceApiClientFactory.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ private RestTemplate createRestTemplate(MarketplaceInstanceConfig config) {
157157
restTemplate.setRequestFactory(requestFactory);
158158

159159
if (config.isTrustAllCertificates()) {
160-
log.warn("Trust all certificates is enabled for Marketplace connection. "
160+
log.warn("Trust all certificates is enabled for Marketplace API connection. "
161161
+ "This should only be used in development environments!");
162162
configureTrustAllCertificates(restTemplate);
163163
}
@@ -171,7 +171,6 @@ private RestTemplate createRestTemplate(MarketplaceInstanceConfig config) {
171171
*
172172
* @param restTemplate RestTemplate to configure
173173
*/
174-
@SuppressWarnings({"java:S4830", "java:S1186"})
175174
private void configureTrustAllCertificates(RestTemplate restTemplate) {
176175
try {
177176
TrustManager[] trustAllCerts = new TrustManager[]{
@@ -189,16 +188,15 @@ public void checkServerTrusted(X509Certificate[] certs, String authType) {
189188
}
190189
}
191190
};
192-
193191
SSLContext sslContext = SSLContext.getInstance("TLS");
194192
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
195193

196194
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
197195
// Intentionally disabling hostname verification for development environments
198196
HttpsURLConnection.setDefaultHostnameVerifier((hostname, session) -> true);
199197

200-
} catch (NoSuchAlgorithmException | KeyManagementException e) {
201-
log.error("Failed to configure SSL trust all certificates", e);
198+
} catch (NoSuchAlgorithmException | KeyManagementException ex) {
199+
log.error("Failed to configure SSL trust all certificates for Marketplace API", ex);
202200
}
203201
}
204202
}

0 commit comments

Comments
 (0)