diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-common/src/main')
3 files changed, 20 insertions, 32 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ReportDashboardController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ReportDashboardController.java index 2ac5d8a4..50e6d096 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ReportDashboardController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ReportDashboardController.java @@ -55,10 +55,10 @@ import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping("/") -public class ReportDashboardController extends RestrictedBaseController { +public class ReportDashboardController extends RestrictedBaseController { @RequestMapping(value = {"/report_dashboard" }, method = RequestMethod.GET) public ModelAndView adminView(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); return new ModelAndView(getViewName(),"model", model); } }
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/scheduler/LogRegistry.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/scheduler/LogRegistry.java index 5c80b916..93c814d0 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/scheduler/LogRegistry.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/scheduler/LogRegistry.java @@ -52,24 +52,19 @@ import org.springframework.stereotype.Component; @DependsOn({ "systemProperties" }) public class LogRegistry extends CronRegistry { - private static final String groupName = "AppGroup"; - private static final String jobName = "LogJob"; - private static final String triggerName = "LogTrigger"; + private static final String GROUP_NAME = "AppGroup"; + private static final String JOB_NAME = "LogJob"; + private static final String TRIGGER_NAME = "LogTrigger"; - // @Autowired - // private SystemProperties systemProperties; - - // @Bean public JobDetailFactoryBean jobDetailFactoryBean() { - Map<String, Object> map = new HashMap<String, Object>(); + Map<String, Object> map = new HashMap<>(); map.put("units", "bytes"); - return jobDetailFactoryBean(groupName, jobName, LogJob.class, map); + return jobDetailFactoryBean(GROUP_NAME, JOB_NAME, LogJob.class, map); } - // @Bean public CronTriggerFactoryBean cronTriggerFactoryBean() throws ParseException { // "0 * * * * ? * - return cronTriggerFactoryBean(groupName, triggerName, SystemProperties.getProperty(SystemProperties.LOG_CRON)); + return cronTriggerFactoryBean(GROUP_NAME, TRIGGER_NAME, SystemProperties.getProperty(SystemProperties.LOG_CRON)); } } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java index e2875125..ae131a05 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java @@ -37,6 +37,8 @@ */ package org.onap.portalapp.service; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.type.TypeFactory; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -45,9 +47,7 @@ import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; - import javax.servlet.http.HttpServletRequest; - import org.onap.portalsdk.core.auth.LoginStrategy; import org.onap.portalsdk.core.domain.App; import org.onap.portalsdk.core.domain.Role; @@ -72,16 +72,12 @@ import org.onap.portalsdk.core.service.RestApiRequestBuilder; import org.onap.portalsdk.core.service.RoleService; import org.onap.portalsdk.core.service.UserProfileService; import org.onap.portalsdk.core.service.UserService; -import org.onap.portalsdk.core.service.WebServiceCallService; import org.onap.portalsdk.core.util.JSONUtil; import org.onap.portalsdk.core.util.SystemProperties; import org.onap.portalsdk.core.web.support.UserUtils; import org.slf4j.MDC; import org.springframework.context.ApplicationContext; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.type.TypeFactory; - /** * Implements the REST API interface to answer requests made by Portal app about * users and active sessions. @@ -95,6 +91,9 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(OnBoardingApiServiceImpl.class); + private static final String USER_NAME = "username"; + private static final String PASSWORD = "password"; + private RoleService roleService; private UserProfileService userProfileService; private IAdminAuthExtension adminAuthExtensionServiceImpl; @@ -489,25 +488,19 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR } String appUserName = ""; String appPassword = ""; - String appName = ""; for (Map.Entry<String, String> entry : appCredentials.entrySet()) { - if (entry.getKey().equalsIgnoreCase("username")) { + if (USER_NAME.equalsIgnoreCase(entry.getKey())) { appUserName = entry.getValue(); - } else if (entry.getKey().equalsIgnoreCase("password")) { + } else if (PASSWORD.equalsIgnoreCase(entry.getKey())) { appPassword = entry.getValue(); - } else { - appName = entry.getValue(); } } try { - String appUser = request.getHeader("username"); - String password = request.getHeader("password"); - if (password.equals(appPassword) && appUserName.equals(appUser)) { - return true; - } - return false; + String appUser = request.getHeader(USER_NAME); + String password = request.getHeader(PASSWORD); + return password.equals(appPassword) && appUserName.equals(appUser); } catch (Exception e) { String response = "OnboardingApiService.isAppAuthenticated failed"; logger.error(EELFLoggerDelegate.errorLogger, response, e); @@ -550,8 +543,8 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR appUserName = "unknown"; appName = SystemProperties.SDK_NAME; } - credentialsMap.put("username", appUserName); - credentialsMap.put("password", decryptedPwd); + credentialsMap.put(USER_NAME, appUserName); + credentialsMap.put(PASSWORD, decryptedPwd); credentialsMap.put("appName", appName); return credentialsMap; } |