diff options
author | mark.j.leonard <mark.j.leonard@gmail.com> | 2019-03-29 16:29:44 +0000 |
---|---|---|
committer | mark.j.leonard <mark.j.leonard@gmail.com> | 2019-04-03 10:44:28 +0100 |
commit | 61607b8e66f19aba46d0c0f7cec3a9fe2c6e1e08 (patch) | |
tree | b330dc7b884643a04b38801a92a2400df3850535 /src/test | |
parent | 60457e41054465e9fa10c8e6bfdbfa62a45d1f0a (diff) |
Move REQUIRE_CLIENT_AUTH code to start script
Move the conversion from the REQUIRE_CLIENT_AUTH env variable to the
Spring setting server.ssl.client-auth out of the Java code and in to the
start script. This declutters the code and exposes this setting.
Refactor the code for readability: have Jetty deobfuscate the password
string for us rather than manually detecting the "OBF:" prefix.
Also fix a typo (spelling mistake).
Change-Id: Ic670c04f97f59e06e48ca2cf4d7a0188020b3eaa
Issue-ID: AAI-2280
Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/onap/aai/babel/TestApplication.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/java/org/onap/aai/babel/TestApplication.java b/src/test/java/org/onap/aai/babel/TestApplication.java index 8c9ca5e..bb43b40 100644 --- a/src/test/java/org/onap/aai/babel/TestApplication.java +++ b/src/test/java/org/onap/aai/babel/TestApplication.java @@ -93,6 +93,20 @@ public class TestApplication { BabelApplication.main(new String[] {}); } + /** + * This test asserts that if the KEY_STORE_PASSWORD System Property is set (and is not empty) then the value is + * passed to Jetty, debobfuscated, and used to open the key store, even if the resulting password value is actually + * an empty string. + */ + @Test + public void testApplicationWithBlankObfuscatedKeyStorePassword() { + // Note that "OBF:" is correctly deobfuscated and results in an empty string. + System.setProperty("KEY_STORE_PASSWORD", "OBF:"); + final CauseMatcher expectedCause = new CauseMatcher(IOException.class, "password was incorrect"); + expectedEx.expectCause(expectedCause); + BabelApplication.main(new String[] {}); + } + private static class CauseMatcher extends TypeSafeMatcher<Throwable> { private final Class<? extends Throwable> type; |