diff options
3 files changed, 28 insertions, 14 deletions
diff --git a/config/application.properties b/config/application.properties index 9ca090f..68ac493 100644 --- a/config/application.properties +++ b/config/application.properties @@ -18,7 +18,7 @@ server.tomcat.max-idle-time=60000 #Application properties
sdcConnect.username=pomba
-sdcConnect.password=pomba
+sdcConnect.password=OBF:1uha1uh81w8v1ugi1ugg
sdcConnect.consumerID=pomba
sdcConnect.sdcAddress=10.69.100.139:30204
@@ -36,7 +36,7 @@ sdc.csar.file.suffix=.zip # HTTP Basic Authorization credentials for Rest Service API
http.userId=admin
-http.password=admin
+http.password=OBF:1u2a1toa1w8v1tok1u30
#Servlet context parameters
server.context_parameters.p-name=value #context parameter with p-name as key and value as value.
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdc/SDCClientConfiguration.java b/src/main/java/org/onap/pomba/contextbuilder/sdc/SDCClientConfiguration.java index 51b5031..28157d1 100644 --- a/src/main/java/org/onap/pomba/contextbuilder/sdc/SDCClientConfiguration.java +++ b/src/main/java/org/onap/pomba/contextbuilder/sdc/SDCClientConfiguration.java @@ -19,6 +19,7 @@ package org.onap.pomba.contextbuilder.sdc; import java.util.Base64;
import lombok.Data;
+import org.eclipse.jetty.util.security.Password;
import org.openecomp.sdc.http.SdcConnectorClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -56,7 +57,7 @@ public class SDCClientConfiguration { @Bean(name="httpBasicAuthorization")
public String getHttpBasicAuth() {
- String auth = new String(this.httpUserId + ":" + this.httpPassword);
+ String auth = new String(this.httpUserId + ":" + Password.deobfuscate(this.httpPassword));
String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes());
return ("Basic " + encodedAuth);
@@ -69,7 +70,7 @@ public class SDCClientConfiguration { SDCContextConfig sdcContextConfig = new SDCContextConfig();
sdcContextConfig.setUser(username);
sdcContextConfig.setAsdcAddress(sdcAddress);
- sdcContextConfig.setPassword(password);
+ sdcContextConfig.setPassword(Password.deobfuscate(password));
sdcContextConfig.setUseHttpsWithDmaap(false);
sdcContextConfig.setConsumerId(consumerID);
sdcContextConfig.setActivateServerTLSAuth(false);
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCClientConfigurationTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCClientConfigurationTest.java index c838a1c..8567b75 100644 --- a/src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCClientConfigurationTest.java +++ b/src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCClientConfigurationTest.java @@ -15,29 +15,42 @@ * limitations under the License.
* ============LICENSE_END=====================================================
*/
-package org.onap.pomba.contextbuilder.sdc.test;
-import org.onap.pomba.contextbuilder.sdc.SDCClientConfiguration;
-import org.junit.Test;
+package org.onap.pomba.contextbuilder.sdc.test;
import static org.junit.Assert.assertEquals;
+import org.eclipse.jetty.util.security.Password;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdc.SDCClientConfiguration;
+import org.openecomp.sdc.api.consumer.IConfiguration;
+import org.openecomp.sdc.http.SdcConnectorClient;
+
public class SDCClientConfigurationTest {
@Test
public void testSDCClientConfig() throws Exception {
SDCClientConfiguration config = new SDCClientConfiguration();
- config.setConsumerID("consumerID");
- config.setPassword("password");
+ config.setUsername("pomba");
config.setSdcAddress("10.147.58.6:30204");
- config.setUsername("username");
+ config.setPassword("OBF:1uha1uh81w8v1ugi1ugg");
+ config.setConsumerID("consumerID");
config.setPollingTimeout("6666");
- assertEquals("username", config.getUsername());
+ assertEquals("pomba", config.getUsername());
+ assertEquals("10.147.58.6:30204", config.getSdcAddress());
assertEquals("consumerID", config.getConsumerID());
- assertEquals("password", config.getPassword());
+ assertEquals("pomba", Password.deobfuscate(config.getPassword()));
assertEquals("6666", config.getPollingTimeout());
- assertEquals("10.147.58.6:30204", config.getSdcAddress());
+
+ SdcConnectorClient sdcClient = config.asdcConnectorClient();
+ IConfiguration sdcClientConfig = sdcClient.getConfiguration();
+ assertEquals("pomba", sdcClientConfig.getUser());
+ assertEquals("10.147.58.6:30204", sdcClientConfig.getAsdcAddress());
+ assertEquals("consumerID", sdcClientConfig.getConsumerID());
+ assertEquals("pomba", sdcClientConfig.getPassword());
+ assertEquals(6666, sdcClientConfig.getPollingTimeout());
+
}
@@ -46,7 +59,7 @@ public class SDCClientConfigurationTest { String msg = "Basic YWRtaW46YWRtaW4=";
SDCClientConfiguration config = new SDCClientConfiguration();
config.setHttpUserId("admin");
- config.setHttpPassword("admin");
+ config.setHttpPassword("OBF:1u2a1toa1w8v1tok1u30");
assertEquals(msg, config.getHttpBasicAuth());
}
}
|