diff options
author | kstranacher <kstranacher@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2011-10-05 08:35:56 +0000 |
---|---|---|
committer | kstranacher <kstranacher@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2011-10-05 08:35:56 +0000 |
commit | ddd1125b3d9570dec334bd2965ec5a9387585906 (patch) | |
tree | 5c87514e6fee20a7949106a0ce15bd33b0be6256 /id/server/idserverlib/src/main | |
parent | 22597803f471751da6ecef1cb66fca8b833a69ec (diff) | |
download | moa-id-spss-ddd1125b3d9570dec334bd2965ec5a9387585906.tar.gz moa-id-spss-ddd1125b3d9570dec334bd2965ec5a9387585906.tar.bz2 moa-id-spss-ddd1125b3d9570dec334bd2965ec5a9387585906.zip |
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1216 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'id/server/idserverlib/src/main')
6 files changed, 56 insertions, 281 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index ba3020958..94fd4f28e 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -461,7 +461,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { String xmlInfoboxReadResponse = (String)infoboxReadResponseParameters.get(PARAM_XMLRESPONSE); - System.out.println("PB: " + xmlInfoboxReadResponse); + //System.out.println("PB: " + xmlInfoboxReadResponse); if (isEmpty(xmlInfoboxReadResponse)) throw new AuthenticationException("auth.10", new Object[] { REQ_VERIFY_IDENTITY_LINK, PARAM_XMLRESPONSE}); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/GetIdentityLinkFormBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/GetIdentityLinkFormBuilder.java index f579790f8..f22db8e39 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/GetIdentityLinkFormBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/GetIdentityLinkFormBuilder.java @@ -102,104 +102,10 @@ public class GetIdentityLinkFormBuilder extends Builder { "</body>" + nl + "</html>"; - /** default HTML template for mandates */ - private static final String DEFAULT_HTML_TEMPLATE_FOR_MANDATES_OLD = - "<html>" + nl + - "<head>" + nl + - "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">" + nl + - "<title>Vollmachten-Anmeldung</title>" + nl + - "<script language=\"javascript\">" + nl + - " function fillFrame() {" + nl + - " var f = top.frames['mandate'];" + nl + - " with (f.document) {" + nl + - " open();" + nl + - " <Mandate>" + nl + - " close();" + nl + - " }" + nl + - " }" + nl + - "</script>" + nl + - "</head>" + nl + - "<body onLoad=\"fillFrame(); return false;\">" + nl + - "<h2>Vollmachten-Anmeldung</h2>" + nl + - "<iframe name=\"mandate\" src=\"\" frameborder=\"0\" width=\"250\" height=\"400\"></iframe>" + nl + - "</body>" + nl + - "</html>"; - /** default HTML template - iFrame */ - private static final String DEFAULT_HTML_TEMPLATE_IFRAME_FOR_MANDATES_OLD = - "<html>" + - "<head>" + - //"<base target=\"_parent\">" + - "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">" + - "<title>Vollmachten-Anmeldung</title>" + - "</head>" + - "<body onLoad=\"document.VollmachtenForm.submit();\">" + - "<form name=\"VollmachtenForm\"" + - " action=\"" + BKU_TAG + "\"" + - " method=\"post\">" + - " <input type=\"hidden\" " + - " name=\"XMLRequest\"" + - " value=\"" + XMLREQUEST_TAG + "\"/>" + - " <input type=\"hidden\" " + - " name=\"DataURL\"" + - " value=\"" + DATAURL_TAG + "\"/>" + - " <input type=\"hidden\" " + - " name=\"PushInfobox\"" + - " value=\"" + PUSHINFOBOX_TAG + "\"/>" + - " <input type=\"submit\" value=\"Starte Signatur\" name=\"Senden\"/>" + - "</form>" + - "<form name=\"CertificateInfoForm\"" + - " action=\"" + BKU_TAG + "\"" + - " method=\"post\">" + - " <input type=\"hidden\" " + - " name=\"XMLRequest\"" + - " value=\"" + CERTINFO_XMLREQUEST_TAG + "\"/>" + - " <input type=\"hidden\" " + - " name=\"DataURL\"" + - " value=\"" + CERTINFO_DATAURL_TAG + "\"/>" + - " <input type=\"hidden\" value=\"Information zu Wurzelzertifikaten\"/>" + - "</form>" + - "</body>" + - "</html>"; - /** default HTML template for Online mandates */ - private static final String DEFAULT_HTML_TEMPLATE_IFRAME_FOR_MANDATES = - "<html>" + - "<head>" + - "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">" + - "<title>Vollmachten-Anmeldung</title>" + - "</head>" + - "<body onLoad=\"document.VollmachtenForm.submit();\">" + - "<form name=\"VollmachtenForm\"" + - " action=\"" + BKU_TAG + "\"" + - " method=\"post\">" + - " <input type=\"hidden\" " + - " name=\"XMLRequest\"" + - " value=\"" + XMLREQUEST_TAG + "\"/>" + - " <input type=\"hidden\" " + - " name=\"DataURL\"" + - " value=\"" + DATAURL_TAG + "\"/>" + - " <input type=\"hidden\" " + - " name=\"PushInfobox\"" + - " value=\"" + PUSHINFOBOX_TAG + "\"/>" + - " <input type=\"submit\" value=\"Starte Signatur\" name=\"Senden\"/>" + - "</form>" + - "<form name=\"CertificateInfoForm\"" + - " action=\"" + BKU_TAG + "\"" + - " method=\"post\">" + - " <input type=\"hidden\" " + - " name=\"XMLRequest\"" + - " value=\"" + CERTINFO_XMLREQUEST_TAG + "\"/>" + - " <input type=\"hidden\" " + - " name=\"DataURL\"" + - " value=\"" + CERTINFO_DATAURL_TAG + "\"/>" + - " <input type=\"hidden\" value=\"Information zu Wurzelzertifikaten\"/>" + - "</form>" + - "</body>" + - "</html>"; - - /** + /** * Constructor for GetIdentityLinkFormBuilder. */ public GetIdentityLinkFormBuilder() { @@ -236,103 +142,7 @@ public class GetIdentityLinkFormBuilder extends Builder { return htmlForm; } - /** - * Builds the HTML form, including XML Request and data URL as parameters. - * - * @param xmlRequest XML Request to be sent as a parameter in the form - * @param bkuURL URL of the "Bürgerkartenumgebung" the form will be submitted to; - * may be <code>null</code>, in this case the default URL will be used - * @param dataURL DataURL to be sent as a parameter in the form - */ - public String buildCreateSignature( - String bkuURL, - String xmlRequest, - String dataURL, - String oaUrl) - throws BuildException - { - String htmlForm = ""; - OAAuthParameter oaParam; - try { - oaParam = AuthConfigurationProvider.getInstance().getOnlineApplicationParameter(oaUrl); - } catch (ConfigurationException e) { - Logger.error("Error on building HTMl form for online mandates: " + e.getMessage()); - throw new BuildException("builder.03", null); - } - - OnlineMandatesTemplates[] templatesOnlineMandates = oaParam.getTemplateOnlineMandates(); - if (templatesOnlineMandates == null) { - // no templates given - htmlForm = DEFAULT_HTML_TEMPLATE_IFRAME_FOR_MANDATES; - htmlForm = replaceTag(htmlForm, BKU_TAG, bkuURL, true, ALL); - htmlForm = replaceTag(htmlForm, XMLREQUEST_TAG, encodeParameter(xmlRequest), true, ALL); - htmlForm = replaceTag(htmlForm, DATAURL_TAG, dataURL, true, ALL); - } else { - String moaidTemplateUrl = null; - String mandateTemplateUrl = null; - // check for configured bku URL - for (int i = 0; i < templatesOnlineMandates.length; i++) { - if (templatesOnlineMandates[i].getBkuURL().compareToIgnoreCase(bkuURL) == 0) { - moaidTemplateUrl = templatesOnlineMandates[i].getMoaIdTemplateURL(); - mandateTemplateUrl = templatesOnlineMandates[i].getMandatesTemplateURL(); - } - } - if (moaidTemplateUrl == null || mandateTemplateUrl == null) { - Logger.debug("Configured and used BKU URL are not equal. So standard template is used."); - htmlForm = DEFAULT_HTML_TEMPLATE_IFRAME_FOR_MANDATES; - htmlForm = replaceTag(htmlForm, BKU_TAG, bkuURL, true, ALL); - htmlForm = replaceTag(htmlForm, XMLREQUEST_TAG, encodeParameter(xmlRequest), true, ALL); - htmlForm = replaceTag(htmlForm, DATAURL_TAG, dataURL, true, ALL); - } else { - // use configured templates - String moaidTemplate; - String mandateTemplate; - try { - moaidTemplate = new String(FileUtils.readURL(moaidTemplateUrl)); - } catch (IOException ex) { - throw new BuildException("auth.03", new Object[] { moaidTemplateUrl, ex.toString()},ex); - } - try { - mandateTemplate = new String(FileUtils.readURL(mandateTemplateUrl)); - } catch (IOException ex) { - throw new BuildException("auth.03", new Object[] { mandateTemplateUrl, ex.toString()},ex); - } - - - // Mandatem template with iFrame - htmlForm = mandateTemplate; - - - // HTML form with XML signature request, which is filled into the iFrame - String htmlFormiFrame = moaidTemplate; - htmlFormiFrame = replaceTag(htmlFormiFrame, BKU_TAG, bkuURL, true, ALL); - htmlFormiFrame = replaceTag(htmlFormiFrame, XMLREQUEST_TAG, encodeParameter(xmlRequest), true, ALL); - htmlFormiFrame = replaceTag(htmlFormiFrame, DATAURL_TAG, dataURL, true, ALL); - htmlFormiFrame = htmlFormiFrame.replaceAll("\"", "\\\""); - htmlFormiFrame = htmlFormiFrame.replaceAll("'", "\\\\'"); - - // add writeln('[data]') for each line in the iframe - BufferedReader reader = new BufferedReader(new StringReader(htmlFormiFrame)); - String str; - String htmlFormiFrameWriteLn = ""; - try { - while ((str = reader.readLine()) != null) { - if (str.length() > 0) - htmlFormiFrameWriteLn += "writeln('" + str + "');"; - } - } catch(IOException e) { - throw new BuildException("builder.03", null); - } - - htmlForm = replaceTag(htmlForm, MANDATE_TAG, htmlFormiFrameWriteLn, true, ALL); - - } - - } - - return htmlForm; - - } + /** * Encodes a string for inclusion as a parameter in the form. diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetMISSessionIDServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetMISSessionIDServlet.java index 5c193aca1..b1ae12084 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetMISSessionIDServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetMISSessionIDServlet.java @@ -176,8 +176,8 @@ public class GetMISSessionIDServlet extends AuthServlet { Logger.debug(createXMLSignatureRequestOrRedirect);
- String request = getHTMLForm(createXMLSignatureRequestOrRedirect, session.getBkuURL(), dataurl, session.getPublicOAURLPrefix());
-
+ //String request = getHTMLForm(createXMLSignatureRequestOrRedirect, session.getBkuURL(), dataurl, session.getPublicOAURLPrefix());
+ String request = null;
resp.setContentType("text/html;charset=UTF-8");
PrintWriter out = new PrintWriter(resp.getOutputStream());
out.print(request);
@@ -200,11 +200,5 @@ public class GetMISSessionIDServlet extends AuthServlet { }
}
- private static String getHTMLForm(String request, String bkuURI, String dataURL, String oaUrl) throws BuildException {
- return new GetIdentityLinkFormBuilder().buildCreateSignature(bkuURI, request, dataURL, oaUrl);
-
- }
-
-
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/VerifyIdentityLinkServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/VerifyIdentityLinkServlet.java index bea81abf3..99ae497ba 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/VerifyIdentityLinkServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/VerifyIdentityLinkServlet.java @@ -171,33 +171,33 @@ public class VerifyIdentityLinkServlet extends AuthServlet { } } - else { - boolean useMandate = session.getUseMandate(); - if (useMandate) { // Mandate modus - // read certificate and set dataurl to VerifyCertificateServlet - - Logger.debug("Send InfoboxReadRequest to BKU to get signer certificate."); - - String infoboxReadRequest = new InfoboxReadRequestBuilderCertificate().build(true); - - // build dataurl - String dataurl = - new DataURLBuilder().buildDataURL( - session.getAuthURL(), - REQ_VERIFY_CERTIFICATE, - session.getSessionID()); - - - //Logger.debug("ContentType set to: application/x-www-form-urlencoded (ServletUtils)"); - //ServletUtils.writeCreateXMLSignatureRequestURLEncoded(resp, session, infoboxReadRequest, AuthenticationServer.REQ_PROCESS_VALIDATOR_INPUT, "VerifyIdentityLink", dataurl); - Logger.debug("ContentType set to: text/xml;charset=UTF-8 (ServletUtils)"); - ServletUtils.writeCreateXMLSignatureRequest(resp, session, infoboxReadRequest, AuthenticationServer.REQ_PROCESS_VALIDATOR_INPUT, "VerifyIdentityLink", dataurl); - - } +// else { +// boolean useMandate = session.getUseMandate(); +// if (useMandate) { // Mandate modus +// // read certificate and set dataurl to VerifyCertificateServlet +// +// Logger.debug("Send InfoboxReadRequest to BKU to get signer certificate."); +// +// String infoboxReadRequest = new InfoboxReadRequestBuilderCertificate().build(true); +// +// // build dataurl +// String dataurl = +// new DataURLBuilder().buildDataURL( +// session.getAuthURL(), +// REQ_VERIFY_CERTIFICATE, +// session.getSessionID()); +// +// +// //Logger.debug("ContentType set to: application/x-www-form-urlencoded (ServletUtils)"); +// //ServletUtils.writeCreateXMLSignatureRequestURLEncoded(resp, session, infoboxReadRequest, AuthenticationServer.REQ_PROCESS_VALIDATOR_INPUT, "VerifyIdentityLink", dataurl); +// Logger.debug("ContentType set to: text/xml;charset=UTF-8 (ServletUtils)"); +// ServletUtils.writeCreateXMLSignatureRequest(resp, session, infoboxReadRequest, AuthenticationServer.REQ_PROCESS_VALIDATOR_INPUT, "VerifyIdentityLink", dataurl); +// +// } else { ServletUtils.writeCreateXMLSignatureRequestOrRedirect(resp, session, createXMLSignatureRequestOrRedirect, AuthenticationServer.REQ_PROCESS_VALIDATOR_INPUT, "VerifyIdentityLink"); } - } +// } } catch (ParseException ex) { diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java index f11938e91..bdd0c3294 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java @@ -490,8 +490,7 @@ public class ConfigurationBuilder { String inputProcessorSignTemplateURL = XPathUtils.getAttributeValue(configElem_, INPUT_PROCESSOR_TEMPLATE_XPATH, null); - OnlineMandatesTemplates[] templatesOnlineMandates = buildTemplateOnlineMandates(configElem_); - + List OA_set = new ArrayList(); NodeList OAIter = XPathUtils.selectNodeList(configElem_, OA_XPATH); @@ -557,10 +556,10 @@ public class ConfigurationBuilder { oap.setProvideStammzahl(BoolUtils.valueOf(authComponent.getAttribute("provideStammzahl"))); oap.setProvideAuthBlock(BoolUtils.valueOf(authComponent.getAttribute("provideAUTHBlock"))); oap.setProvideIdentityLink(BoolUtils.valueOf(authComponent.getAttribute("provideIdentityLink"))); - oap.setProvideCertificate(BoolUtils.valueOf(authComponent.getAttribute("provideCertificate"))); + oap.setProvideCertificate(BoolUtils.valueOf(authComponent.getAttribute("provideCertificate"))); + oap.setProvideFullMandatorData(BoolUtils.valueOf(authComponent.getAttribute("provideFullMandatorData"))); oap.setBkuSelectionTemplateURL(buildTemplateURL(authComponent, OA_AUTH_COMPONENT_BKUSELECT_TEMPLATE_XPATH, bkuSelectionTemplateURL)); - oap.setTemplateURL(buildTemplateURL(authComponent, OA_AUTH_COMPONENT_TEMPLATE_XPATH, templateURL)); - oap.setTemplateOnlineMandates(buildTemplateOnlineMandatesOA(authComponent, templatesOnlineMandates)); + oap.setTemplateURL(buildTemplateURL(authComponent, OA_AUTH_COMPONENT_TEMPLATE_XPATH, templateURL)); oap.setInputProcessorSignTemplateURL(buildTemplateURL(authComponent, INPUT_PROCESSOR_TEMPLATE_XPATH, inputProcessorSignTemplateURL)); // load OA specific transforms if present @@ -618,43 +617,7 @@ public class ConfigurationBuilder { - protected OnlineMandatesTemplates[] buildTemplateOnlineMandates(Node contextNode) { - String xpathExpr = AUTH_TEMPLATE_ONLINEMANDATES_BKU_XPATH; - List onlineMandatesTemplatesList = new ArrayList(); - - NodeIterator bkuIter = XPathUtils.selectNodeIterator(contextNode, xpathExpr); - - Element bkuElem; - while ((bkuElem = (Element) bkuIter.nextNode()) != null) { - String bkuUrl = XPathUtils.getAttributeValue(bkuElem, "@URL", null); - String moaidTemplateUrl = XPathUtils.getAttributeValue(bkuElem, CONF + "MOA-ID-Template/@URL", null); - String mandateTemplateUrl = XPathUtils.getAttributeValue(bkuElem, CONF + "MandateTemplate/@URL", null); - - OnlineMandatesTemplates template = new OnlineMandatesTemplates(); - template.setBkuURL(bkuUrl); - if (moaidTemplateUrl != null) { - moaidTemplateUrl = FileUtils.makeAbsoluteURL(moaidTemplateUrl, rootConfigFileDir_); - } - if (moaidTemplateUrl != null) { - mandateTemplateUrl = FileUtils.makeAbsoluteURL(mandateTemplateUrl, rootConfigFileDir_); - } - template.setMoaIdTemplateURL(moaidTemplateUrl); - template.setMandatesTemplateURL(mandateTemplateUrl); - - onlineMandatesTemplatesList.add(template); - - } - - if (onlineMandatesTemplatesList.isEmpty()) - return null; - - OnlineMandatesTemplates[] onlinemandatesTemplates = new OnlineMandatesTemplates[onlineMandatesTemplatesList.size()]; - onlineMandatesTemplatesList.toArray(onlinemandatesTemplates); - - return onlinemandatesTemplates; - - } - + protected OnlineMandatesTemplates[] buildTemplateOnlineMandatesOA(Node contextNode, OnlineMandatesTemplates[] defaultTemplatesOnlineMandates) { String xpathExpr = OA_AUTH_COMPONENT_TEMPLATE_ONLINEMANDATES_BKU_XPATH; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java index a48923b07..1e169aef3 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java @@ -82,6 +82,10 @@ public class OAAuthParameter extends OAParameter { */ private boolean provideCertificate; /** + * determines whether the full mandator data (i.e. the mandate) is to be included in the authentication data + */ + private boolean provideFullMandatorData; + /** * url to a template for web page "Auswahl der Bürgerkartenumgebung" */ private String bkuSelectionTemplateURL; @@ -90,7 +94,6 @@ public class OAAuthParameter extends OAParameter { */ private String templateURL; - private OnlineMandatesTemplates[] templateOnlineMandates; /** * template for web page "Signatur der Anmeldedaten" */ @@ -179,6 +182,16 @@ public class OAAuthParameter extends OAParameter { return provideCertificate; } + /** + * Returns <code>true</code> if the full mandator data should be provided within the + * authentication data, otherwise <code>false</code>. + * @return <code>true</code> if the full mandator data should be provided, + * otherwise <code>false</code> + */ + public boolean getProvideFullMandatorData() { + return provideFullMandatorData; + } + /** * Returns the key box identifier. @@ -252,20 +265,7 @@ public class OAAuthParameter extends OAParameter { public void setTransformsInfos(String[] transformsInfos) { this.transformsInfos = transformsInfos; } - /** - * @return the templateOnlineMandates - */ -public OnlineMandatesTemplates[] getTemplateOnlineMandates() { - return templateOnlineMandates; -} -/** - * @param templateOnlineMandates the templateOnlineMandates to set - */ -public void setTemplateOnlineMandates( - OnlineMandatesTemplates[] templateOnlineMandates) { - this.templateOnlineMandates = templateOnlineMandates; -} /** * Sets the provideAuthBlock. @@ -298,6 +298,14 @@ public void setTemplateOnlineMandates( public void setProvideCertificate(boolean provideCertificate) { this.provideCertificate = provideCertificate; } + + /** + * Sets the provideFullMandatorData variable. + * @param provideFullMandatorData The provideFullMandatorData value to set + */ + public void setProvideFullMandatorData(boolean provideFullMandatorData) { + this.provideFullMandatorData = provideFullMandatorData; + } /** * Sets the key box identifier. |