diff options
-rw-r--r-- | id.server/src/at/gv/egovernment/moa/id/proxy/servlet/ProxyServlet.java | 41 | ||||
-rw-r--r-- | id.server/src/test/abnahme/P/Test100LoginParameterResolver.java | 2 |
2 files changed, 37 insertions, 6 deletions
diff --git a/id.server/src/at/gv/egovernment/moa/id/proxy/servlet/ProxyServlet.java b/id.server/src/at/gv/egovernment/moa/id/proxy/servlet/ProxyServlet.java index 53d0f701c..ff0f3a171 100644 --- a/id.server/src/at/gv/egovernment/moa/id/proxy/servlet/ProxyServlet.java +++ b/id.server/src/at/gv/egovernment/moa/id/proxy/servlet/ProxyServlet.java @@ -156,7 +156,7 @@ public class ProxyServlet extends HttpServlet { String urlRequested = req.getRequestURL().toString(); OAConfiguration oaConf = null; String loginType = ""; - String binding = "full"; + String binding = ""; if (session.getAttribute(ATT_BROWSERREQU)==null) { @@ -192,10 +192,38 @@ public class ProxyServlet extends HttpServlet { String clientIPAddress = req.getRemoteAddr(); boolean businessService = oaParam.getBusinessService(); try { - if (oaConf.getAuthType().equals(OAConfiguration.PARAM_AUTH)) - loginParameters = lpr.getAuthenticationParameters(oaConf, authData, clientIPAddress, businessService); - else + if (oaConf.getAuthType().equals(OAConfiguration.PARAM_AUTH)) { + loginParameters = lpr.getAuthenticationParameters(oaConf, authData, clientIPAddress, businessService, publicURLPrefix); + } else { loginHeaders = lpr.getAuthenticationHeaders(oaConf, authData, clientIPAddress, businessService, publicURLPrefix); + for (Iterator iter = loginHeaders.keySet().iterator(); iter.hasNext();) { + //extract user-defined bindingValue + String headerKey = (String) iter.next(); + String headerKeyValue = (String) loginHeaders.get(headerKey); + if (headerKey.equalsIgnoreCase("binding")) { + binding = (String) loginHeaders.get(headerKey); + } + for (int i = 1; i <= 3; i++) { + if (headerKey.equalsIgnoreCase("param" + i)) { + int sep = headerKeyValue.indexOf("="); + if (sep>-1) { + if (sep>0) { + String value = ""; + if (headerKeyValue.length()>sep+1) value = headerKeyValue.substring(sep+1); + if (loginParameters == null) loginParameters = new HashMap(); + loginParameters.put(headerKeyValue.substring(0,sep) , value); + } + } else { + loginParameters.put(headerKey, ""); + } + } + } + } + loginHeaders.remove("binding"); + loginHeaders.remove("param1"); + loginHeaders.remove("param2"); + loginHeaders.remove("param3"); + } } catch (LoginParameterResolverException ex) { throw new ProxyException("proxy.13", new Object[] { publicURLPrefix }); } catch (NotAllowedException e) { @@ -216,7 +244,10 @@ public class ProxyServlet extends HttpServlet { // for stateless online application, store data in HttpSession loginType = oaConf.getLoginType(); - binding = oaConf.getBinding(); + if ("".equalsIgnoreCase(binding)) { + binding = oaConf.getBinding(); + if ("".equalsIgnoreCase(binding)) binding = "full"; + } Logger.debug("Login type: " + loginType); if (loginType.equals(OAConfiguration.LOGINTYPE_STATELESS)) { int sessionTimeOut = oaParam.getSessionTimeOut(); diff --git a/id.server/src/test/abnahme/P/Test100LoginParameterResolver.java b/id.server/src/test/abnahme/P/Test100LoginParameterResolver.java index 3f84603b4..21958a367 100644 --- a/id.server/src/test/abnahme/P/Test100LoginParameterResolver.java +++ b/id.server/src/test/abnahme/P/Test100LoginParameterResolver.java @@ -87,7 +87,7 @@ public class Test100LoginParameterResolver extends AbnahmeTestCase { authData.setBPK(VPK); // resolve login parameters - Map loginParameters = lpr.getAuthenticationParameters(oaConf, authData, CLIENT_IP_ADDRESS, false); + Map loginParameters = lpr.getAuthenticationParameters(oaConf, authData, CLIENT_IP_ADDRESS, false, ""); // validate login headers assertEquals(2, loginParameters.keySet().size()); |