aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/aai/modelloader/restclient/AaiRestClient.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/onap/aai/modelloader/restclient/AaiRestClient.java')
-rw-r--r--src/main/java/org/onap/aai/modelloader/restclient/AaiRestClient.java25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/main/java/org/onap/aai/modelloader/restclient/AaiRestClient.java b/src/main/java/org/onap/aai/modelloader/restclient/AaiRestClient.java
index a2a4c5b..29c0c70 100644
--- a/src/main/java/org/onap/aai/modelloader/restclient/AaiRestClient.java
+++ b/src/main/java/org/onap/aai/modelloader/restclient/AaiRestClient.java
@@ -157,14 +157,23 @@ public class AaiRestClient {
private RestClient setupClient() {
RestClient restClient = new RestClient();
- // @formatter:off
- restClient.validateServerHostname(false)
- .validateServerCertChain(false)
- .clientCertFile(config.getAaiKeyStorePath())
- .clientCertPassword(config.getAaiKeyStorePassword())
- .connectTimeoutMs(120000)
- .readTimeoutMs(120000);
- // @formatter:on
+ //Use certs only if SSL is enabled
+ if (config.useHttpsWithAAI())
+ {// @formatter:off
+ restClient.validateServerHostname(false)
+ .validateServerCertChain(false)
+ .clientCertFile(config.getAaiKeyStorePath())
+ .clientCertPassword(config.getAaiKeyStorePassword())
+ .connectTimeoutMs(120000)
+ .readTimeoutMs(120000);
+ // @formatter:on
+ }
+ else {
+ restClient.validateServerHostname(false)
+ .validateServerCertChain(false)
+ .connectTimeoutMs(120000)
+ .readTimeoutMs(120000);
+ }
if (useBasicAuth()) {
restClient.authenticationMode(RestAuthenticationMode.SSL_BASIC);