Skip to content

Commit 897b78b

Browse files
committed
Fix loginRequestPath
1 parent 35a5698 commit 897b78b

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

modules/distribution/product/src/main/extensions/basicauth.jsp

+3-1
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,16 @@
9393
9494
if (userName.value) {
9595
let contextPath = "<%=proxyContextPath%>"
96+
let loginRequestPath = "<%=loginContextRequestUrl%>"
9697
if (contextPath !== "") {
9798
contextPath = contextPath.startsWith('/') ? contextPath : "/" + contextPath
9899
contextPath = contextPath.endsWith('/') ?
99100
contextPath.substring(0, contextPath.length - 1) : contextPath
101+
loginRequestPath = loginRequestPath.startsWith('../') ? loginRequestPath.substring(2, loginRequestPath.length) : loginRequestPath
100102
}
101103
$.ajax({
102104
type: "GET",
103-
url: contextPath + "<%=loginContextRequestUrl%>",
105+
url: contextPath + loginRequestPath,
104106
xhrFields: { withCredentials: true },
105107
success: function (data) {
106108
if (data && data.status == 'redirect' && data.redirectUrl && data.redirectUrl.length > 0) {

modules/distribution/product/src/main/extensions/login.jsp

+5-1
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,13 @@
501501
<script>
502502
function checkSessionKey() {
503503
var proxyPath = "<%=contextPath%>"
504+
let loginRequestPath = "<%=loginContextRequestUrl%>"
505+
if (proxyPath !== "") {
506+
loginRequestPath = loginRequestPath.startsWith('../') ? loginRequestPath.substring(2, loginRequestPath.length) : loginRequestPath
507+
}
504508
$.ajax({
505509
type: "GET",
506-
url: proxyPath + "<%=loginContextRequestUrl%>",
510+
url: proxyPath + loginRequestPath,
507511
xhrFields: { withCredentials: true },
508512
success: function (data) {
509513
if (data && data.status == 'redirect' && data.redirectUrl && data.redirectUrl.length > 0) {

modules/distribution/product/src/main/resources/conf/templates/repository/conf/tomcat/carbon/WEB-INF/web.xml.j2

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
<param-name>Owasp.CsrfGuard.Config</param-name>
2727
<param-value>repository/conf/security/Owasp.CsrfGuard.Carbon.properties</param-value>
2828
</context-param>
29+
<context-param>
30+
<param-name>contextPath</param-name>
31+
<param-value>{{server.proxy_context_path}}</param-value>
32+
</context-param>
2933

3034
<servlet id="bridge">
3135
<servlet-name>bridgeservlet</servlet-name>

0 commit comments

Comments
 (0)