From a0b9152f19c4f8dbd925635129d75af9785a1d4a Mon Sep 17 00:00:00 2001 From: "Christopher Lott (cl778h)" Date: Mon, 31 Jul 2017 18:20:49 -0400 Subject: [PATCH] Repair widget micro service, onboarding of widgets Issue: PORTAL-30, PORTAL-40, PORTAL-45, PORTAL-46, PORTAL-47 Change-Id: I97de4cc038f7167d5e368249f9ea5e47e8fc1b09 Signed-off-by: Christopher Lott (cl778h) --- deliveries/.gitignore | 1 + deliveries/new_stop.sh | 2 +- deliveries/widget_ms_start.sh | 2 +- .../portal/controller/CommonWidgetController.java | 6 ++- .../service/MicroserviceProxyServiceImpl.java | 2 + .../portal/service/MicroserviceServiceImpl.java | 8 +++- .../portal/service/UserRolesCommonServiceImpl.java | 2 +- ecomp-portal-BE-os/README.md | 3 ++ ecomp-portal-BE-os/pom.xml | 10 ++--- .../service/ApplicationsRestClientServiceImpl.java | 7 ++- .../portalapp/portal/transport/OnboardingApp.java | 2 + .../src/main/webapp/WEB-INF/jsp/login.jsp | 51 ++++++++++++++++------ .../client/app/views/header/header.less | 1 + ecomp-portal-FE-os/client/configurations/dev.json | 4 +- 14 files changed, 74 insertions(+), 27 deletions(-) diff --git a/deliveries/.gitignore b/deliveries/.gitignore index f12ac3a0..99665291 100644 --- a/deliveries/.gitignore +++ b/deliveries/.gitignore @@ -1 +1,2 @@ /PROJECT +/etc_vm-ep-dev2.zip diff --git a/deliveries/new_stop.sh b/deliveries/new_stop.sh index 7693c035..9193e285 100755 --- a/deliveries/new_stop.sh +++ b/deliveries/new_stop.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Establish environment variables source $(dirname $0)/os_settings.sh diff --git a/deliveries/widget_ms_start.sh b/deliveries/widget_ms_start.sh index 5e51aebe..b5fbdc25 100755 --- a/deliveries/widget_ms_start.sh +++ b/deliveries/widget_ms_start.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Establish environment variables source $(dirname $0)/os_settings.sh diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java index 68e32a16..7faea5d9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java @@ -20,6 +20,8 @@ package org.openecomp.portalapp.portal.controller; import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalapp.controller.EPRestrictedBaseController; import org.openecomp.portalapp.portal.controller.DashboardController.WidgetCategory; import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; @@ -33,7 +35,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController -public class CommonWidgetController implements BasicAuthenticationController{ +public class CommonWidgetController extends EPRestrictedBaseController implements BasicAuthenticationController{ private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CommonWidgetController.class); @@ -63,7 +65,7 @@ public class CommonWidgetController implements BasicAuthenticationController{ * Request parameter. * @return Rest response wrapped around a CommonWidgetMeta object. */ - @RequestMapping(value = "/widgetData", method = RequestMethod.GET, produces = "application/json") + @RequestMapping(value = "/commonWidgets", method = RequestMethod.GET, produces = "application/json") public PortalRestResponse getWidgetData(HttpServletRequest request, @RequestParam String resourceType) { if (!isValidResourceType(resourceType)){ diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java index 6b9a4416..ff8ee424 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java @@ -108,6 +108,8 @@ public class MicroserviceProxyServiceImpl implements MicroserviceProxyService { HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", "Basic " + base64Creds); headers.setContentType(MediaType.APPLICATION_JSON); + String rawCookie = request.getHeader("Cookie"); + headers.add("Cookie", rawCookie); HttpEntity entity = new HttpEntity(headers); String url = microserviceUrlConverter(data, params); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceServiceImpl.java index aaadfa18..520bef98 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceServiceImpl.java @@ -24,6 +24,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.crypto.BadPaddingException; + import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Restrictions; import org.openecomp.portalapp.portal.domain.MicroserviceData; @@ -82,7 +84,11 @@ public class MicroserviceServiceImpl implements MicroserviceService { List list = (List) dataAccessService.getList(MicroserviceData.class, null); for (int i = 0; i < list.size(); i++) { if (list.get(i).getPassword() != null) - list.get(i).setPassword(decryptedPassword(list.get(i).getPassword())); + try{ + list.get(i).setPassword(decryptedPassword(list.get(i).getPassword())); + } catch(BadPaddingException bpe){ + logger.error(EELFLoggerDelegate.errorLogger, "Couldn't decrypt - Check decryption key in system.properties - looks wrong. Still going ahead with list population though", bpe); + } list.get(i).setParameterList(getServiceParameters(list.get(i).getId())); } return list; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java index 80408954..58809210 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java @@ -1242,7 +1242,7 @@ public class UserRolesCommonServiceImpl { protected EPUser getUser(String userId, EPApp app, ApplicationsRestClientService applicationsRestClientService) throws HTTPException { - return applicationsRestClientService.get(EPUser.class, app.getId(), String.format("/user/%s", userId), true); + return applicationsRestClientService.get(EPUser.class, app.getId(), String.format("/user/%s", userId)); } diff --git a/ecomp-portal-BE-os/README.md b/ecomp-portal-BE-os/README.md index 829fd86f..be584cba 100644 --- a/ecomp-portal-BE-os/README.md +++ b/ecomp-portal-BE-os/README.md @@ -17,6 +17,9 @@ https://www.eclipse.org/m2e-wtp/ Version 1.1.?, July 2017 - [Portal-30] Failed to communicate with the widget microservice: Fixed - [Portal-35] Replaced the portal logo with onap logo on the login screen. +- [Portal-40] Fix to add user roles +- [Portal-47] Fix to eliminate duplicate roles on Users page +- [Portal-45] Fix to save on an application Onboarding Version 1.1.0, July 2017 - [Portal-7] Improvements added as part of the rebasing process diff --git a/ecomp-portal-BE-os/pom.xml b/ecomp-portal-BE-os/pom.xml index 1e4b4922..2cf1af23 100644 --- a/ecomp-portal-BE-os/pom.xml +++ b/ecomp-portal-BE-os/pom.xml @@ -116,15 +116,15 @@ - - - org.openecomp.ecompsdkos - epsdk-app-overlay - + org.openecomp.portal ecompportal-be-common + + org.openecomp.ecompsdkos + epsdk-app-overlay + diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java index 4626b17b..f3fda34e 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java @@ -48,6 +48,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonDeserializationContext; @@ -71,6 +72,8 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient private AppsCacheService appsCacheService; Gson gson = null; + private final ObjectMapper mapper = new ObjectMapper(); + @PostConstruct private void init(){ logger.debug(EELFLoggerDelegate.debugLogger, "initializing"); @@ -185,7 +188,9 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient verifyResponse(response); String str = response.readEntity(String.class); EcompPortalUtils.logAndSerializeObject(restPath, "GET result =", str); - try { t = gson.fromJson(str, clazz); } catch(Exception e) { + try { + t = mapper.readValue(str, clazz); + } catch(Exception e) { logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); EPLogUtil.logEcompError(EPAppMessagesEnum.BeInvalidJsonInput); } diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java index 4c97a52d..f953634a 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java @@ -26,6 +26,8 @@ public class OnboardingApp { public String name; public String imageUrl; + + public String imageLink; public String description; diff --git a/ecomp-portal-BE-os/src/main/webapp/WEB-INF/jsp/login.jsp b/ecomp-portal-BE-os/src/main/webapp/WEB-INF/jsp/login.jsp index c37d6d6f..1b269d80 100644 --- a/ecomp-portal-BE-os/src/main/webapp/WEB-INF/jsp/login.jsp +++ b/ecomp-portal-BE-os/src/main/webapp/WEB-INF/jsp/login.jsp @@ -48,6 +48,22 @@ font-family: Verdana,Arial,Helvetica, sans-serif; font-size: 9px; } + .login-tbl { + border: 0px; + } + .login-txt { + font-family: Arial; + font-size: 14px; + text-decoration: none; + } + .login-input-text { + width: 140px; + height:25px; + border-radius:7px; + padding-left:5px; + font-family: Arial; + font-size: 14px; + } .login-btn { cursor: pointer; background: #d97b34; @@ -73,25 +89,34 @@ %>
- +

- - -
-
- - -
+ + + + + + + + + +
-               

diff --git a/ecomp-portal-FE-common/client/app/views/header/header.less b/ecomp-portal-FE-common/client/app/views/header/header.less index b553cebb..e10e9ed7 100644 --- a/ecomp-portal-FE-common/client/app/views/header/header.less +++ b/ecomp-portal-FE-common/client/app/views/header/header.less @@ -14,6 +14,7 @@ font-weight: 400; font-family: "Omnes-ECOMP-W02",Arial !important; font-size: 18px; + margin-left: 10px; //.c18b; } diff --git a/ecomp-portal-FE-os/client/configurations/dev.json b/ecomp-portal-FE-os/client/configurations/dev.json index a037deb0..38142f73 100644 --- a/ecomp-portal-FE-os/client/configurations/dev.json +++ b/ecomp-portal-FE-os/client/configurations/dev.json @@ -83,8 +83,8 @@ "UpdateUserAppsSortManual": "http://localhost:8080/ecompportal/portalApi/UpdateUserAppsSortManual", "widgetCatalogSelection": "http://localhost:8080/ecompportal/portalApi/widgetCatalogSelection", "widgetCommon": "http://localhost:8080/ecompportal/portalApi/microservices", - "basicAuthAccount": "http://www.ecomp.att.com:8080/ecompportal-att/portalApi/basicAuthAccount", - "microserviceProxy": "http://www.ecomp.att.com:8080/ecompportal-att/portalApi/microservice/proxy", + "basicAuthAccount": "http://localhost:8080/ecompportal/portalApi/basicAuthAccount", + "microserviceProxy": "http://localhost:8080/ecompportal/portalApi/microservice/proxy", "getWidthThresholdLeftMenu":"http://localhost:8080/ecompportal/portalApi/dashboard/windowWidthThresholdLeftMenu", "getWidthThresholdRightMenu":"http://localhost:8080/ecompportal/portalApi/dashboard/windowWidthThresholdRightMenu", "appCatalogRoles" : "http://localhost:8080/ecompportal/portalApi/appCatalogRoles", -- 2.16.6