From 86c6f3a65b5b390eea7951e65b9513ed25c309e8 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Wed, 1 Oct 2014 10:54:06 +0200 Subject: update authentication filter --- .../at/gv/util/filter/moaid/MOAIDAuthenticationFilter.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/main/java/at/gv/util') diff --git a/src/main/java/at/gv/util/filter/moaid/MOAIDAuthenticationFilter.java b/src/main/java/at/gv/util/filter/moaid/MOAIDAuthenticationFilter.java index cb16b8f..ab3d3b9 100644 --- a/src/main/java/at/gv/util/filter/moaid/MOAIDAuthenticationFilter.java +++ b/src/main/java/at/gv/util/filter/moaid/MOAIDAuthenticationFilter.java @@ -164,11 +164,17 @@ public class MOAIDAuthenticationFilter implements Filter { // CustomHttpServletRequest(httpServletRequest).toString()); session.setAttribute(STORED_REQUEST_URL_ID, requestURL); } + + String page = loginPage; + + if (loginPage.startsWith("/") && !loginPage.startsWith("//")) + page = httpServletRequest.getContextPath() + loginPage; + if (loginPageForward) { - RequestDispatcher dispatcher = request.getRequestDispatcher(loginPage); + RequestDispatcher dispatcher = request.getRequestDispatcher(page); dispatcher.forward(httpServletRequest, httpServletResponse); } else { - httpServletResponse.sendRedirect(httpServletResponse.encodeRedirectURL(loginPage)); + httpServletResponse.sendRedirect(httpServletResponse.encodeRedirectURL(page)); } return; } -- cgit v1.2.3