You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/06/24 04:42:00 UTC

[GitHub] [cloudstack] Pearl1594 commented on a change in pull request #4166: Fixes issue b/w Legacy and Primate UI wrt SessionID

Pearl1594 commented on a change in pull request #4166:
URL: https://github.com/apache/cloudstack/pull/4166#discussion_r444640486



##########
File path: server/src/main/java/com/cloud/api/ApiServlet.java
##########
@@ -259,6 +259,22 @@ void processRequestInContext(final HttpServletRequest req, final HttpServletResp
                 userId = (Long)session.getAttribute("userid");
                 final String account = (String) session.getAttribute("account");
                 final Object accountObj = session.getAttribute("accountobj");
+                if (session.getAttribute(ApiConstants.SESSIONKEY) != null) {
+                    Cookie[] cookies = req.getCookies();
+                    if (cookies != null) {
+                        HttpSession finalSession = session;
+                        List<Cookie> sessionKeys = Arrays.stream(cookies).filter(cookie ->  cookie.getName().equals(ApiConstants.SESSIONKEY)
+                                && cookie.getValue().equals(finalSession.getAttribute(ApiConstants.SESSIONKEY))).collect(Collectors.toList());
+                        Cookie validCookie = sessionKeys.get(0);

Review comment:
       When there are 2 sessions opened (primate and legacy UI) to the same domain, there will be multiple sessionkey cookies




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org