diff options
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/RedirectServlet.java')
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/RedirectServlet.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/RedirectServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/RedirectServlet.java index 57755ca9f..6e1811c8b 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/RedirectServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/RedirectServlet.java @@ -46,6 +46,8 @@ public class RedirectServlet extends AuthServlet{ public static final String REDIRCT_PARAM_URL = "redirecturl"; + private static final String DEFAULT_REDIRECTTARGET = "_parent"; + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { @@ -55,16 +57,10 @@ public class RedirectServlet extends AuthServlet{ String target = req.getParameter(PARAM_TARGET); String artifact = req.getParameter(PARAM_SAMLARTIFACT); String interIDP = req.getParameter(INTERFEDERATION_IDP); - - if (MiscUtil.isEmpty(artifact) && MiscUtil.isEmpty(interIDP)) { - resp.sendError(HttpServletResponse.SC_FORBIDDEN, "Parameters not valid"); - return; - } - Logger.debug("Check URL against online-applications"); OnlineApplication oa = null; - String redirectTarget = "_parent"; + String redirectTarget = DEFAULT_REDIRECTTARGET; try { oa = ConfigurationDBRead.getActiveOnlineApplication(url); if (oa == null) { @@ -118,10 +114,16 @@ public class RedirectServlet extends AuthServlet{ resp.addHeader("Location", url); - } else { - resp.sendError(HttpServletResponse.SC_FORBIDDEN, "Parameters not valid"); - return; + } else { + Logger.debug("Redirect to " + url); + String redirect_form = RedirectFormBuilder.buildLoginForm(url, DEFAULT_REDIRECTTARGET); + resp.setContentType("text/html;charset=UTF-8"); + resp.setStatus(HttpServletResponse.SC_OK); + PrintWriter out = new PrintWriter(resp.getOutputStream()); + out.write(redirect_form); + out.flush(); + } } |