aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java6
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilder.java7
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/CreateXMLSignatureRequestBuilder.java54
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/GetIdentityLinkFormBuilder.java235
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/SAMLArtifactBuilder.java9
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java7
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GetMISSessionIDServlet.java10
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/VerifyAuthenticationBlockServlet.java5
8 files changed, 258 insertions, 75 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 a772e0457..af7841321 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
@@ -291,6 +291,7 @@ public class AuthenticationServer implements MOAIDAuthConstants {
* may be <code>null</code>; in this case, the default location will be used
* @param useMandate Indicates if mandate is used or not
* @param templateURL URL providing an HTML template for the HTML form generated
+ * @param templateMandteURL URL providing an HTML template for the HTML form generated (for signing in mandates mode)
* @param scheme determines the protocol used
* @return HTML form
* @throws AuthenticationException
@@ -391,6 +392,8 @@ public class AuthenticationServer implements MOAIDAuthConstants {
ex);
}
}
+
+
String pushInfobox = "";
VerifyInfoboxParameters verifyInfoboxParameters = oaParam.getVerifyInfoboxParameters();
if (verifyInfoboxParameters != null) {
@@ -887,6 +890,8 @@ public class AuthenticationServer implements MOAIDAuthConstants {
session.setExtendedSAMLAttributesAUTH(new Vector()); // Initialize SAML Attributes
session.setExtendedSAMLAttributesOA(new Vector());
+ //System.out.println("SAML set: " + session.getExtendedSAMLAttributesAUTH().size());
+
if (verifyInfoboxParameters != null) {
infoboxParameters = verifyInfoboxParameters.getInfoboxParameters();
@@ -1720,6 +1725,7 @@ public class AuthenticationServer implements MOAIDAuthConstants {
}
AuthenticationData authData = null;
synchronized (authenticationDataStore) {
+ System.out.println("assertionHandle: " + assertionHandle);
authData = (AuthenticationData) authenticationDataStore.get(assertionHandle);
if (authData == null) {
Logger.error("Assertion not found for SAML Artifact: " + samlArtifact);
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilder.java
index bab387b4a..d105c3206 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilder.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilder.java
@@ -190,9 +190,12 @@ public class AuthenticationBlockAssertionBuilder extends AuthenticationAssertion
}
ExtendedSAMLAttribute bpkAttribute =
new ExtendedSAMLAttributeImpl("bPK", bpkSamlValueElement, Constants.MOA_NS_URI, ExtendedSAMLAttribute.ADD_TO_AUTHBLOCK_ONLY);
-
+
+ System.out.println("extendedSAMLAttributes: " + extendedSAMLAttributes.size());
+
extendedSAMLAttributes.add(bpkAttribute);
- //gebeORwbpk = gebeORwbpk + MessageFormat.format(BPK_ATTRIBUTE, new Object[] { identityLinkValue, identityLinkType });
+
+ //gebeORwbpk = gebeORwbpk + MessageFormat.format(BPK_ATTRIBUTE, new Object[] { identityLinkValue, identityLinkType });
wbpkNSDeclaration = " xmlns:pr=\"" + PD_NS_URI + "\"";
//..BZ
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/CreateXMLSignatureRequestBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/CreateXMLSignatureRequestBuilder.java
index c61e2dd84..4d29c9135 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/CreateXMLSignatureRequestBuilder.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/CreateXMLSignatureRequestBuilder.java
@@ -152,8 +152,8 @@ public class CreateXMLSignatureRequestBuilder implements Constants {
// request += "</style>";
request += "</head>";
request += "<body>";
- request += "<h4 class=\"h4style\">Authentication Data:</h4>";
- request += "<p class=\"titlestyle\">Personal Data</p>";
+ request += "<h4 class=\"h4style\">Anmeldedaten für (Requesting Application Access for):</h4>";
+ request += "<p class=\"titlestyle\">Persönliche Daten (Personal Data)</p>";
request += "<table class=\"parameters\">";
request += "<tr>";
request += "<td class=\"italicstyle\">Name:</td>";
@@ -162,21 +162,21 @@ public class CreateXMLSignatureRequestBuilder implements Constants {
request += "</td>";
request += "</tr>";
request += "</table>";
- request += "<p class=\"titlestyle\">Application Data</p>";
+ request += "<p class=\"titlestyle\">Daten zur Anwendung (Application Data)</p>";
request += "<table class=\"parameters\">";
request += "<tr>";
- request += "<td class=\"italicstyle\">Name:</td>";
+ request += "<td class=\"italicstyle\">Dienst (Service):</td>";
request += "<td class=\"normalstyle\">";
// friendlyname from OA
request += StringUtils.isEmpty(oaParam.getFriendlyName()) ? "" : oaParam.getFriendlyName();
request += "</td>";
request += "</tr>";
request += "<tr>";
- request += "<td class=\"italicstyle\">Country:</td>";
- request += "<td class=\"normalstyle\">Austria</td>";
+ request += "<td class=\"italicstyle\">Land (Country):</td>";
+ request += "<td class=\"normalstyle\">Österreich (Austria)</td>";
request += "</tr>";
request += "</table>";
- request += "<p class=\"titlestyle\">Technical Parameters</p>";
+ request += "<p class=\"titlestyle\">Technische Parameter (Technical Parameters)</p>";
request += "<table class=\"parameters\">";
request += "<tr>";
request += "<td class=\"italicstyle\">URL:</td>";
@@ -203,7 +203,7 @@ public class CreateXMLSignatureRequestBuilder implements Constants {
// OA is publicservice
request += "<tr>";
request += "<td class=\"italicstyle\">";
- request += "Sector:</td>";
+ request += "Sektor (Sector):</td>";
request += "<td class=\"normalstyle\">";
request += target + " (" + sectorName + ")";
request += "</td>";
@@ -212,27 +212,45 @@ public class CreateXMLSignatureRequestBuilder implements Constants {
}
request += "<tr>";
- request += "<td class=\"italicstyle\">Date:</td>";
+ request += "<td class=\"italicstyle\">Datum (Date):</td>";
request += "<td class=\"normalstyle\">";
request += date;
request += "</td>";
request += "</tr>";
request += "<tr>";
- request += "<td class=\"italicstyle\">Time:</td>";
+ request += "<td class=\"italicstyle\">Zeit (Time):</td>";
request += "<td class=\"normalstyle\">";
request += time;
request += "</td>";
request += "</tr>";
request += "</table>";
- request += "<p class=\"normalstyle\">I hereby request to access this e-government application by using my " +
- "domestic electronic identity. <br/>" +
- "I further affirm that I am not yet registered with the Austrian Central " +
- "Residents Registry and that I am not obliged to register with the Austrian " +
- "Central Residents Registry according to Austrian law.<br/>" +
- "In the event I am not yet registered with the Supplementary Register, I " +
- "explicitly grant to do so according to §6 (5) E-Government Act (EGovG, idF: " +
- "BGBl. I Nr. 7/2008 und BGBl. I Nr. 59/2008).</p>";
+ request += "<p class=\"normalstyle\">Mit der Anmeldung erfolgt eine Abfrage des Ergänzungsregister für " +
+ "natürliche Personen (ERnP), damit ich meinen elektronischen " +
+ "Identitätsnachweis (meine elektronische Identitätskarte) unmittelbar " +
+ "als Österreichische Bürgerkarte verwenden kann. Ich bin nicht im " +
+ "Zentralen Melderegister eingetragen und stimme, sofern ich nicht im " +
+ "ERnP eingetragen bin, einer Eintragung ins ERnP zu. Ich nehme zur " +
+ "Kenntnis, dass die Eintragung ins ERnP ausschließlich der Aufzeichnung " +
+ "jener Daten, die für die eindeutige Identität notwendig sind, dient.</p>";
+
+ request += "<p class=\"normalstyle\">I affirm that I am not registered with the Austrian Central " +
+ "Register of Residents or the Supplementary Register for Natural Persons. I therefore " +
+ "apply for registration in the Supplementary Register for Natural Persons in order to use " +
+ "my electronic identity (my electronic ID card) as an Austrian citizen card. I take note " +
+ "that registration in the Supplementary Register for Natural Persons solely serves keeping " +
+ "records of those data that are used for validation of unique identity and that those data " +
+ "is only used for e-government purposes.</p>";
+
+
+// request += "<p class=\"normalstyle\">I hereby request to access this e-government application by using my " +
+// "domestic electronic identity. <br/>" +
+// "I further affirm that I am not yet registered with the Austrian Central " +
+// "Residents Registry and that I am not obliged to register with the Austrian " +
+// "Central Residents Registry according to Austrian law.<br/>" +
+// "In the event I am not yet registered with the Supplementary Register, I " +
+// "explicitly grant to do so according to §6 (5) E-Government Act (EGovG, idF: " +
+// "BGBl. I Nr. 7/2008 und BGBl. I Nr. 59/2008).</p>";
request += "</body>";
request += "</html>";
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 9bab8643f..dcaed084a 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
@@ -15,11 +15,19 @@
*/
package at.gv.egovernment.moa.id.auth.builder;
+import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
+import at.gv.egovernment.moa.id.AuthenticationException;
import at.gv.egovernment.moa.id.BuildException;
+import at.gv.egovernment.moa.id.config.ConfigurationException;
+import at.gv.egovernment.moa.id.config.OnlineMandatesTemplates;
+import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider;
+import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;
+import at.gv.egovernment.moa.logging.Logger;
+import at.gv.egovernment.moa.util.FileUtils;
/**
* Builder for HTML form requesting the security layer implementation
@@ -43,6 +51,8 @@ public class GetIdentityLinkFormBuilder extends Builder {
private static final String CERTINFO_DATAURL_TAG = "<CertInfoDataURL>";
/** special tag in the HTML template to be substituted for the infoboxes to be pushed from the BKU */
private static final String PUSHINFOBOX_TAG = "<PushInfobox>";
+ /** special tag in the HTML template to be substituted for the BKU URL */
+ private static final String MANDATE_TAG = "<Mandate>";
/** private static int all contains the representation to replace all tags*/
private static final int ALL = -1;
@@ -83,48 +93,101 @@ public class GetIdentityLinkFormBuilder extends Builder {
"</body>" + nl +
"</html>";
- /** default HTML template */
- private static final String DEFAULT_HTML_TEMPLATE_FOR_MANDATES =
+ /** 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 +
+ "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">" + nl +
"<title>Vollmachten-Anmeldung</title>" + nl +
- "<script type=\"text/javascript\">" + nl +
- "window.onload=function() {" + nl +
- "document.VollmachtenForm.submit();" + nl +
- "document.VollmachtenForm.Senden.disabled=true;" + nl +
- "return;" + nl +
- "}" + nl +
- "</script>" + nl +
- "</head>" + nl +
- "<body>" + nl +
- "<form name=\"VollmachtenForm\"" + nl +
- " action=\"" + BKU_TAG + "\"" + nl +
- " method=\"post\">" + nl +
- " <input type=\"hidden\" " + nl +
- " name=\"XMLRequest\"" + nl +
- " value=\"" + XMLREQUEST_TAG + "\"/>" + nl +
- " <input type=\"hidden\" " + nl +
- " name=\"DataURL\"" + nl +
- " value=\"" + DATAURL_TAG + "\"/>" + nl +
- " <input type=\"hidden\" " + nl +
- " name=\"PushInfobox\"" + nl +
- " value=\"" + PUSHINFOBOX_TAG + "\"/>" + nl +
- " <input type=\"submit\" value=\"Starte Signatur\" name=\"Senden\"/>" + nl +
- "</form>" + nl +
- "<form name=\"CertificateInfoForm\"" + nl +
- " action=\"" + BKU_TAG + "\"" + nl +
- " method=\"post\">" + nl +
- " <input type=\"hidden\" " + nl +
- " name=\"XMLRequest\"" + nl +
- " value=\"" + CERTINFO_XMLREQUEST_TAG + "\"/>" + nl +
- " <input type=\"hidden\" " + nl +
- " name=\"DataURL\"" + nl +
- " value=\"" + CERTINFO_DATAURL_TAG + "\"/>" + nl +
-// " <input type=\"submit\" value=\"Information zu Wurzelzertifikaten\"/>" + nl +
- " <input type=\"hidden\" value=\"Information zu Wurzelzertifikaten\"/>" + nl +
- "</form>" + nl +
- "</body>" + 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>";
/**
@@ -167,25 +230,101 @@ public class GetIdentityLinkFormBuilder extends Builder {
/**
* Builds the HTML form, including XML Request and data URL as parameters.
*
- * @param htmlTemplate template to be used for the HTML form;
- * may be <code>null</code>, in this case a default layout will be produced
* @param xmlRequest XML Request to be sent as a parameter in the form
* @param bkuURL URL of the "B&uuml;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 bkuURL,
String xmlRequest,
- String dataURL)
+ String dataURL,
+ String oaUrl)
throws BuildException
{
- String htmlForm = DEFAULT_HTML_TEMPLATE_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);
- return htmlForm;
+ 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.
* Double quotes are substituted by <code>"&amp;quot;"</code>.
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/SAMLArtifactBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/SAMLArtifactBuilder.java
index f0e9c7484..c94eb0b25 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/SAMLArtifactBuilder.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/SAMLArtifactBuilder.java
@@ -64,6 +64,10 @@ public class SAMLArtifactBuilder {
byte[] sourceID;
// alternative sourceId
String alternativeSourceID = AuthConfigurationProvider.getInstance().getGenericConfigurationParameter(GENERIC_CONFIG_PARAM_SOURCEID);
+
+ System.out.println("alternativeSourceID: " + alternativeSourceID);
+ System.out.println("authURL: " + authURL);
+
if (!ParepUtils.isEmpty(alternativeSourceID)) {
// if generic config parameter "AuthenticationServer.SourceID" is given, use that sourceID instead of authURL;
sourceID = md.digest(alternativeSourceID.getBytes());
@@ -71,6 +75,9 @@ public class SAMLArtifactBuilder {
} else {
sourceID = md.digest(authURL.getBytes());
}
+
+ System.out.println("sourceID: " + new String(sourceID));
+
byte[] assertionHandle = md.digest(sessionID.getBytes());
ByteArrayOutputStream out = new ByteArrayOutputStream(42);
out.write(0);
@@ -78,7 +85,9 @@ public class SAMLArtifactBuilder {
out.write(sourceID, 0, 20);
out.write(assertionHandle, 0, 20);
byte[] samlArtifact = out.toByteArray();
+ System.out.println("samlArtifact: " + new String(samlArtifact));
String samlArtifactBase64 = Base64Utils.encode(samlArtifact);
+ System.out.println("samlArtifact Base64: " + samlArtifactBase64);
return samlArtifactBase64;
}
catch (Throwable ex) {
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java
index 554b5012e..3d040d476 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java
@@ -64,6 +64,7 @@ public class AuthenticationSession {
* HTML template URL
*/
private String templateURL;
+
/**
* URL of the BKU
*/
@@ -363,14 +364,16 @@ public class AuthenticationSession {
public String getTemplateURL() {
return templateURL;
}
-
+
+
/**
* @param string the template URL
*/
public void setTemplateURL(String string) {
templateURL = string;
}
-
+
+
/**
* Returns the SAML Attributes to be appended to the AUTHBlock. Maybe <code>null</code>.
*
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 4c0abdb0f..0270eb3cb 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
@@ -16,6 +16,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.lang.StringEscapeUtils;
+import at.gv.egovernment.moa.id.AuthenticationException;
import at.gv.egovernment.moa.id.BuildException;
import at.gv.egovernment.moa.id.MOAIDException;
import at.gv.egovernment.moa.id.auth.AuthenticationServer;
@@ -32,6 +33,7 @@ import at.gv.egovernment.moa.id.util.client.mis.simple.MISMandate;
import at.gv.egovernment.moa.id.util.client.mis.simple.MISSimpleClient;
import at.gv.egovernment.moa.id.util.client.mis.simple.MISSimpleClientException;
import at.gv.egovernment.moa.logging.Logger;
+import at.gv.egovernment.moa.util.FileUtils;
/**
* Servlet requested for getting the foreign eID
@@ -143,8 +145,8 @@ public class GetMISSessionIDServlet extends AuthServlet {
session.getSessionID());
Logger.debug(createXMLSignatureRequestOrRedirect);
-
- String request = getHTMLForm(createXMLSignatureRequestOrRedirect, session.getBkuURL(), dataurl);
+
+ String request = getHTMLForm(createXMLSignatureRequestOrRedirect, session.getBkuURL(), dataurl, session.getPublicOAURLPrefix());
resp.setContentType("text/html;charset=UTF-8");
PrintWriter out = new PrintWriter(resp.getOutputStream());
@@ -164,8 +166,8 @@ public class GetMISSessionIDServlet extends AuthServlet {
}
}
- private static String getHTMLForm(String request, String bkuURI, String dataURL) throws BuildException {
- return new GetIdentityLinkFormBuilder().buildCreateSignature(bkuURI, request, dataURL);
+ 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/VerifyAuthenticationBlockServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/VerifyAuthenticationBlockServlet.java
index f1fb15be0..44a1f3098 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/VerifyAuthenticationBlockServlet.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/VerifyAuthenticationBlockServlet.java
@@ -102,6 +102,7 @@ public class VerifyAuthenticationBlockServlet extends AuthServlet {
resp.setHeader(MOAIDAuthConstants.HEADER_PRAGMA,MOAIDAuthConstants.HEADER_VALUE_PRAGMA);
resp.setHeader(MOAIDAuthConstants.HEADER_CACHE_CONTROL,MOAIDAuthConstants.HEADER_VALUE_CACHE_CONTROL);
resp.addHeader(MOAIDAuthConstants.HEADER_CACHE_CONTROL,MOAIDAuthConstants.HEADER_VALUE_CACHE_CONTROL_IE);
+
Map parameters;
try
@@ -142,8 +143,10 @@ public class VerifyAuthenticationBlockServlet extends AuthServlet {
}
resp.setContentType("text/html");
resp.setStatus(302);
- resp.addHeader("Location", redirectURL);
+
+ resp.addHeader("Location", redirectURL);
Logger.debug("REDIRECT TO: " + redirectURL);
+
}
catch (MOAIDException ex) {