diff options
author | mark.j.leonard <mark.j.leonard@gmail.com> | 2019-01-22 12:42:30 +0000 |
---|---|---|
committer | mark.j.leonard <mark.j.leonard@gmail.com> | 2019-01-22 12:57:46 +0000 |
commit | 3d327a141936b42ac525fc44f08564d73863507f (patch) | |
tree | 185f4b42011178a7b234b4df24425e6e3dbfd9d4 /src | |
parent | 3ec58a16f80426968919fe5da42732bf693909e0 (diff) |
Use Jetty deobfuscation method on password strings
Change-Id: Ifc36d8358c54f2602ecab2fb965461a6436bfcae
Issue-ID: AAI-2110
Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
Diffstat (limited to 'src')
7 files changed, 17 insertions, 15 deletions
diff --git a/src/main/java/org/onap/aai/validation/config/RestConfig.java b/src/main/java/org/onap/aai/validation/config/RestConfig.java index 344c203..b192e73 100644 --- a/src/main/java/org/onap/aai/validation/config/RestConfig.java +++ b/src/main/java/org/onap/aai/validation/config/RestConfig.java @@ -19,6 +19,7 @@ package org.onap.aai.validation.config; import java.util.Objects; import org.apache.commons.lang3.builder.EqualsBuilder; +import org.eclipse.jetty.util.security.Password; import org.springframework.beans.factory.annotation.Value; /** @@ -111,7 +112,7 @@ public class RestConfig { * @return the decrypted password */ public String getTrustStorePassword() { - return trustStorePassword; + return Password.deobfuscate(trustStorePassword); } public void setTrustStorePassword(String trustStorePassword) { @@ -132,7 +133,7 @@ public class RestConfig { * @return the decrypted password */ public String getKeyStorePassword() { - return keyStorePassword; + return Password.deobfuscate(keyStorePassword); } public void setKeyStorePassword(String keyStorePassword) { diff --git a/src/main/java/org/onap/aai/validation/config/RuleIndexingConfig.java b/src/main/java/org/onap/aai/validation/config/RuleIndexingConfig.java index 67b0b8a..511df07 100644 --- a/src/main/java/org/onap/aai/validation/config/RuleIndexingConfig.java +++ b/src/main/java/org/onap/aai/validation/config/RuleIndexingConfig.java @@ -20,7 +20,7 @@ package org.onap.aai.validation.config; import java.util.List; /** - * Loads the properties needed by the controller using spring. + * Loads the properties needed by the controller using Spring. */ public class RuleIndexingConfig extends PropertiesConfig { diff --git a/src/main/java/org/onap/aai/validation/config/TopicConfig.java b/src/main/java/org/onap/aai/validation/config/TopicConfig.java index a167672..d769935 100644 --- a/src/main/java/org/onap/aai/validation/config/TopicConfig.java +++ b/src/main/java/org/onap/aai/validation/config/TopicConfig.java @@ -24,11 +24,12 @@ import java.util.Objects; import java.util.Properties; import javax.annotation.Resource; import org.apache.commons.lang3.builder.EqualsBuilder; +import org.eclipse.jetty.util.security.Password; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; /** - * Gets the configuration of the topics. The topics are configured using Spring in topic-config-beans.xml. + * Gets the configuration of the topics using Spring. */ public class TopicConfig { @@ -132,6 +133,7 @@ public class TopicConfig { private String consumerGroup; private String consumerId; private String transportType; + private String protocol; public String getName() { return name; @@ -158,7 +160,7 @@ public class TopicConfig { } public String getPassword() { - return password; + return Password.deobfuscate(password); } public void setPassword(String password) { diff --git a/src/test/java/org/onap/aai/validation/config/TestRestConfig.java b/src/test/java/org/onap/aai/validation/config/TestRestConfig.java index 313c847..0c632ee 100644 --- a/src/test/java/org/onap/aai/validation/config/TestRestConfig.java +++ b/src/test/java/org/onap/aai/validation/config/TestRestConfig.java @@ -24,7 +24,6 @@ import static org.junit.Assert.assertTrue; import javax.inject.Inject; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.aai.validation.config.RestConfig; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -48,9 +47,9 @@ public class TestRestConfig { expectedRestConfig.setProtocol("https"); expectedRestConfig.setBaseModelURI("${baseModelURI}"); expectedRestConfig.setTrustStorePath("/dir1/dir2/trustStorePath"); - expectedRestConfig.setTrustStorePassword("70c87528c88dcd9f9c2558d30e817868"); + expectedRestConfig.setTrustStorePassword("OBF:1i9a1u2a1unz1lr61wn51wn11lss1unz1u301i6o"); expectedRestConfig.setKeyStorePath("/dir1/dir2/keyStorePath"); - expectedRestConfig.setKeyStorePassword("70c87528c88dcd9f9c2558d30e817868"); + expectedRestConfig.setKeyStorePassword("OBF:1i9a1u2a1unz1lr61wn51wn11lss1unz1u301i6o"); expectedRestConfig.setKeyManagerFactoryAlgorithm("AES"); expectedRestConfig.setKeyStoreType("jks"); expectedRestConfig.setSecurityProtocol("TLS"); diff --git a/src/test/java/org/onap/aai/validation/config/TestTopicAdminConfig.java b/src/test/java/org/onap/aai/validation/config/TestTopicAdminConfig.java index f6a6195..8e24f3a 100644 --- a/src/test/java/org/onap/aai/validation/config/TestTopicAdminConfig.java +++ b/src/test/java/org/onap/aai/validation/config/TestTopicAdminConfig.java @@ -24,7 +24,6 @@ import static org.junit.Assert.assertTrue; import javax.inject.Inject; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.aai.validation.config.TopicAdminConfig; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -44,9 +43,9 @@ public class TestTopicAdminConfig { TopicAdminConfig expectedTopicAdminConfig = new TopicAdminConfig(); expectedTopicAdminConfig.setPublishEnable(true); - expectedTopicAdminConfig.setPublishRetries(3l); + expectedTopicAdminConfig.setPublishRetries(3L); expectedTopicAdminConfig.setConsumeEnable(true); - expectedTopicAdminConfig.setConsumePollingIntervalSeconds(3l); + expectedTopicAdminConfig.setConsumePollingIntervalSeconds(3L); assertThat(expectedTopicAdminConfig, is(topicAdminConfig)); assertThat(expectedTopicAdminConfig.hashCode(), is(topicAdminConfig.hashCode())); diff --git a/src/test/java/org/onap/aai/validation/publisher/TestValidationEventPublisher.java b/src/test/java/org/onap/aai/validation/publisher/TestValidationEventPublisher.java index 8950e63..604312e 100644 --- a/src/test/java/org/onap/aai/validation/publisher/TestValidationEventPublisher.java +++ b/src/test/java/org/onap/aai/validation/publisher/TestValidationEventPublisher.java @@ -31,6 +31,7 @@ import org.onap.aai.validation.publisher.ValidationEventPublisher; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.eclipse.jetty.util.security.Password; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -56,12 +57,12 @@ public class TestValidationEventPublisher { TopicAdminConfig mockTopicAdminConfig = Mockito.mock(TopicAdminConfig.class); when(mockTopicAdminConfig.isPublishEnable()).thenReturn(true); - Topic topic1 = new TopicConfig("poa-rule-validation","poa-audit-result").new Topic(); + Topic topic1 = mockTopicConfig.new Topic(); topic1.setName("aai-data-integrity"); topic1.setHost("integrity-dummy-host"); topic1.setPartition("integrity-dummy-partition"); topic1.setUsername("integrity-dummy-username"); - topic1.setPassword("integrity-dummy-password"); + topic1.setPassword(Password.obfuscate("integrity-dummy-password")); topic1.setTransportType("integrity-dummy-transport-type"); topicList.add(topic1); diff --git a/src/test/resources/rest-config/aai-environment.properties b/src/test/resources/rest-config/aai-environment.properties index 988ae90..adfe002 100644 --- a/src/test/resources/rest-config/aai-environment.properties +++ b/src/test/resources/rest-config/aai-environment.properties @@ -19,9 +19,9 @@ host=localhost port=8080 httpProtocol=https trustStorePath=/dir1/dir2/trustStorePath -trustStorePassword.x=70c87528c88dcd9f9c2558d30e817868 +trustStorePassword.x=OBF:1i9a1u2a1unz1lr61wn51wn11lss1unz1u301i6o keyStorePath=/dir1/dir2/keyStorePath -keyStorePassword.x=70c87528c88dcd9f9c2558d30e817868 +keyStorePassword.x=OBF:1i9a1u2a1unz1lr61wn51wn11lss1unz1u301i6o keyManagerFactoryAlgorithm=AES keyStoreType=jks securityProtocol=TLS |