summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp')
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FavoritesController.java4
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java57
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileSearchController.java18
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java4
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UsageListController.java8
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UserProfileController.java4
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/WelcomeController.java4
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/AngularSinglePageController.java4
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java4
9 files changed, 41 insertions, 66 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FavoritesController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FavoritesController.java
index fbb9cc5d..09cbb0ac 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FavoritesController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FavoritesController.java
@@ -52,6 +52,8 @@ import org.onap.portalsdk.core.logging.aspect.AuditLog;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.onboarding.rest.FavoritesClient;
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.service.AppService;
import org.onap.portalsdk.core.util.SystemProperties;
import org.slf4j.MDC;
@@ -109,7 +111,7 @@ public class FavoritesController extends RestrictedBaseController {
appUserName = app.getUsername();
try {
decryptedPwd = CipherUtil.decryptPKC(app.getAppPassword(),
- SystemProperties.getProperty(SystemProperties.Decryption_Key));
+ KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY));
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger,
"FavoritesController.getFavorites failed while decrypting password", e);
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java
index bbd08c45..d41bf239 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java
@@ -37,20 +37,16 @@
*/
package org.onap.portalapp.controller.core;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.servlet.http.HttpServletRequest;
import org.onap.portalsdk.core.controller.UnRestrictedBaseController;
-import org.onap.portalsdk.core.domain.User;
-import org.onap.portalsdk.core.logging.aspect.MetricsLog;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
-import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
-import org.onap.portalsdk.core.web.support.UserUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.ModelAndView;
@Controller
@@ -59,8 +55,6 @@ public class LogoutController extends UnRestrictedBaseController {
private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(LogoutController.class);
- private User user;
-
/**
*
* invalidates the current application session, then redirects to portal logout
@@ -72,53 +66,12 @@ public class LogoutController extends UnRestrictedBaseController {
public ModelAndView globalLogout(HttpServletRequest request) {
ModelAndView modelView = null;
try {
- chatRoomLogout(request);
request.getSession().invalidate();
- String portalUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL);
- String portalDomain = portalUrl.substring(0, portalUrl.lastIndexOf('/'));
- String redirectUrl = portalDomain + "/logout.htm";
- modelView = new ModelAndView("redirect:" + redirectUrl);
+ Map<String, Object> model = new HashMap<>();
+ return new ModelAndView("login", "model", model);
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "Logout failed", e);
}
return modelView;
}
-
- /**
- *
- * invalidates the current session (application logout) and redirects user to
- * Portal.
- *
- * @param request
- * @return modelView
- */
- @RequestMapping(value = { "/app_logout.htm" }, method = RequestMethod.GET)
- public ModelAndView appLogout(HttpServletRequest request) {
- ModelAndView modelView = null;
- try {
- chatRoomLogout(request);
- modelView = new ModelAndView(
- "redirect:" + PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL));
- UserUtils.clearUserSession(request);
- request.getSession().invalidate();
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "Application Logout failed", e);
- }
- return modelView;
- }
-
- @MetricsLog
- public void chatRoomLogout(HttpServletRequest request) {
- request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
- setUser(UserUtils.getUserSession(request));
- }
-
- public User getUser() {
- return user;
- }
-
- public void setUser(User user) {
- this.user = user;
- }
-
}
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileSearchController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileSearchController.java
index ff80d413..24e44d4b 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileSearchController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileSearchController.java
@@ -139,6 +139,24 @@ public class ProfileSearchController extends RestrictedBaseController {
logger.error(EELFLoggerDelegate.applicationLogger, "getUserPagination failed", e);
}
}
+
+ @RequestMapping(value = { "/get_all_users" }, method = RequestMethod.GET)
+ public void getAllUsers(HttpServletRequest request, HttpServletResponse response) {
+ Map<String, Object> model = new HashMap<>();
+ ObjectMapper mapper = new ObjectMapper();
+ logger.info(EELFLoggerDelegate.applicationLogger, "Initiating get_all_users in ProfileSearchController");
+ List<User> profileList = null;
+ try {
+ profileList = service.listAllUsers();
+ model.put("profileList", mapper.writeValueAsString(profileList));
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+ JSONObject j = new JSONObject(msg);
+ response.setContentType(APPLICATION_JSON);
+ response.getWriter().write(j.toString());
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.applicationLogger, "getAllUsers failed", e);
+ }
+ }
@SuppressWarnings("unchecked")
private Map<String, Object> setDashboardData(HttpServletRequest request)
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java
index 83962c63..95ac28d8 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java
@@ -70,7 +70,7 @@ import org.onap.portalsdk.core.web.support.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.util.WebUtils;
@@ -116,7 +116,7 @@ public class SingleSignOnController extends UnRestrictedBaseController {
* @return Redirect to an appropriate address
* @throws Exception
*/
- @RequestMapping(value = { "/single_signon.htm" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/single_signon.htm" })
public ModelAndView singleSignOnLogin(HttpServletRequest request) throws Exception {
Map<String, String> model = new HashMap<>();
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UsageListController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UsageListController.java
index fabc06bf..00b8d796 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UsageListController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UsageListController.java
@@ -56,7 +56,7 @@ import org.onap.portalsdk.core.util.UsageUtils;
import org.onap.portalsdk.core.web.support.JsonMessage;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
@@ -93,7 +93,7 @@ public class UsageListController extends RestrictedBaseController {
}
@SuppressWarnings({ "unchecked", "rawtypes" })
- @RequestMapping(value = { "/usage_list" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/usage_list" })
public ModelAndView usageList(HttpServletRequest request) {
Map<String, Object> model = new HashMap<>();
@@ -117,7 +117,7 @@ public class UsageListController extends RestrictedBaseController {
}
@SuppressWarnings({ "unchecked", "rawtypes" })
- @RequestMapping(value = { "/get_usage_list" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/get_usage_list" })
public void getUsageList(HttpServletRequest request, HttpServletResponse response) {
HttpSession httpSession = request.getSession();
@@ -144,7 +144,7 @@ public class UsageListController extends RestrictedBaseController {
}
@SuppressWarnings("rawtypes")
- @RequestMapping(value = { "/usage_list/removeSession" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/usage_list/removeSession" })
public void removeSession(HttpServletRequest request, HttpServletResponse response) throws IOException {
HashMap activeUsers = (HashMap) request.getSession().getServletContext().getAttribute(ACTIVE_USERS);
UserRowBean data = new UserRowBean();
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UserProfileController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UserProfileController.java
index 5067be1e..c637719d 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UserProfileController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UserProfileController.java
@@ -49,7 +49,7 @@ import org.onap.portalsdk.core.service.ProfileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -68,7 +68,7 @@ public class UserProfileController extends RestrictedBaseController {
@Autowired
private ProfileService service;
- @RequestMapping(value = { "/user_profile" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/user_profile" })
public ModelAndView userProfile() throws IOException {
Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/WelcomeController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/WelcomeController.java
index 7193f6bb..ce6b8ef1 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/WelcomeController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/WelcomeController.java
@@ -40,7 +40,7 @@ package org.onap.portalapp.controller.core;
import org.onap.portalsdk.core.controller.RestrictedBaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;
/**
@@ -51,7 +51,7 @@ import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping("/")
public class WelcomeController extends RestrictedBaseController {
- @RequestMapping(value = { "/welcome" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/welcome" })
public ModelAndView welcome() {
final String defaultViewName = null;
return new ModelAndView(defaultViewName);
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/AngularSinglePageController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/AngularSinglePageController.java
index 96b602c3..98f1db84 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/AngularSinglePageController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/AngularSinglePageController.java
@@ -45,7 +45,7 @@ import javax.servlet.http.HttpServletRequest;
import org.onap.portalsdk.core.controller.RestrictedBaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;
/**
@@ -57,7 +57,7 @@ import org.springframework.web.servlet.ModelAndView;
@RequestMapping("/")
public class AngularSinglePageController extends RestrictedBaseController {
- @RequestMapping(value = { "/singlePageSample" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/singlePageSample" })
public ModelAndView view(HttpServletRequest request) {
Map<String, Object> model = new HashMap<>();
return new ModelAndView("single_page_sample", "model", model);
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 2b75aea1..8598ed15 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
@@ -62,6 +62,8 @@ import org.onap.portalsdk.core.onboarding.exception.CipherUtilException;
import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
import org.onap.portalsdk.core.onboarding.listener.PortalTimeoutHandler;
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.onboarding.util.PortalApiConstants;
import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
import org.onap.portalsdk.core.restful.domain.EcompRole;
@@ -527,7 +529,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR
appUserName = app.getUsername();
try {
decryptedPwd = CipherUtil.decryptPKC(app.getAppPassword(),
- SystemProperties.getProperty(SystemProperties.Decryption_Key));
+ KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY));
} catch (CipherUtilException e) {
logger.error(EELFLoggerDelegate.errorLogger, "getAppCredentials failed", e);
}