From 1eca0bcc65e92cef6cb142be30a0273ac18481a4 Mon Sep 17 00:00:00 2001 From: ferbas Date: Tue, 5 Jan 2010 14:42:05 +0000 Subject: embed verify url for handler git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@534 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../wag/egov/egiz/pdf/AdobeSignatureHelper.java | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java index 1ce0b6f..db5b082 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java @@ -3,13 +3,9 @@ package at.knowcenter.wag.egov.egiz.pdf; import java.util.HashMap; import java.util.Iterator; -import javax.xml.datatype.DatatypeFactory; -import javax.xml.datatype.XMLGregorianCalendar; - import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import at.gv.egiz.pdfas.api.commons.Constants; import at.gv.egiz.pdfas.exceptions.ErrorCode; import at.gv.egiz.pdfas.framework.signator.SignatorInformation; import at.gv.egiz.pdfas.utils.OgnlUtil; @@ -20,7 +16,6 @@ import at.knowcenter.wag.egov.egiz.sig.SignatureObject; import com.lowagie.text.Rectangle; import com.lowagie.text.pdf.AcroFields; -import com.lowagie.text.pdf.PdfDate; import com.lowagie.text.pdf.PdfDictionary; import com.lowagie.text.pdf.PdfName; import com.lowagie.text.pdf.PdfObject; @@ -48,6 +43,8 @@ public class AdobeSignatureHelper { public static final String ADOBE_SIG_TEXT_KEY = "adobeSignText"; + private static final String ADOBE_VERIFY_URL_KEY = "verifyURL"; + /** * Writes Adobe-pdf signature entry with itext * @@ -62,9 +59,10 @@ public class AdobeSignatureHelper { try { logger.debug("Creating adobe signature field."); - PdfSignatureAppearance sap = stamper.getSignatureAppearance(); + PdfSignatureAppearance sap = stamper.getSignatureAppearance(); - String fieldName = getAdobeFieldName(so.getSignatureTypeDefinition().getType()); + String profileId = so.getSignatureTypeDefinition().getType(); + String fieldName = getAdobeFieldName(profileId); // find field num /* int nexSigNum = 1; @@ -106,16 +104,16 @@ public class AdobeSignatureHelper { subfilter = so.getKZ().toString(); } else if (si != null) { subfilter = si.getSignSignatureObject().kz; - } + } PdfSignature sig = new PdfSignature(new PdfName(ADOBE_SIG_FILTER), new PdfName(subfilter)); // the following fields are not shown by the reader, because its is no // Standard filter // sig.setLocation("location is not visible"); // sig.setReason("reason is not visible"); - // sig.setContact("contact is not visible"); + sig.setContact(getVerifyUrl(profileId)); // sig.setDate(new PdfDate()); - String reason = getAdobeReasonName(so.getSignatureTypeDefinition().getType()); + String reason = getAdobeReasonName(profileId); if (!StringUtils.isEmpty(reason)) { sig.setReason(reason); } @@ -129,7 +127,7 @@ public class AdobeSignatureHelper { } */ - sig.setName(getAdobeSignText(so.getSignatureTypeDefinition().getType(), si)); + sig.setName(getAdobeSignText(profileId, si)); sap.setCryptoDictionary(sig); // content element is mandatory but empty @@ -171,6 +169,10 @@ public class AdobeSignatureHelper { return getDefaultableConfigProperty(sigProfile, ADOBE_SIGN_REASONNAME_KEY, null); } + private static String getVerifyUrl(String sigProfile) { + return getDefaultableConfigProperty(sigProfile, ADOBE_VERIFY_URL_KEY, "https://www.buergerkarte.at/signature-verification"); + } + private static String getDefaultableConfigProperty(String sigProfile, String propName, String defaultValue) { String confVal; try { -- cgit v1.2.3