From df2e8c2fa47a6d2f96a16865b76ff45362c6996b Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Sun, 13 Jan 2019 13:33:23 +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/release18.12@1851201 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/ofbiz/base/util/UtilHttp.java | 2 +- .../java/org/apache/ofbiz/webapp/control/LoginWorker.java | 4 ++-- 2 files changed, 3 insertions(+), 3 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 88fce61f00..670b99ce27 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 7537bed817..bb37686f73 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 @@ -932,7 +932,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); @@ -952,7 +952,7 @@ public class LoginWorker { Cookie securedLoginIdCookie = new Cookie(getSecuredLoginIdCookieName(request), userLogin.getString("userLoginId")); securedLoginIdCookie.setMaxAge(-1); securedLoginIdCookie.setDomain(EntityUtilProperties.getPropertyValue("url", "cookie.domain", delegator)); - securedLoginIdCookie.setPath("/" + UtilHttp.getApplicationName(request).replaceAll("/","_")); + securedLoginIdCookie.setPath("/" + UtilHttp.getApplicationName(request)); securedLoginIdCookie.setSecure(true); securedLoginIdCookie.setHttpOnly(true); response.addCookie(securedLoginIdCookie);