From 5812d840b420697b6821080a7cbb0f3c792fc1ac Mon Sep 17 00:00:00 2001 From: tknall Date: Thu, 19 Mar 2009 17:33:16 +0000 Subject: Build script for command line version updated. JavaDoc fixes. Some updates for debugging messages. Parser for MOCCA-CreateXMLSignatureResponses enhanced. Many updates and fixes for the external web app interface. New profile for invisible signatures added. git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@333 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../at/gv/egiz/pdfas/api/verify/VerifyResult.java | 6 +++--- .../at/gv/egiz/pdfas/impl/api/CheckHelper.java | 2 +- .../egiz/pdfas/web/helper/SignServletHelper.java | 23 +++++++++++++++++----- 3 files changed, 22 insertions(+), 9 deletions(-) (limited to 'src/main/java/at/gv') diff --git a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java b/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java index fa0e683..3886569 100644 --- a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java +++ b/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java @@ -96,11 +96,11 @@ public interface VerifyResult extends SignatureInformation public Date getVerificationTime(); /** - * Returns the hash input data as returned by MOA. + * Returns the hash input data as returned by MOA as Base64-encoded String. * *

* This will only return a value other than null if the corresponding - * VerifyParameter was set to true. + * {@link VerifyParameters} has been set to true. *

*

* Note that the HashInputData does not necessarily have to be exactly the @@ -108,7 +108,7 @@ public interface VerifyResult extends SignatureInformation * {@link SignatureInformation#getSignedData()} method. *

* - * @return Returns the hash input data as returned by MOA. + * @return Returns the base64 encoded hash input data as returned by MOA. * * @see SignatureInformation#getSignedData() */ diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/CheckHelper.java b/src/main/java/at/gv/egiz/pdfas/impl/api/CheckHelper.java index 4466d8b..0c2d7ca 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/api/CheckHelper.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/api/CheckHelper.java @@ -159,7 +159,7 @@ public final class CheckHelper { if (!SignatureTypes.getInstance().getSignatureTypes().contains(profileId)) { - throw new IllegalArgumentException("The profileId must be defined in the configuration file. " + profileId); + throw new IllegalArgumentException("The profileId \"" + profileId + "\" must be defined in the configuration file."); } } catch (SignatureTypesException e) diff --git a/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java b/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java index 113169c..1e1864b 100644 --- a/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java +++ b/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java @@ -219,6 +219,7 @@ public class SignServletHelper ByteArrayDataSink bads = (ByteArrayDataSink)si.output; signed_pdf = bads.getByteArray(); } + HttpSession session = request.getSession(); PDFContainer entry = new PDFContainer(signed_pdf, si.exappinf.pdf_id); ProvidePDFServlet.signedDocuments.add(entry); @@ -244,23 +245,28 @@ public class SignServletHelper String query = invoke_url.substring(0, ind) + ";jsessionid=" + session_id + invoke_url.substring(ind) + sep + FormFields.FIELD_PDF_URL + "=" + providePDFServlet + "&" + FormFields.FIELD_PDF_ID - + "=" + pdf_id + "&" + FormFields.FIELD_FILE_LENGTH + "=" + signed_pdf.length; + + "=" + pdf_id + "&" + FormFields.FIELD_FILE_LENGTH + "=" + signed_pdf.length + + "&" + FormFields.FIELD_PDFAS_SESSION_ID + "=" + session.getId(); /* * Using the external web-interface of pdf-as (as described above) pdf-as should be run within * an iframe. In case of a signature performed with a local citizen card software or with the - * server bku the result has to be provided outside an iframe. To break out of the iframe a + * server bku the result has to be provided outside the iframe. To break out of the iframe a * helper jsp (redirect_to_parent) has to be used that redirects the user to the parent * window. */ + disableBrowserCacheForResponse(response); if (Constants.SIGNATURE_DEVICE_BKU.equals(si.connector) || Constants.SIGNATURE_DEVICE_MOC.equals(si.connector)) { - HttpSession session = request.getSession(); - log.debug("Local bku was used therefore pdf-as is supposed to run within an iframe."); + log.debug("Pdf-as is supposed to run within an iframe."); log.debug("Putting external application notify url (\"" + query + "\") in session (" + session.getId() + ") for later use."); - request.getSession().setAttribute(SessionAttributes.PARENT_WEBAPP_REDIRECT_URL, query); + session.setAttribute(SessionAttributes.PARENT_WEBAPP_REDIRECT_URL, query); String redirectHelper = response.encodeRedirectURL(request.getContextPath() + "/jsp/redirect_to_parent.jsp"); + log.debug("Redirecting to " + redirectHelper); + log.debug("The browser will finally be redirected outside the iframe to " + query + " in order to notify the external application."); + response.sendRedirect(redirectHelper); + } else { log.debug("Notifying external application by redirecting to \"" + query + "\"."); response.sendRedirect(query); @@ -270,6 +276,13 @@ public class SignServletHelper } + public static void disableBrowserCacheForResponse(HttpServletResponse response) { + log.debug("Disabling browser cache for HttpServletResponse."); + response.setHeader("Cache-Control", "no-cache"); + response.setHeader("Pragma","no-cache"); + response.setDateHeader("Expires", -1); + } + /** * Formats the file name according to the SignResult. * -- cgit v1.2.3