From cc97e3b633f66bd050b19270d8e67788b2117dcd Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Sun, 13 Jan 2019 13:43:44 +0000 Subject: [PATCH] "Applied fix from trunk for revision: 1851200" ------------------------------------------------------------------------ r1851200 | jleroux | 2019-01-13 14:31:13 +0100 (dim. 13 janv. 2019) | 11 lignes Reverted: Impossible secure and autologin cookie names when mountpoint contains a slash inside its name (OFBIZ-10766) In my previous commit I reverted the initial change. As I said in the Jira I had a second look and it's better to fix the problem at the root as I did initially. I wrote in my previous commit: "This method is used in other places where the name should not be changed." I checked there are no issues changing slashes to underscores in the cookies names anywhere. ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release17.12@1851203 13f79535-47bb-0310-9956-ffa450edef68 --- .../base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java | 2 +- .../main/java/org/apache/ofbiz/webapp/control/LoginWorker.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java index 036aefb948..9a7807088a 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java @@ -668,7 +668,7 @@ public final class UtilHttp { if (request.getContextPath().length() > 1) { appName = request.getContextPath().substring(1); } - return appName; + return appName.replaceAll("/","_"); } public static void setInitialRequestInfo(HttpServletRequest request) { diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java index 075e245b83..bb0bbbc4f0 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java @@ -720,7 +720,7 @@ public class LoginWorker { Cookie autoLoginCookie = new Cookie(getAutoLoginCookieName(request), userLogin.getString("userLoginId")); autoLoginCookie.setMaxAge(60 * 60 * 24 * 365); autoLoginCookie.setDomain(EntityUtilProperties.getPropertyValue("url", "cookie.domain", delegator)); - autoLoginCookie.setPath("/" + applicationName.replaceAll("/","_")); + autoLoginCookie.setPath("/" + applicationName); autoLoginCookie.setSecure(true); autoLoginCookie.setHttpOnly(true); response.addCookie(autoLoginCookie);