X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ecomp-portal-BE-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fportalapp%2Fservice%2Fsessionmgt%2FSessionCommunication.java;h=f65199c7be2e8ad0634c3884518b1bf71e8c02dc;hb=2bd47b537ff4fa78ae8f38758900022df6344cdb;hp=14616b31e8d09888bd4e6f9a96f0f2aae9ac11da;hpb=fc39621b78e3ca55293c8bce6ef8d37a2fd2bea8;p=portal.git 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 14616b31..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; @@ -85,12 +87,12 @@ public class SessionCommunication { String appResponse = ""; String appName = ""; int responseCode = 0; - if (app != null && app.name != null && app.name != "") { + if (app != null && app.getAppName() != null && app.getAppName() != "") { try { - appName = app.name; - String url = app.restUrl + "/sessionTimeOuts"; - String encriptedPwdDB = app.appPassword; - String appUserName = app.username; + appName = app.getAppName(); + String url = app.getRestUrl() + "/sessionTimeOuts"; + String encriptedPwdDB = app.getAppBasicAuthPassword(); + String appUserName = app.getAppBasicAuthUsername(); setLocalMDCContext(app, "/sessionTimeOuts", url); @@ -157,12 +159,12 @@ public class SessionCommunication { try { if (app == null) throw new Exception("SessionCommunication.pingSession: app is null"); - if (app != null && app.name != null && app.name != "") { - appName = app.name; + if (app != null && app.getAppName() != null && app.getAppName() != "") { + appName = app.getAppName(); } - String url = app.restUrl + "/updateSessionTimeOuts"; - String encriptedPwdDB = app.appPassword; - String appUserName = app.username; + String url = app.getRestUrl() + "/updateSessionTimeOuts"; + String encriptedPwdDB = app.getAppBasicAuthPassword(); + String appUserName = app.getAppBasicAuthUsername(); setLocalMDCContext(app, "/updateSessionTimeOuts", url); @@ -218,13 +220,13 @@ public class SessionCommunication { public Boolean timeoutSession(OnboardingApp app, String portalJSessionId) throws Exception { String appName = "Unknwon"; int responseCode = 0; - if (app != null && app.name != null && app.name != "") { + if (app != null && app.getAppName() != null && app.getAppName() != "") { try { - appName = app.name; - String url = app.restUrl + "/timeoutSession" + "?portalJSessionId=" + portalJSessionId; + appName = app.getAppName(); + String url = app.getRestUrl() + "/timeoutSession" + "?portalJSessionId=" + portalJSessionId; - String encriptedPwdDB = app.appPassword; - String appUserName = app.username; + String encriptedPwdDB = app.getAppBasicAuthPassword(); + String appUserName = app.getAppBasicAuthUsername(); // String decreptedPwd = CipherUtil.decrypt(encriptedPwdDB, // SystemProperties.getProperty(SystemProperties.Decryption_Key)); @@ -287,7 +289,7 @@ public class SessionCommunication { MDC.put(EPCommonSystemProperties.PROTOCOL, EPCommonSystemProperties.HTTPS); } MDC.put(EPCommonSystemProperties.FULL_URL, url); - MDC.put(EPCommonSystemProperties.TARGET_ENTITY, app.myLoginsAppName); + MDC.put(EPCommonSystemProperties.TARGET_ENTITY, app.getMyLoginsAppName()); MDC.put(EPCommonSystemProperties.TARGET_SERVICE_NAME, restPath); } @@ -332,19 +334,19 @@ public class SessionCommunication { Map headersMap = new HashMap<>(); EPApp externalApp = null; - if(app.appPassword.isEmpty() || app.appPassword==null){ + if(app.getAppBasicAuthPassword().isEmpty() || app.getAppBasicAuthPassword()==null){ logger.debug(EELFLoggerDelegate.debugLogger, "Entering in the externalApp get app password contains null : {}"); externalApp = appsCacheService.getApp(1L); logger.debug(EELFLoggerDelegate.debugLogger, "external App Information : {}",externalApp); - String mechidUsername=externalApp.getUsername(); + String mechidUsername=externalApp.getAppBasicAuthUsername(); logger.debug(EELFLoggerDelegate.debugLogger, "external App mechidUsername Information : {}",mechidUsername); - String password=externalApp.getAppPassword(); + String password=externalApp.getAppBasicAuthPassword(); 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); } @@ -353,8 +355,8 @@ public class SessionCommunication { encriptedPwdDB = decreptedexternalAppPwd; }else{ - appUserName = app.username; - encriptedPwdDB = app.appPassword; + appUserName = app.getAppBasicAuthUsername(); + encriptedPwdDB = app.getAppBasicAuthPassword(); } headersMap.put("username", appUserName);