rhtyd commented on a change in pull request #4166:
URL: https://github.com/apache/cloudstack/pull/4166#discussion_r444594221
##########
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:
Why is the first cookie assumed the valid one? Is the core problem that
more than one instance of sessionkey cookie exists?
----------------------------------------------------------------
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:
[email protected]