summaryrefslogtreecommitdiffstats
path: root/appc-sdc-listener
diff options
context:
space:
mode:
authorBalaji, Ramya (rb111y) <rb111y@att.com>2019-02-04 07:57:11 -0500
committerPatrick Brady <patrick.brady@att.com>2019-02-05 17:26:12 +0000
commit6b1cd6d21d3c7477851604cfbeea37ff7d71022c (patch)
tree7542ed03b1730e33ec9dda38b597369174ac46ba /appc-sdc-listener
parent957d0a86172d5568c45c6c2aa595a9b2cc8de7ee (diff)
Sdc Listener Platform hardening changes
Issue-ID: APPC-1382 Change-Id: Ib4928843a8f169d856aaa1afa49fcfa127ba4990 Signed-off-by: Balaji, Ramya (rb111y) <rb111y@att.com>
Diffstat (limited to 'appc-sdc-listener')
-rw-r--r--appc-sdc-listener/appc-sdc-listener-bundle/src/main/java/org/onap/appc/sdc/listener/ProviderOperations.java21
-rw-r--r--appc-sdc-listener/appc-sdc-listener-bundle/src/main/java/org/onap/appc/sdc/listener/SdcListener.java15
-rw-r--r--appc-sdc-listener/appc-yang-generator/dependency-reduced-pom.xml2
3 files changed, 29 insertions, 9 deletions
diff --git a/appc-sdc-listener/appc-sdc-listener-bundle/src/main/java/org/onap/appc/sdc/listener/ProviderOperations.java b/appc-sdc-listener/appc-sdc-listener-bundle/src/main/java/org/onap/appc/sdc/listener/ProviderOperations.java
index f8fd1467d..42006018e 100644
--- a/appc-sdc-listener/appc-sdc-listener-bundle/src/main/java/org/onap/appc/sdc/listener/ProviderOperations.java
+++ b/appc-sdc-listener/appc-sdc-listener-bundle/src/main/java/org/onap/appc/sdc/listener/ProviderOperations.java
@@ -2,22 +2,22 @@
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* ============LICENSE_END=========================================================
*/
@@ -69,6 +69,7 @@ public class ProviderOperations {
private static final EELFLogger LOG = EELFManager.getInstance().getLogger(ProviderOperations.class);
private static String basic_auth;
+ private static URL defaultUrl;
public static ProviderResponse post(URL url, String json, Map<String, String> adtl_headers) throws APPCException {
if (json == null) {
@@ -133,6 +134,18 @@ public class ProviderOperations {
return basic_auth;
}
+ /**
+ * Sets the default Provider URL to the provided URL. If the entry is null then sets to null.
+ *
+ * @param URL The URL
+ */
+ public static void setDefaultUrl(URL URL) {
+ if (URL != null) {
+ defaultUrl = URL;
+ } else {
+ defaultUrl = null;
+ }
+ }
@SuppressWarnings("deprecation")
private static HttpClient getHttpClient(URL url) throws APPCException {
HttpClient client;
diff --git a/appc-sdc-listener/appc-sdc-listener-bundle/src/main/java/org/onap/appc/sdc/listener/SdcListener.java b/appc-sdc-listener/appc-sdc-listener-bundle/src/main/java/org/onap/appc/sdc/listener/SdcListener.java
index d786247c6..c67535e11 100644
--- a/appc-sdc-listener/appc-sdc-listener-bundle/src/main/java/org/onap/appc/sdc/listener/SdcListener.java
+++ b/appc-sdc-listener/appc-sdc-listener-bundle/src/main/java/org/onap/appc/sdc/listener/SdcListener.java
@@ -2,16 +2,16 @@
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -55,6 +55,8 @@ public class SdcListener {
private CountDownLatch latch;
private Thread startThread = null;
+ private String ukey;
+ private String uval;
@SuppressWarnings("unused")
public void start() throws Exception {
@@ -65,7 +67,10 @@ public class SdcListener {
Configuration configuration = ConfigurationFactory.getConfiguration();
Properties props = configuration.getProperties();
config = new SdcConfig(props);
- logger.debug(String.format("[%d] created SDC config", timeStamp));
+ ukey = props.getProperty("appc.sdc.provider.user");
+ uval = props.getProperty("appc.sdc.provider.pass");
+ logger.debug(String.format("[%d] created SDC config provider URL [%s]", timeStamp, config.getStoreOpURI().toString()));
+
client = DistributionClientFactory.createDistributionClient();
logger.debug(String.format("[%d] created SDC client", timeStamp));
@@ -196,6 +201,8 @@ public class SdcListener {
config.getUser(), url, saltedPass[1]));
ProviderOperations providerOperations = new ProviderOperations();
+ ProviderOperations.setDefaultUrl(config.getStoreOpURI().toURL());
+ ProviderOperations.setAuthentication(ukey, uval);
ProviderResponse result = providerOperations.post(url, json, headers);
return result.getStatus() == 200;
} catch (Exception e) {
diff --git a/appc-sdc-listener/appc-yang-generator/dependency-reduced-pom.xml b/appc-sdc-listener/appc-yang-generator/dependency-reduced-pom.xml
index 2c61cdb53..fd09e088a 100644
--- a/appc-sdc-listener/appc-yang-generator/dependency-reduced-pom.xml
+++ b/appc-sdc-listener/appc-yang-generator/dependency-reduced-pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>binding-parent</artifactId>
<groupId>org.onap.appc.parent</groupId>
- <version>1.5.1-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<relativePath>pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>