Skip to content

Commit

Permalink
Fix loginRequestPath
Browse files Browse the repository at this point in the history
  • Loading branch information
SavinduDimal committed Oct 16, 2023
1 parent fa4423e commit 101826c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,16 @@
if (userName.value) {
let contextPath = "<%=proxyContextPath%>"
let loginRequestPath = "<%=loginContextRequestUrl%>"
if (contextPath !== "") {
contextPath = contextPath.startsWith('/') ? contextPath : "/" + contextPath
contextPath = contextPath.endsWith('/') ?
contextPath.substring(0, contextPath.length - 1) : contextPath
loginRequestPath = loginRequestPath.startsWith('../') ? loginRequestPath.substring(2, loginRequestPath.length) : loginRequestPath
}
$.ajax({
type: "GET",
url: contextPath + "<%=loginContextRequestUrl%>",
url: contextPath + loginRequestPath,
xhrFields: { withCredentials: true },
success: function (data) {
if (data && data.status == 'redirect' && data.redirectUrl && data.redirectUrl.length > 0) {
Expand Down
6 changes: 5 additions & 1 deletion modules/distribution/product/src/main/extensions/login.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,13 @@
<script>
function checkSessionKey() {
var proxyPath = "<%=contextPath%>"
let loginRequestPath = "<%=loginContextRequestUrl%>"
if (proxyPath !== "") {
loginRequestPath = loginRequestPath.startsWith('../') ? loginRequestPath.substring(2, loginRequestPath.length) : loginRequestPath
}
$.ajax({
type: "GET",
url: proxyPath + "<%=loginContextRequestUrl%>",
url: proxyPath + loginRequestPath,
xhrFields: { withCredentials: true },
success: function (data) {
if (data && data.status == 'redirect' && data.redirectUrl && data.redirectUrl.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
<param-name>Owasp.CsrfGuard.Config</param-name>
<param-value>repository/conf/security/Owasp.CsrfGuard.Carbon.properties</param-value>
</context-param>
<context-param>
<param-name>contextPath</param-name>
<param-value>{{server.proxy_context_path}}</param-value>
</context-param>

<servlet id="bridge">
<servlet-name>bridgeservlet</servlet-name>
Expand Down

0 comments on commit 101826c

Please sign in to comment.