diff options
author | Sudarshan Kumar <sudarshan.kumar@att.com> | 2020-09-07 14:36:53 +0530 |
---|---|---|
committer | Sudarshan Kumar <sudarshan.kumar@att.com> | 2020-09-07 14:37:58 +0530 |
commit | a779b5c1a8d6fb2356781987431d2a742950a616 (patch) | |
tree | b1e2a9766d8c5ddb544405acba2bfea4ea376411 | |
parent | 0f6b3203e4f35d58949ef55879ba8110d51d70cf (diff) |
Sync Application Users Roles during login process
Sync Application Users Roles during login process
Issue-ID: PORTAL-996
Change-Id: I6c3b4ee125d25d50159d464044dba8644f471fa9
Signed-off-by: Sudarshan Kumar <sudarshan.kumar@att.com>
-rw-r--r-- | ecomp-portal-BE-os/src/main/java/org/onap/portalapp/controller/LoginController.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/controller/LoginController.java b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/controller/LoginController.java index f88a2547..2fe704b9 100644 --- a/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/controller/LoginController.java +++ b/ecomp-portal-BE-os/src/main/java/org/onap/portalapp/controller/LoginController.java @@ -59,9 +59,11 @@ import org.onap.portalapp.command.EPLoginBean; import org.onap.portalapp.portal.domain.SharedContext; import org.onap.portalapp.portal.service.EPLoginService; import org.onap.portalapp.portal.service.EPRoleFunctionService; +import org.onap.portalapp.portal.service.ExternalAccessRolesService; import org.onap.portalapp.portal.service.SharedContextService; import org.onap.portalapp.portal.utils.EPCommonSystemProperties; import org.onap.portalapp.portal.utils.EPSystemProperties; +import org.onap.portalapp.portal.utils.EcompPortalUtils; import org.onap.portalapp.util.EPUserUtils; import org.onap.portalapp.util.SessionCookieUtil; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; @@ -103,6 +105,8 @@ public class LoginController extends EPUnRestrictedBaseController implements Log private SharedContextService sharedContextService; @Autowired private EPRoleFunctionService ePRoleFunctionService; + @Autowired + private ExternalAccessRolesService externalAccessRolesService ; private String viewName = "login"; @@ -125,6 +129,7 @@ public class LoginController extends EPUnRestrictedBaseController implements Log @ResponseBody public String loginValidate(HttpServletRequest request, HttpServletResponse response) throws Exception { + String orgUserId = ""; ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JsonNode root = mapper.readTree(request.getReader()); @@ -179,6 +184,18 @@ public class LoginController extends EPUnRestrictedBaseController implements Log SessionCookieUtil.setUpUserIdCookie(request, response, loginId); JSONObject j = new JSONObject("{success: success}"); + + try { + //if app is centralized then sync user roles from the external auth system + orgUserId = commandBean.getUser().getOrgUserId(); + if(EcompPortalUtils.checkIfRemoteCentralAccessAllowed()) { + externalAccessRolesService.syncApplicationUserRolesFromExtAuthSystem(orgUserId); + logger.info(EELFLoggerDelegate.errorLogger, "Sync: Sync Application UserRoles From ExtAuthSystem is done.."); + } + } catch (Exception e) { + logger.info(EELFLoggerDelegate.errorLogger, "Sync: Sync Application UserRoles From ExtAuthSystem Faild..", + e); + } return j.toString(); } |