diff options
author | 2019-04-03 10:34:37 +0000 | |
---|---|---|
committer | 2019-04-03 10:34:37 +0000 | |
commit | 6b52f93a1965dfadd55410a4231446c9fb374633 (patch) | |
tree | f3d18ecc852626f917ce3a9d5c318f804812177a /src/main/java/org | |
parent | a7601b88fcb8abb0a40d26d16948b29ae45d370d (diff) | |
parent | 61607b8e66f19aba46d0c0f7cec3a9fe2c6e1e08 (diff) |
Merge "Move REQUIRE_CLIENT_AUTH code to start script"
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/onap/aai/babel/BabelApplication.java | 23 | ||||
-rw-r--r-- | src/main/java/org/onap/aai/babel/request/RequestHeaders.java | 7 |
2 files changed, 13 insertions, 17 deletions
diff --git a/src/main/java/org/onap/aai/babel/BabelApplication.java b/src/main/java/org/onap/aai/babel/BabelApplication.java index 9eaa0ce..e524e6e 100644 --- a/src/main/java/org/onap/aai/babel/BabelApplication.java +++ b/src/main/java/org/onap/aai/babel/BabelApplication.java @@ -21,7 +21,7 @@ package org.onap.aai.babel; -import java.util.HashMap; +import com.google.common.collect.ImmutableMap; import org.eclipse.jetty.util.security.Password; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -38,26 +38,21 @@ public class BabelApplication extends SpringBootServletInitializer { /** * Spring Boot Initialization. - * + * * @param args - * main args + * main args (expected to be null) */ public static void main(String[] args) { String keyStorePassword = System.getProperty("KEY_STORE_PASSWORD"); if (keyStorePassword == null || keyStorePassword.isEmpty()) { - throw new IllegalArgumentException("Env property KEY_STORE_PASSWORD not set"); + throw new IllegalArgumentException("Mandatory property KEY_STORE_PASSWORD not set"); } - HashMap<String, Object> props = new HashMap<>(); - String decryptedValue = keyStorePassword.startsWith(Password.__OBFUSCATE) ? // - Password.deobfuscate(keyStorePassword) : keyStorePassword; - props.put("server.ssl.key-store-password", decryptedValue); + ImmutableMap<String, Object> defaults = + ImmutableMap.of("server.ssl.key-store-password", new Password(keyStorePassword).toString()); - String requireClientAuth = System.getenv("REQUIRE_CLIENT_AUTH"); - props.put("server.ssl.client-auth", - Boolean.FALSE.toString().equalsIgnoreCase(requireClientAuth) ? "want" : "need"); - - context = new BabelApplication() - .configure(new SpringApplicationBuilder(BabelApplication.class).properties(props)).run(args); + context = new BabelApplication() // + .configure(new SpringApplicationBuilder(BabelApplication.class).properties(defaults)) // + .run(args); } public static void exit() { diff --git a/src/main/java/org/onap/aai/babel/request/RequestHeaders.java b/src/main/java/org/onap/aai/babel/request/RequestHeaders.java index f0d960c..1850d62 100644 --- a/src/main/java/org/onap/aai/babel/request/RequestHeaders.java +++ b/src/main/java/org/onap/aai/babel/request/RequestHeaders.java @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 European Software Marketing Ltd. + * Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2017-2019 European Software Marketing Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.aai.babel.request; import java.util.Optional; @@ -62,7 +63,7 @@ public class RequestHeaders { * If the correlation ID contains the symbol : then this character and any trailing characters are removed. This * allows for an incrementing numeric sequence where there are multiple HTTP requests for a single transaction. * - * @return the normalsed UUID used for correlating transactions across components, or else null (if no ID is set) + * @return the normalized UUID used for correlating transactions across components, or else null (if no ID is set) */ public String getCorrelationId() { // If the request ID is missing, use the transaction ID (if present) |