summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohammadreza Pasandideh <mohammadreza.pasandideh@amdocs.com>2018-09-13 15:18:57 -0400
committerPrudence Au <prudence.au@amdocs.com>2018-09-14 13:34:53 -0400
commitb78e5c4271023b4879f5fa056266b987289fed2d (patch)
tree5dead5c7f7995195af1f49a88be6c28361b78d71
parent37901c75f865ce54a1a25686cd0287db22958e7e (diff)
Added support for obfuscated password
Issue-ID: LOG-439 Change-Id: Ib313b0a18b1da646b484a8beb3f4074b4e58044a Signed-off-by: Mohammadreza Pasandideh <mohammadreza.pasandideh@amdocs.com>
-rw-r--r--config/application.properties4
-rw-r--r--config/builders/networkdiscovery.properties9
-rw-r--r--src/main/java/org/onap/pomba/contextaggregator/rest/RestRequest.java14
3 files changed, 17 insertions, 10 deletions
diff --git a/config/application.properties b/config/application.properties
index a74d9d8..8418dce 100644
--- a/config/application.properties
+++ b/config/application.properties
@@ -3,8 +3,8 @@ server.port=9529
builders.properties.path=config/builders/
# Transport Configuration
-transport.consume.host=10.147.112.149
-transport.consume.port=30227
+transport.consume.host=<replace_with_host_or_ip>
+transport.consume.port=<replace>
transport.consume.topic=POA-AUDIT-INIT1
transport.consume.motsid=motsid@motsid.com
transport.consume.pass=1234
diff --git a/config/builders/networkdiscovery.properties b/config/builders/networkdiscovery.properties
new file mode 100644
index 0000000..0110d4c
--- /dev/null
+++ b/config/builders/networkdiscovery.properties
@@ -0,0 +1,9 @@
+server.host=
+server.port=
+server.protocol=http
+security.protocol=TLS
+connection.timeout.ms=25000
+read.timeout.ms=25000
+base.uri=/ndcontextbuilder/service/context
+basicauth.username=admin
+basicauth.password=OBF:1u2a1toa1w8v1tok1u30 \ No newline at end of file
diff --git a/src/main/java/org/onap/pomba/contextaggregator/rest/RestRequest.java b/src/main/java/org/onap/pomba/contextaggregator/rest/RestRequest.java
index 0b2d3cb..3881642 100644
--- a/src/main/java/org/onap/pomba/contextaggregator/rest/RestRequest.java
+++ b/src/main/java/org/onap/pomba/contextaggregator/rest/RestRequest.java
@@ -23,6 +23,7 @@ import java.util.Map;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
+import org.eclipse.jetty.util.security.Password;
import org.onap.aai.restclient.client.Headers;
import org.onap.aai.restclient.client.OperationResult;
import org.onap.aai.restclient.client.RestClient;
@@ -42,6 +43,8 @@ public class RestRequest {
private static final String APP_NAME = "context-aggregator";
+ private static final String BASIC_AUTH = "Basic ";
+
private static Logger log = LoggerFactory.getLogger(RestRequest.class);
@@ -88,11 +91,6 @@ public class RestRequest {
private static RestClient createRestClient(ContextBuilder builder) {
return new RestClient()
- // .validateServerHostname(false)
- // .validateServerCertChain(true)
- // .clientCertFile(builder.getKeyStorePath())
- // .clientCertPassword(builder.getKeyStorePassword())
- // .trustStore(builder.getTrustStorePath())
.connectTimeoutMs(builder.getConnectionTimeout()).readTimeoutMs(builder.getReadTimeout());
}
@@ -114,9 +112,9 @@ public class RestRequest {
}
private static String getBasicAuthString(ContextBuilder builder) {
- String usernamePasswordString = builder.getUsername() + ":" + builder.getPassword();
- String encodedString = Base64.getEncoder().encodeToString((usernamePasswordString).getBytes());
- return "Basic " + encodedString;
+ String encodedString = Base64.getEncoder().encodeToString(( builder.getUsername() + ":" +
+ Password.deobfuscate(builder.getPassword())).getBytes());
+ return BASIC_AUTH + encodedString;
}
}