X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ecomp-portal-BE-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fportalapp%2Fportal%2Fservice%2FApplicationsRestClientServiceImpl.java;h=73003659c6dcd47d5f5b21e60ebb0b1d5667efd6;hb=54c5ed82662ef681375675e58abc8058e3203466;hp=09d78046185f24cd320dd6531cfdf3087e17c73b;hpb=dd403753bf22b4292e3ee513dc3391b6dbb5a8d2;p=portal.git 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 09d78046..73003659 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; @@ -176,8 +178,8 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient if (externalApp != null) { String appBaseUri = (type == SystemType.APPLICATION) ? externalApp.getAppRestEndpoint() : ""; - String username = (type == SystemType.APPLICATION) ? externalApp.getUsername(): ""; - String encriptedPwd = (type == SystemType.APPLICATION) ? externalApp.getAppPassword(): ""; + String username = (type == SystemType.APPLICATION) ? externalApp.getAppBasicAuthUsername(): ""; + String encriptedPwd = (type == SystemType.APPLICATION) ? externalApp.getAppBasicAuthPassword(): ""; String appName = (type == SystemType.APPLICATION) ? externalApp.getName(): ""; String decreptedAppPwd = StringUtils.EMPTY; @@ -194,28 +196,28 @@ 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); + logger.error(EELFLoggerDelegate.errorLogger, "createClientFor failed to decrypt", e.getMessage()); } } WebClient client = createClientForPath(appBaseUri, restPath); - if(externalApp.getAppPassword().isEmpty() || externalApp.getAppPassword()==null){ + if(externalApp.getAppBasicAuthPassword().isEmpty() || externalApp.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); } @@ -337,7 +339,7 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient MDC.put(EPCommonSystemProperties.EXTERNAL_API_RESPONSE_CODE, Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeRestApiGeneralError, e); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while making the GET REST API call", e); + logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while making the GET REST API call", e.getMessage()); } return response; } @@ -364,7 +366,7 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient MDC.put(EPCommonSystemProperties.EXTERNAL_API_RESPONSE_CODE, Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeRestApiGeneralError, e); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while making the POST REST API call", e); + logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while making the POST REST API call", e.getMessage()); } if (response != null) { @@ -417,7 +419,7 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient MDC.put(EPCommonSystemProperties.EXTERNAL_API_RESPONSE_CODE, Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeRestApiGeneralError, e); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while making the PUT REST API call", e); + logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while making the PUT REST API call", e.getMessage()); } if (response != null) {