summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrenealr <reneal.rogers@amdocs.com>2018-02-21 10:21:45 -0500
committerrenealr <reneal.rogers@amdocs.com>2018-02-21 11:50:07 -0500
commit4c8c916b9dfcac969d4966ea85cf08f0d4ff7726 (patch)
treed952f6780aa354909b45c914f6a3e108ad140f9e
parente6f45969b521b66e1d72822157f0d8252e751bde (diff)
remove printing a stacktrace
Issue-ID: AAI-788 Change-Id: I5d52bea1bef671abc2eeace4027535d0d5313940 Signed-off-by: renealr <reneal.rogers@amdocs.com>
-rw-r--r--src/main/java/org/onap/aai/sparky/security/BaseCookieDecryptor.java10
-rw-r--r--src/main/java/org/onap/aai/sparky/security/CookieDecryptor.java2
-rw-r--r--src/main/java/org/onap/aai/sparky/security/EcompSso.java11
-rw-r--r--src/main/java/org/onap/aai/sparky/security/portal/config/PortalAuthenticationConfig.java8
4 files changed, 18 insertions, 13 deletions
diff --git a/src/main/java/org/onap/aai/sparky/security/BaseCookieDecryptor.java b/src/main/java/org/onap/aai/sparky/security/BaseCookieDecryptor.java
index bf915d7..6adccea 100644
--- a/src/main/java/org/onap/aai/sparky/security/BaseCookieDecryptor.java
+++ b/src/main/java/org/onap/aai/sparky/security/BaseCookieDecryptor.java
@@ -28,19 +28,19 @@ import org.onap.aai.sparky.logging.AaiUiMsgs;
import org.openecomp.portalsdk.core.onboarding.util.CipherUtil;
public class BaseCookieDecryptor implements CookieDecryptor {
-
+
private static final Logger LOG = LoggerFactory.getInstance().getLogger(BaseCookieDecryptor.class);
-
+
public BaseCookieDecryptor(){}
-
+
public String decryptCookie(String encryptedCookie){
-
+
String decryptedCookie = "";
try {
decryptedCookie = CipherUtil.decrypt(encryptedCookie, "");
} catch (Exception e) {
- LOG.info(AaiUiMsgs.LOGIN_FILTER_INFO, "decrypting base cookie failed " + e.getLocalizedMessage());
+ LOG.error(AaiUiMsgs.LOGIN_FILTER_INFO, "decrypting base cookie failed " + e.getLocalizedMessage());
}
return decryptedCookie;
diff --git a/src/main/java/org/onap/aai/sparky/security/CookieDecryptor.java b/src/main/java/org/onap/aai/sparky/security/CookieDecryptor.java
index 36e4d12..d5171e1 100644
--- a/src/main/java/org/onap/aai/sparky/security/CookieDecryptor.java
+++ b/src/main/java/org/onap/aai/sparky/security/CookieDecryptor.java
@@ -23,7 +23,7 @@
package org.onap.aai.sparky.security;
public interface CookieDecryptor {
-
+
String decryptCookie(String encryptedCookie);
}
diff --git a/src/main/java/org/onap/aai/sparky/security/EcompSso.java b/src/main/java/org/onap/aai/sparky/security/EcompSso.java
index 8051d1d..2b313eb 100644
--- a/src/main/java/org/onap/aai/sparky/security/EcompSso.java
+++ b/src/main/java/org/onap/aai/sparky/security/EcompSso.java
@@ -139,14 +139,15 @@ public class EcompSso {
}
final String cspCookieEncrypted = csp.getValue();
- String cspCookieDecrypted = null;
+ String cspCookieDecrypted = null;
try {
cspCookieDecrypted = PortalAuthenticationConfig.getInstance().getCookieDecryptor().decryptCookie(cspCookieEncrypted);
+ return cspCookieDecrypted.split("\\|");
+
} catch (ClassNotFoundException e) {
- e.printStackTrace();
+ LOG.error(AaiUiMsgs.DECRYPTION_ERROR,"Unable to find the Cookie Decryptor Class");
}
-
- String[] cspData = cspCookieDecrypted.split("\\|");
- return cspData;
+
+ return null;
}
} \ No newline at end of file
diff --git a/src/main/java/org/onap/aai/sparky/security/portal/config/PortalAuthenticationConfig.java b/src/main/java/org/onap/aai/sparky/security/portal/config/PortalAuthenticationConfig.java
index f34b419..df909c3 100644
--- a/src/main/java/org/onap/aai/sparky/security/portal/config/PortalAuthenticationConfig.java
+++ b/src/main/java/org/onap/aai/sparky/security/portal/config/PortalAuthenticationConfig.java
@@ -25,6 +25,9 @@ package org.onap.aai.sparky.security.portal.config;
import java.util.Properties;
+import org.onap.aai.cl.api.Logger;
+import org.onap.aai.cl.eelf.LoggerFactory;
+import org.onap.aai.sparky.logging.AaiUiMsgs;
import org.onap.aai.sparky.security.CookieDecryptor;
import org.onap.aai.sparky.util.ConfigHelper;
import org.onap.aai.sparky.util.Encryptor;
@@ -47,6 +50,7 @@ public class PortalAuthenticationConfig {
public static final String PROP_IS_ONAP_ENABLED = "onap_enabled"; // NOSONAR
private static final String AUTHENTICATION_CONFIG_FILE = SparkyConstants.PORTAL_AUTHENTICATION_FILE_LOCATION;
public static final String PROP_COOKIEDECRYPTORCLASSNAME = "cookie_decryptor_classname";
+ private static final Logger LOG = LoggerFactory.getInstance().getLogger(PortalAuthenticationConfig.class);
private PortalAuthenticationConfig() {
// Prevent instantiation
@@ -78,7 +82,7 @@ public class PortalAuthenticationConfig {
Encryptor encryptor = new Encryptor();
return encryptor.decryptValue(password);
}
-
+
public boolean getIsOnapEnabled() {
return isOnapEnabled;
}
@@ -110,7 +114,7 @@ public class PortalAuthenticationConfig {
try {
cookieDecryptor = (CookieDecryptor) cookieDecrypterClass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
- e.printStackTrace();
+ LOG.error(AaiUiMsgs.DECRYPTION_ERROR,"Unable to instantiate Cookie Decryptor Class");
}
return cookieDecryptor;
}