summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java31
1 files changed, 12 insertions, 19 deletions
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;
}