X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aaf%2Fcadi.git;a=blobdiff_plain;f=sidecar%2Ffproxy%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Ffproxy%2FRestTemplateConfig.java;fp=sidecar%2Ffproxy%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Ffproxy%2FRestTemplateConfig.java;h=8acfd86e13a81b1fb820bdc19c469c6fac4c2428;hp=a1aef284282077fd6efe4a59e43577ad282ea3a9;hb=16b2d4d78ac172b01e5e68d088390136b572d09e;hpb=38c02e8cd810f596ff47e641ac7c08b9a760a91e diff --git a/sidecar/fproxy/src/main/java/org/onap/aaf/fproxy/RestTemplateConfig.java b/sidecar/fproxy/src/main/java/org/onap/aaf/fproxy/RestTemplateConfig.java index a1aef28..8acfd86 100644 --- a/sidecar/fproxy/src/main/java/org/onap/aaf/fproxy/RestTemplateConfig.java +++ b/sidecar/fproxy/src/main/java/org/onap/aaf/fproxy/RestTemplateConfig.java @@ -26,6 +26,7 @@ import org.apache.http.conn.ssl.NoopHostnameVerifier; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContextBuilder; +import org.eclipse.jetty.util.security.Password; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.context.annotation.Bean; @@ -41,9 +42,15 @@ public class RestTemplateConfig { @Value("${server.ssl.client-cert}") private String clientCertPath; - @Value("${server.ssl.key-store-password}") + @Value("${server.ssl.client-cert-password}") private String clientCertPassword; + @Value("${server.ssl.key-store}") + private String keystorePath; + + @Value("${server.ssl.key-store-password}") + private String keystorePassword; + @Profile("secure") @Bean public RestTemplate restTemplate(RestTemplateBuilder builder) throws GeneralSecurityException, IOException { @@ -61,9 +68,9 @@ public class RestTemplateConfig { private HttpClientBuilder getClientBuilder() throws GeneralSecurityException, IOException { SSLContext sslContext = SSLContextBuilder.create() - .loadKeyMaterial(ResourceUtils.getFile(clientCertPath), clientCertPassword.toCharArray(), - clientCertPassword.toCharArray()) - .loadTrustMaterial(ResourceUtils.getFile(clientCertPath), clientCertPassword.toCharArray()).build(); + .loadKeyMaterial(ResourceUtils.getFile(clientCertPath), Password.deobfuscate(clientCertPassword).toCharArray(), + keystorePassword.toCharArray()) + .loadTrustMaterial(ResourceUtils.getFile(keystorePath), keystorePassword.toCharArray()).build(); return HttpClients.custom().setSSLContext(sslContext); }