aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets
diff options
context:
space:
mode:
authorAlexander Marsalek <amarsalek@iaik.tugraz.at>2021-04-12 15:58:14 +0200
committerAlexander Marsalek <amarsalek@iaik.tugraz.at>2021-04-12 15:58:14 +0200
commitc0f97e7b1ad5b6256eb935aeab06d159d68d1966 (patch)
treee014d891f58b87a5ca7dbb5c63e6334d9385c266 /pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets
parentbc6073700024e4b3c95bcf5bf3e48efb6edd14ab (diff)
downloadpdf-as-4-c0f97e7b1ad5b6256eb935aeab06d159d68d1966.tar.gz
pdf-as-4-c0f97e7b1ad5b6256eb935aeab06d159d68d1966.tar.bz2
pdf-as-4-c0f97e7b1ad5b6256eb935aeab06d159d68d1966.zip
pdf-as-web signature block parameter handling
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java19
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/JSONAPIServlet.java14
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java4
3 files changed, 21 insertions, 16 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java
index 2c2af9a9..841b8428 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java
@@ -27,7 +27,6 @@ import at.gv.egiz.pdfas.common.exceptions.PDFASError;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
import at.gv.egiz.pdfas.common.exceptions.PdfAsSettingsValidationException;
import at.gv.egiz.pdfas.common.settings.ISettings;
-import at.gv.egiz.pdfas.common.utils.StringUtils;
import at.gv.egiz.pdfas.lib.api.IConfigurationConstants;
import at.gv.egiz.pdfas.lib.api.PdfAsFactory;
import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter.SignatureVerificationLevel;
@@ -57,6 +56,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.List;
+import java.util.Map;
/**
* Servlet implementation class Sign
@@ -366,7 +366,11 @@ public class ExternSignServlet extends HttpServlet {
PdfAsHelper.setSignatureDataHash(request, pdfDataHash);
logger.debug("Storing signatures data hash: " + pdfDataHash);
-
+
+ //TODO alex parse??
+ Map<String, String> dynamicSignatureBlockArguments = null;
+
+
logger.debug("Starting signature creation with: " + connector);
//IPlainSigner signer;
@@ -396,11 +400,12 @@ public class ExternSignServlet extends HttpServlet {
}
PdfAsHelper.setStatisticEvent(request, response, statisticEvent);
-
- PdfAsHelper.startSignature(request, response, getServletContext(), pdfData, connector,
+
+
+ PdfAsHelper.startSignature(request, response, getServletContext(), pdfData, connector,
PdfAsHelper.buildPosString(request, response), transactionId, PdfAsParameterExtractor
.getSigType(request), PdfAsParameterExtractor.getPreProcessorMap(request),
- PdfAsParameterExtractor.getOverwriteMap(request));
+ PdfAsParameterExtractor.getOverwriteMap(request), dynamicSignatureBlockArguments);
return;
} else if (connector.equals("jks") || connector.equals("moa")) {
// start synchronous siganture creation
@@ -432,8 +437,8 @@ public class ExternSignServlet extends HttpServlet {
}
}
- byte[] pdfSignedData = PdfAsHelper.synchornousSignature(request,
- response, pdfData);
+ byte[] pdfSignedData = PdfAsHelper.synchronousSignature(request,
+ response, pdfData, dynamicSignatureBlockArguments);
PdfAsHelper.setSignedPdf(request, response, pdfSignedData);
statisticEvent.setStatus(Status.OK);
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/JSONAPIServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/JSONAPIServlet.java
index 13d874e8..4925ec65 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/JSONAPIServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/JSONAPIServlet.java
@@ -1,9 +1,7 @@
package at.gv.egiz.pdfas.web.servlets;
import at.gv.egiz.pdfas.api.ws.PDFASSignParameters;
-import at.gv.egiz.pdfas.api.ws.PDFASSignRequest;
import at.gv.egiz.pdfas.api.ws.PDFASSignResponse;
-import at.gv.egiz.pdfas.api.ws.VerificationLevel;
import at.gv.egiz.pdfas.common.exceptions.PDFASError;
import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter;
import at.gv.egiz.pdfas.lib.api.verify.VerifyResult;
@@ -15,10 +13,8 @@ import at.gv.egiz.pdfas.web.helper.JSONStartResponse;
import at.gv.egiz.pdfas.web.helper.PdfAsHelper;
import at.gv.egiz.pdfas.web.stats.StatisticEvent;
import at.gv.egiz.pdfas.web.stats.StatisticFrontend;
-import at.gv.egiz.pdfas.web.store.RequestStore;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
-import org.json.HTTP;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -27,8 +23,6 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.xml.ws.WebServiceException;
-import java.io.BufferedReader;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -139,11 +133,15 @@ public class JSONAPIServlet extends HttpServlet {
parameters.setPosition(position);
parameters.setProfile(profile);
+ //TODO alex fill here
+ Map<String, String> dynamicSignatureBlockArguments = null;
+
if (PDFASSignParameters.Connector.MOA.equals(connectorEnum)
|| PDFASSignParameters.Connector.JKS.equals(connectorEnum)) {
// Plain server based signatures!!
- PDFASSignResponse pdfasSignResponse = PdfAsHelper.synchornousServerSignature(
- inputDocument, parameters);
+
+ PDFASSignResponse pdfasSignResponse = PdfAsHelper.synchronousServerSignature(
+ inputDocument, parameters, dynamicSignatureBlockArguments);
VerifyResult verifyResult = null;
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java
index 73f8299c..664dd9b3 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java
@@ -174,13 +174,15 @@ public class UIEntryPointServlet extends HttpServlet {
overwrite = pdfAsRequest.getParameters().getOverrides()
.getMap();
}
+ //TODO alex
+ Map<String, String> dynamicSignatureBlockArguments = pdfAsRequest.getSignatureBlockParameters();
PdfAsHelper.startSignature(req, resp, getServletContext(),
pdfAsRequest.getInputData(), connector.toString(),
pdfAsRequest.getParameters().getPosition(),
pdfAsRequest.getParameters().getTransactionId(),
pdfAsRequest.getParameters().getProfile(), map,
- overwrite);
+ overwrite, dynamicSignatureBlockArguments);
} else {
throw new PdfAsWebException("Invalid connector ("
+ Connector.BKU + " | " + Connector.ONLINEBKU + " | "