Change-Id: Ia7f94f8903039a7b55946c9cab4f026fe3558f1c
Issue-ID: AAF-586
Signed-off-by: Ravi Geda <gravik@amdocs.com>
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
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;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
@Value("${server.ssl.client-cert}")
private String clientCertPath;
@Value("${server.ssl.client-cert}")
private String clientCertPath;
- @Value("${server.ssl.key-store-password}")
+ @Value("${server.ssl.client-cert-password}")
private String clientCertPassword;
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 {
@Profile("secure")
@Bean
public RestTemplate restTemplate(RestTemplateBuilder builder) throws GeneralSecurityException, IOException {
private HttpClientBuilder getClientBuilder() throws GeneralSecurityException, IOException {
SSLContext sslContext = SSLContextBuilder.create()
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);
}
return HttpClients.custom().setSSLContext(sslContext);
}
server.port=10680
server.ssl.key-store=${CONFIG_HOME}/auth/tomcat_keystore
server.ssl.client-cert=${CONFIG_HOME}/auth/client-cert.p12
server.port=10680
server.ssl.key-store=${CONFIG_HOME}/auth/tomcat_keystore
server.ssl.client-cert=${CONFIG_HOME}/auth/client-cert.p12
-server.ssl.client-auth=need
+server.ssl.client-cert-password=OBF:1y0q1uvc1uum1uvg1pil1pjl1uuq1uvk1uuu1y10
+server.ssl.client-auth=want
+server.servlet.context-path=/
logging.config=${CONFIG_HOME}/logback-spring.xml
logging.config=${CONFIG_HOME}/logback-spring.xml