remove printing a stacktrace 13/32413/2
authorrenealr <reneal.rogers@amdocs.com>
Wed, 21 Feb 2018 15:21:45 +0000 (10:21 -0500)
committerrenealr <reneal.rogers@amdocs.com>
Wed, 21 Feb 2018 16:50:07 +0000 (11:50 -0500)
Issue-ID: AAI-788
Change-Id: I5d52bea1bef671abc2eeace4027535d0d5313940
Signed-off-by: renealr <reneal.rogers@amdocs.com>
src/main/java/org/onap/aai/sparky/security/BaseCookieDecryptor.java
src/main/java/org/onap/aai/sparky/security/CookieDecryptor.java
src/main/java/org/onap/aai/sparky/security/EcompSso.java
src/main/java/org/onap/aai/sparky/security/portal/config/PortalAuthenticationConfig.java

index bf915d7..6adccea 100644 (file)
@@ -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; 
 
index 36e4d12..d5171e1 100644 (file)
@@ -23,7 +23,7 @@
 package org.onap.aai.sparky.security;
 
 public interface CookieDecryptor {
-       
+
        String decryptCookie(String encryptedCookie);
 
 }
index 8051d1d..2b313eb 100644 (file)
@@ -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
index f34b419..df909c3 100644 (file)
@@ -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;
   }