aboutsummaryrefslogtreecommitdiffstats
path: root/sidecar/fproxy/src/main/java
diff options
context:
space:
mode:
authorRavi Geda <gravik@amdocs.com>2018-10-25 21:01:13 +0100
committerRavi Geda <gravik@amdocs.com>2018-10-26 14:32:13 +0100
commit05f3b5ca30691246e774dc87cfaaa155769b0248 (patch)
treeedf8c98dc516b5716313298018204d2e41339855 /sidecar/fproxy/src/main/java
parentbf541d5f93db8b4ef1ec5bbd699f5750210304c4 (diff)
Make 2-way TLS optional and fix cert errors
Change-Id: Ia7f94f8903039a7b55946c9cab4f026fe3558f1c Issue-ID: AAF-586 Signed-off-by: Ravi Geda <gravik@amdocs.com>
Diffstat (limited to 'sidecar/fproxy/src/main/java')
-rw-r--r--sidecar/fproxy/src/main/java/org/onap/aaf/fproxy/RestTemplateConfig.java15
1 files changed, 11 insertions, 4 deletions
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);
}