From 2bd47b537ff4fa78ae8f38758900022df6344cdb Mon Sep 17 00:00:00 2001
From: “Kruthi <krutbhat@att.com>
Date: Thu, 4 Jun 2020 19:34:07 +0530
Subject: Resubmitting KeyProperty code change since tests failed

Change-Id: I14c0f9b59229e32de45b1652e64c01dd6c1d39e3
Issue-ID: PORTAL-914
Signed-off-by: krutbhat@att.com
---
 .../portalapp/portal/interceptor/PortalResourceInterceptor.java     | 6 ++++--
 .../portalapp/portal/service/ApplicationsRestClientServiceImpl.java | 6 ++++--
 .../onap/portalapp/portal/service/BasicAuthAccountServiceImpl.java  | 6 ++++--
 .../org/onap/portalapp/portal/service/EPAppCommonServiceImpl.java   | 6 ++++--
 .../onap/portalapp/portal/service/MicroserviceProxyServiceImpl.java | 4 +++-
 .../org/onap/portalapp/portal/service/MicroserviceServiceImpl.java  | 6 ++++--
 .../main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java | 4 +++-
 .../org/onap/portalapp/service/sessionmgt/SessionCommunication.java | 4 +++-
 8 files changed, 29 insertions(+), 13 deletions(-)

(limited to 'ecomp-portal-BE-common/src/main/java')

diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/interceptor/PortalResourceInterceptor.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/interceptor/PortalResourceInterceptor.java
index 5a57e094..e96485d8 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/interceptor/PortalResourceInterceptor.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/interceptor/PortalResourceInterceptor.java
@@ -72,6 +72,8 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.listener.PortalTimeoutHandler;
 import org.onap.portalsdk.core.onboarding.util.AuthUtil;
 import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.onboarding.util.KeyConstants;
+import org.onap.portalsdk.core.onboarding.util.KeyProperties;
 import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
 import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
 import org.onap.portalsdk.core.util.SystemProperties;
@@ -370,7 +372,7 @@ public class PortalResourceInterceptor extends ResourceInterceptor {
 		String result = "";
 		if (encrypted != null && encrypted.length() > 0) {
 			try {
-				result = CipherUtil.decryptPKC(encrypted, SystemProperties.getProperty(SystemProperties.Decryption_Key));
+				result = CipherUtil.decryptPKC(encrypted, KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY));
 			} catch (Exception e) {
 				logger.error(EELFLoggerDelegate.errorLogger, "decryptedPassword failed", e);
 				throw e;
@@ -384,7 +386,7 @@ public class PortalResourceInterceptor extends ResourceInterceptor {
 		if (decryptedPwd != null && decryptedPwd.length() > 0) {
 			try {
 				result = CipherUtil.encryptPKC(decryptedPwd,
-						SystemProperties.getProperty(SystemProperties.Decryption_Key));
+						KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY));
 			} catch (Exception e) {
 				logger.error(EELFLoggerDelegate.errorLogger, "encryptedPassword() failed", e);
 				throw e;
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ApplicationsRestClientServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ApplicationsRestClientServiceImpl.java
index 959e392f..ab504fba 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ApplicationsRestClientServiceImpl.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ApplicationsRestClientServiceImpl.java
@@ -67,6 +67,8 @@ import org.onap.portalapp.util.SystemType;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.exception.CipherUtilException;
 import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.onboarding.util.KeyConstants;
+import org.onap.portalsdk.core.onboarding.util.KeyProperties;
 import org.onap.portalsdk.core.util.SystemProperties;
 import org.slf4j.MDC;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -194,7 +196,7 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient
 			if(!encriptedPwd.isEmpty() || encriptedPwd != null || StringUtils.isEmpty(encriptedPwd)){
 			try {
 				decreptedAppPwd = CipherUtil.decryptPKC(encriptedPwd,
-						SystemProperties.getProperty(SystemProperties.Decryption_Key));
+						KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY));
 			} catch (Exception e) {
 				logger.error(EELFLoggerDelegate.errorLogger, "createClientFor failed to decrypt", e);
 			}
@@ -215,7 +217,7 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient
 				String decreptedexternalAppPwd = StringUtils.EMPTY;
 				try {
 					decreptedexternalAppPwd = CipherUtil.decryptPKC(password,
-							SystemProperties.getProperty(SystemProperties.Decryption_Key));
+							KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY));
 				} catch (CipherUtilException e) {
 					logger.error(EELFLoggerDelegate.errorLogger, "failed to decreptedexternalAppPwd when external app pwd is null", e);
 				}
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthAccountServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthAccountServiceImpl.java
index 98b0f127..151430d3 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthAccountServiceImpl.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthAccountServiceImpl.java
@@ -52,6 +52,8 @@ import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
 import org.onap.portalapp.validation.DataValidator;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.onboarding.util.KeyConstants;
+import org.onap.portalsdk.core.onboarding.util.KeyProperties;
 import org.onap.portalsdk.core.service.DataAccessService;
 import org.onap.portalsdk.core.util.SystemProperties;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -229,7 +231,7 @@ public class BasicAuthAccountServiceImpl implements BasicAuthAccountService{
 		if (encryptedPwd != null && encryptedPwd.length() > 0) {
 			try {
 				result = CipherUtil.decryptPKC(encryptedPwd,
-						SystemProperties.getProperty(SystemProperties.Decryption_Key));
+						KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY));
 			} catch (Exception e) {
 				logger.error(EELFLoggerDelegate.errorLogger, "decryptedPassword() failed", e);
 				throw e;
@@ -243,7 +245,7 @@ public class BasicAuthAccountServiceImpl implements BasicAuthAccountService{
 		if (decryptedPwd != null && decryptedPwd.length() > 0) {
 			try {
 				result = CipherUtil.encryptPKC(decryptedPwd,
-						SystemProperties.getProperty(SystemProperties.Decryption_Key));
+						KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY));
 			} catch (Exception e) {
 				logger.error(EELFLoggerDelegate.errorLogger, "encryptedPassword() failed", e);
 				throw e;
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppCommonServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppCommonServiceImpl.java
index 539ada26..0e8bdeee 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppCommonServiceImpl.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppCommonServiceImpl.java
@@ -94,6 +94,8 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.ueb.Helper;
 import org.onap.portalsdk.core.onboarding.ueb.TopicManager;
 import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.onboarding.util.KeyConstants;
+import org.onap.portalsdk.core.onboarding.util.KeyProperties;
 import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
 import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
 import org.onap.portalsdk.core.service.DataAccessService;
@@ -1630,7 +1632,7 @@ public class EPAppCommonServiceImpl implements EPAppService {
 		if (encryptedAppPwd != null && !encryptedAppPwd.isEmpty()) {
 			try {
 				result = CipherUtil.decryptPKC(encryptedAppPwd,
-						SystemProperties.getProperty(SystemProperties.Decryption_Key));
+						KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY));
 			} catch (Exception e) {
 				logger.error(EELFLoggerDelegate.errorLogger, "decryptedPassword failed for app " + app.getName(), e);
 			}
@@ -1643,7 +1645,7 @@ public class EPAppCommonServiceImpl implements EPAppService {
 		if (decryptedAppPwd != null && !decryptedAppPwd.isEmpty()) {
 			try {
 				result = CipherUtil.encryptPKC(decryptedAppPwd,
-						SystemProperties.getProperty(SystemProperties.Decryption_Key));
+						KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY));
 			} catch (Exception e) {
 				logger.error(EELFLoggerDelegate.errorLogger, "encryptedPassword failed for app " + app.getName(), e);
 			}
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceProxyServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceProxyServiceImpl.java
index 31cb8a45..df8b59d8 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceProxyServiceImpl.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceProxyServiceImpl.java
@@ -50,6 +50,8 @@ import org.onap.portalapp.portal.logging.aop.EPMetricsLog;
 import org.onap.portalapp.portal.utils.EcompPortalUtils;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.onboarding.util.KeyConstants;
+import org.onap.portalsdk.core.onboarding.util.KeyProperties;
 import org.onap.portalsdk.core.util.SystemProperties;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
@@ -177,7 +179,7 @@ public class MicroserviceProxyServiceImpl implements MicroserviceProxyService {
 		if (encryptedPwd != null && encryptedPwd.length() > 0) {
 			try {
 				result = CipherUtil.decryptPKC(encryptedPwd,
-						SystemProperties.getProperty(SystemProperties.Decryption_Key));
+						KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY));
 			} catch (Exception e) {
 				logger.error(EELFLoggerDelegate.errorLogger, "decryptedPassword failed", e);
 				throw e;
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceServiceImpl.java
index 451500d6..9d9fde3a 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceServiceImpl.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/MicroserviceServiceImpl.java
@@ -52,6 +52,8 @@ import org.onap.portalapp.portal.logging.aop.EPMetricsLog;
 import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.onboarding.util.KeyConstants;
+import org.onap.portalsdk.core.onboarding.util.KeyProperties;
 import org.onap.portalsdk.core.service.DataAccessService;
 import org.onap.portalsdk.core.util.SystemProperties;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -197,7 +199,7 @@ public class MicroserviceServiceImpl implements MicroserviceService {
 		if (encryptedPwd != null && !encryptedPwd.isEmpty()) {
 			try {
 				result = CipherUtil.decryptPKC(encryptedPwd,
-						SystemProperties.getProperty(SystemProperties.Decryption_Key));
+						KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY));
 			} catch (Exception e) {
 				logger.error(EELFLoggerDelegate.errorLogger, "decryptedPassword failed", e);
 				throw e;
@@ -211,7 +213,7 @@ public class MicroserviceServiceImpl implements MicroserviceService {
 		if (decryptedPwd != null && !decryptedPwd.isEmpty()) {
 			try {
 				result = CipherUtil.encryptPKC(decryptedPwd,
-						SystemProperties.getProperty(SystemProperties.Decryption_Key));
+						KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY));
 			} catch (Exception e) {
 				logger.error(EELFLoggerDelegate.errorLogger, "encryptedPassword failed", e);
 				throw e;
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java
index e5543a36..3fc8c393 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/utils/EcompPortalUtils.java
@@ -61,6 +61,8 @@ import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum;
 import org.onap.portalapp.portal.logging.logic.EPLogUtil;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.onboarding.util.KeyConstants;
+import org.onap.portalsdk.core.onboarding.util.KeyProperties;
 import org.onap.portalsdk.core.util.SystemProperties;
 import org.slf4j.MDC;
 import org.springframework.http.HttpHeaders;
@@ -435,7 +437,7 @@ public class EcompPortalUtils {
 		if (encrypted != null && encrypted.length() > 0) {
 			try {
 				result = CipherUtil.decryptPKC(encrypted,
-						SystemProperties.getProperty(SystemProperties.Decryption_Key));
+						KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY));
 			} catch (Exception e) {
 				logger.error(EELFLoggerDelegate.errorLogger, "decryptedPassword failed", e);
 				throw e;
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/SessionCommunication.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/SessionCommunication.java
index 441e99a7..f65199c7 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/SessionCommunication.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/SessionCommunication.java
@@ -61,6 +61,8 @@ import org.onap.portalsdk.core.exception.UrlAccessRestrictedException;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.exception.CipherUtilException;
 import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.onboarding.util.KeyConstants;
+import org.onap.portalsdk.core.onboarding.util.KeyProperties;
 import org.onap.portalsdk.core.util.SystemProperties;
 import org.slf4j.MDC;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -344,7 +346,7 @@ public class SessionCommunication {
 			String decreptedexternalAppPwd = StringUtils.EMPTY;
 			try {
 				decreptedexternalAppPwd = CipherUtil.decryptPKC(password,
-						SystemProperties.getProperty(SystemProperties.Decryption_Key));
+						KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY));
 			} catch (CipherUtilException e) {
 				logger.error(EELFLoggerDelegate.errorLogger, "failed to decreptedexternalAppPwd when external app pwd is null", e);
 			}
-- 
cgit