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;
package org.onap.aai.sparky.security;
public interface CookieDecryptor {
-
+
String decryptCookie(String encryptedCookie);
}
}
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
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;
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
Encryptor encryptor = new Encryptor();
return encryptor.decryptValue(password);
}
-
+
public boolean getIsOnapEnabled() {
return isOnapEnabled;
}
try {
cookieDecryptor = (CookieDecryptor) cookieDecrypterClass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
- e.printStackTrace();
+ LOG.error(AaiUiMsgs.DECRYPTION_ERROR,"Unable to instantiate Cookie Decryptor Class");
}
return cookieDecryptor;
}