From 5298601fa9c84c7bd839692053deb52d62e7097e Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Mon, 7 Jan 2019 20:41:58 +0000 Subject: [PATCH] "Applied fix from trunk for revision: 1850685" ------------------------------------------------------------------------ r1850685 | jleroux | 2019-01-07 21:37:10 +0100 (lun. 07 janv. 2019) | 8 lignes Fixed: Impossible secure and autologin cookie names when mountpoint contains a slash inside its name (OFBIZ-10766) My previous commit was wrong this one fixes it. I made a mistake trying to generalise changing UtilHttp::getApplicationName. This method is used in other places where the name should not be changed. Only cookies are concerned. ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release17.12@1850687 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 9a7807088a..036aefb948 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.replaceAll("/","_"); + return appName; } 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 f9fb0d402e..f0912ae44f 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 @@ -716,7 +716,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("/" + UtilHttp.getApplicationName(request)); + autoLoginCookie.setPath("/" + UtilHttp.getApplicationName(request).replaceAll("/","_")); autoLoginCookie.setSecure(true); autoLoginCookie.setHttpOnly(true); response.addCookie(autoLoginCookie);