From cc21c661ae99fb0d023a7c86dddaa27f2e4e8f38 Mon Sep 17 00:00:00 2001 From: pasindu Date: Mon, 22 Jan 2024 09:02:54 +0530 Subject: [PATCH] Fix UI issue from interceptor side --- .../mgt/core/ui/request/interceptor/UserHandler.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/UserHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/UserHandler.java index 8ef651c3bb..c608585ac4 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/UserHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/UserHandler.java @@ -50,7 +50,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Base64; import java.util.List; -import java.util.Map; @MultipartConfig @WebServlet("/user") @@ -122,13 +121,11 @@ public class UserHandler extends HttpServlet { proxyResponse.setCode(HttpStatus.SC_OK); ObjectMapper mapper = new ObjectMapper(); - Map nodeMap = mapper.convertValue(tokenData, new TypeReference<>() { - }); - nodeMap.put("username", tokenData.get("username").textValue().replaceAll("@carbon.super", "")); - proxyResponse.setData(mapper.convertValue(nodeMap, JsonNode.class)); + String data = tokenData.get("username").textValue().replaceAll("@carbon.super", ""); + proxyResponse.setData(mapper.convertValue(data, JsonNode.class)); HandlerUtil.handleSuccess(resp, proxyResponse); - httpSession.setAttribute(HandlerConstants.USERNAME_WITH_DOMAIN, nodeMap.get("username").toString()); + httpSession.setAttribute(HandlerConstants.USERNAME_WITH_DOMAIN, tokenData.get("username").toString()); log.info( "User " + proxyResponse.getData() + " logged in", userLoginLogContextBuilder