diff options
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/GetIdentityLinkFormBuilder.java')
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/GetIdentityLinkFormBuilder.java | 194 |
1 files changed, 2 insertions, 192 deletions
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. |