Skip to content

Commit 16247ed

Browse files
added getSslContextForAde method
1 parent f424bc0 commit 16247ed

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/main/java/it/pagopa/pn/national/registries/client/SecureWebClientUtils.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ public class SecureWebClientUtils {
2424
private final X509CertificateUtils x509CertificateUtils;
2525

2626
public final SslContext getSslContext(SslContextBuilder sslContextBuilder, String trust) throws SSLException {
27+
boolean notHasTrust = StringUtils.isNullOrEmpty(trust);
28+
if (notHasTrust) {
29+
return sslContextBuilder.build();
30+
}
31+
return sslContextBuilder.trustManager(getTrustCertInputStream(trust)).build();
32+
}
33+
34+
public final SslContext getSslContextForAde(SslContextBuilder sslContextBuilder, String trust ) throws SSLException {
2735
boolean notHasTrust = StringUtils.isNullOrEmpty(trust);
2836
if (notHasTrust) {
2937
return sslContextBuilder.build();

src/main/java/it/pagopa/pn/national/registries/config/adecheckcf/CheckCfClientConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected HttpClient buildHttpClient() {
4949
protected SslContext buildSslContext() {
5050
try {
5151
TrustData trustData = pnNationalRegistriesSecretService.getTrustedCertFromSecret(checkCfSecretConfig.getTrustData());
52-
return secureWebClientUtils.getSslContext(SslContextBuilder.forClient(), trustData.getTrust());
52+
return secureWebClientUtils.getSslContextForAde(SslContextBuilder.forClient(), trustData.getTrust());
5353
} catch (IOException e) {
5454
throw new PnInternalException(ERROR_MESSAGE_CHECK_CF, ERROR_CODE_CHECK_CF, e);
5555
}

0 commit comments

Comments
 (0)