diff options
author | Christopher Lott (cl778h) <clott@research.att.com> | 2017-07-31 18:20:49 -0400 |
---|---|---|
committer | Christopher Lott (cl778h) <clott@research.att.com> | 2017-07-31 18:25:35 -0400 |
commit | a0b9152f19c4f8dbd925635129d75af9785a1d4a (patch) | |
tree | b4b06113eb76c5522c89f675d1e2c33afcbd3216 /ecomp-portal-BE-common | |
parent | cc805e781c5c764860a1f801e637c6ed6e471f63 (diff) |
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) <clott@research.att.com>
Diffstat (limited to 'ecomp-portal-BE-common')
4 files changed, 14 insertions, 4 deletions
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<CommonWidgetMeta> 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<String> entity = new HttpEntity<String>(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<MicroserviceData> list = (List<MicroserviceData>) 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)); } |