You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2024/02/04 10:10:39 UTC
(ofbiz-framework) branch release18.12 updated: Improved: Normalize contextPath in hasBasePermission (OFBIZ-12887)
This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release18.12 by this push:
new b91a9b7f26 Improved: Normalize contextPath in hasBasePermission (OFBIZ-12887)
b91a9b7f26 is described below
commit b91a9b7f26ed609ca4c45112dba71c2afe461bf6
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Sun Feb 4 10:41:33 2024 +0100
Improved: Normalize contextPath in hasBasePermission (OFBIZ-12887)
Better have a normalized contextPath in LoginWorker::hasBasePermission
---
.../main/java/org/apache/ofbiz/webapp/control/LoginWorker.java | 9 +++++++++
1 file changed, 9 insertions(+)
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 d6e06351b5..23209ff375 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
@@ -21,6 +21,8 @@ package org.apache.ofbiz.webapp.control;
import static org.apache.ofbiz.base.util.UtilGenerics.checkMap;
import java.math.BigInteger;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.security.cert.X509Certificate;
import java.sql.Timestamp;
import java.util.ArrayList;
@@ -1364,6 +1366,13 @@ public class LoginWorker {
if (UtilValidate.isEmpty(contextPath)) {
contextPath = "/";
}
+
+ try {
+ contextPath = new URI(contextPath).normalize().toString();
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+
ComponentConfig.WebappInfo info = ComponentConfig.getWebAppInfo(serverId, contextPath);
if (info != null) {
return hasApplicationPermission(info, security, userLogin);