From c4efec1daeb50b30d363bb9fb83aec5435dbf2ad Mon Sep 17 00:00:00 2001 From: tknall Date: Mon, 27 Apr 2009 08:16:42 +0000 Subject: New signature layout for new MOCCA bku integrated (etsi-moc-1.1). New architecture implemented that allows different signature layouts for single types of BKUs. git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@337 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../wag/egov/egiz/web/servlets/DataURLServlet.java | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/web/servlets') diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java index 7947d90..7cf762e 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java @@ -42,13 +42,17 @@ import at.knowcenter.wag.egov.egiz.PdfASID; import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException; import at.knowcenter.wag.egov.egiz.exceptions.InvalidIDException; import at.knowcenter.wag.egov.egiz.exceptions.PresentableException; +import at.knowcenter.wag.egov.egiz.exceptions.SettingsException; import at.knowcenter.wag.egov.egiz.exceptions.SignatorFactoryException; import at.knowcenter.wag.egov.egiz.exceptions.SignatureException; import at.knowcenter.wag.egov.egiz.pdf.SignatureHolder; import at.knowcenter.wag.egov.egiz.sig.SignatureResponse; import at.knowcenter.wag.egov.egiz.sig.connectors.ConnectorChooser; import at.knowcenter.wag.egov.egiz.sig.connectors.LocalConnector; +import at.knowcenter.wag.egov.egiz.sig.connectors.bku.BKUHelper; import at.knowcenter.wag.egov.egiz.sig.connectors.bku.BKUPostConnection; +import at.knowcenter.wag.egov.egiz.sig.signaturelayout.SignatureLayoutHandler; +import at.knowcenter.wag.egov.egiz.sig.signaturelayout.SignatureLayoutHandlerFactory; import at.knowcenter.wag.egov.egiz.web.FormFields; import at.knowcenter.wag.egov.egiz.web.LocalRequest; import at.knowcenter.wag.egov.egiz.web.LocalRequestHelper; @@ -200,7 +204,17 @@ public class DataURLServlet extends HttpServlet log.trace("processSign"); String xml_response = retrieveXMLResponse(request); + Properties response_properties = BKUHelper.getBKUProperties(request); + String bkuIdentifier = BKUHelper.getBKUIdentifier(response_properties); + log.debug("BKU identifier: \"" + bkuIdentifier + "\""); + + try { + SignatureLayoutHandlerFactory.verifyBKUSupport(bkuIdentifier); + } catch (SettingsException e) { + throw new ConnectorException(e.getErrorCode(), e.getMessage()); + } + if (isNullResponse(xml_response)) { log.debug("Received a NullOperationResponse -> answering with the first request."); //$NON-NLS-1$ @@ -210,12 +224,6 @@ public class DataURLServlet extends HttpServlet log.debug("There are still requests to be performed -> answering with request."); //$NON-NLS-1$ - // TODO[tknall] Parse user agent's cce type and version in order to prevent unsupported cces from signing pdfs - // http://www.buergerkarte.at/konzept/securitylayer/spezifikation/aktuell/bindings/bindings.html#http.kodierung.response.dataurl - log.debug("BKU response header \"user-agent\" header: " + request.getHeader("User-Agent")); - // http://www.buergerkarte.at/konzept/securitylayer/spezifikation/aktuell/bindings/bindings.html#http.kodierung.response.browser - log.debug("BKU response header \"server\" header: " + request.getHeader("Server")); - LocalRequest local_request = si.localRequest; String request_string = local_request.getRequestString(); @@ -229,16 +237,8 @@ public class DataURLServlet extends HttpServlet { log.debug("Received a normal response -> storing the response."); //$NON-NLS-1$ - Properties response_properties = new Properties(); response_properties.setProperty(BKUPostConnection.RESPONSE_STRING_KEY, xml_response); - String userAgent = request.getHeader("User-Agent"); - if (userAgent != null) { - response_properties.setProperty(BKUPostConnection.BKU_USER_AGENT_HEADER_KEY, userAgent); - } else { - log.warn("BKU request/response header \"User-Agent\" is empty."); - } - si.response_properties = response_properties; log.debug("All requests have been processed -> processing the responses."); //$NON-NLS-1$ -- cgit v1.2.3