* ============LICENSE_START==========================================
* org.onap.aai
* ===================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
* ===================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.util.HashMap;
import java.util.Map;
+
import javax.annotation.PostConstruct;
+
import org.eclipse.jetty.util.security.Password;
+import org.onap.champ.service.logging.LoggingUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
private Environment env;
public static void main(String[] args) {
+ LoggingUtil.initMdcContext();
+
String keyStorePassword = System.getProperty("KEY_STORE_PASSWORD");
if (keyStorePassword == null || keyStorePassword.isEmpty()) {
throw new RuntimeException("Environment property KEY_STORE_PASSWORD not set");
}
Map<String, Object> props = new HashMap<>();
- props.put("server.ssl.key-store-password", Password.deobfuscate(keyStorePassword));
+ String deobfuscatedKeyStorePassword = keyStorePassword.startsWith("OBF:") ? Password.deobfuscate(keyStorePassword) : keyStorePassword;
+ props.put("server.ssl.key-store-password", deobfuscatedKeyStorePassword);
+
+ String trustStoreLocation = System.getProperty("TRUST_STORE_LOCATION");
+ String trustStorePassword = System.getProperty("TRUST_STORE_PASSWORD");
+ if (trustStoreLocation != null && trustStorePassword != null) {
+ trustStorePassword = trustStorePassword.startsWith("OBF:") ? Password.deobfuscate(trustStorePassword) : trustStorePassword;
+ props.put("server.ssl.trust-store", trustStoreLocation);
+ props.put("server.ssl.trust-store-password", trustStorePassword);
+ }
+
+ String requireClientAuth = System.getenv("REQUIRE_CLIENT_AUTH");
+ if (requireClientAuth == null || requireClientAuth.isEmpty()) {
+ props.put("server.ssl.client-auth", "need");
+ }else {
+ props.put("server.ssl.client-auth",requireClientAuth.equals("true")?"need":"want");
+ }
+
new ChampApplication().configure(new SpringApplicationBuilder(ChampApplication.class).properties(props))
.run(args);
}