aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf-as-web-client/src/test/java/at/gv/egiz/pdfas/web/client/test/SimpleTest.java9
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java54
2 files changed, 58 insertions, 5 deletions
diff --git a/pdf-as-web-client/src/test/java/at/gv/egiz/pdfas/web/client/test/SimpleTest.java b/pdf-as-web-client/src/test/java/at/gv/egiz/pdfas/web/client/test/SimpleTest.java
index e73f0d95..bf22e10d 100644
--- a/pdf-as-web-client/src/test/java/at/gv/egiz/pdfas/web/client/test/SimpleTest.java
+++ b/pdf-as-web-client/src/test/java/at/gv/egiz/pdfas/web/client/test/SimpleTest.java
@@ -52,19 +52,20 @@ public class SimpleTest {
signParameters.setConnector(Connector.JKS);
signParameters.setPosition(null);
signParameters.setProfile("SIGNATURBLOCK_SMALL_DE");
- signParameters.setKeyIdentifier("test");
+ signParameters.setQRCodeContent("https://docs.google.com/document/d/1DSE9aO8-q9PAlRPyYpH1sgont4rSB_Q5BCeS-X3p6WA/edit?usp=sharing");
+ //signParameters.setKeyIdentifier("test");
PDFASSignRequest request = new PDFASSignRequest();
request.setInputData(inputData);
request.setParameters(signParameters);
request.setRequestID("SOME TEST ID");
-
+
//URL endpoint = new
//URL("http://demo.egiz.gv.at/demoportal-pdf_as/wssign?wsdl");
//URL endpoint = new
// URL("http://www.buergerkarte.at/pdf-as-extern-4/wssign?wsdl");
- //String baseUrl = "http://demo.egiz.gv.at/demoportal-pdf_as/";
- String baseUrl = "http://localhost:8080/pdf-as-web/services/";
+ String baseUrl = "http://demo.egiz.gv.at/demoportal-pdf_as/services/";
+ //String baseUrl = "http://localhost:8080/pdf-as-web/services/";
//URL endpoint = new URL(
// "http://192.168.56.10/pdf-as-web/wssign?wsdl");
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
index 1869dbb5..2e337f04 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
@@ -547,8 +547,36 @@ public class PdfAsHelper {
signParameter.setPlainSigner(signer);
+ String profile = params.getProfile();
+
+ //PdfAsHelper.getQRCodeContent(request);
+ // Get QR Code Content form param
+ String qrCodeContent = params.getQRCodeContent();
+
+ if(qrCodeContent != null) {
+ if(profile == null) {
+ // get default Profile
+ profile = config.getValue("sig_obj.type.default");
+ }
+
+ if(profile == null) {
+ logger.warn("Failed to determine default profile! Using hard coded!");
+ profile = "SIGNATURBLOCK_SMALL_DE";
+ }
+
+ ByteArrayOutputStream qrbaos = new ByteArrayOutputStream();
+ try {
+ String key = "sig_obj." + profile + ".value.SIG_LABEL";
+ QRCodeGenerator.generateQRCode(qrCodeContent, qrbaos, 200);
+ String value = Base64.encodeBase64String(qrbaos.toByteArray());
+ config.setValue(key, value);
+ } finally {
+ IOUtils.closeQuietly(qrbaos);
+ }
+ }
+
// set Signature Profile (null use default ...)
- signParameter.setSignatureProfileId(params.getProfile());
+ signParameter.setSignatureProfileId(profile);
// set Signature Position
signParameter.setSignaturePosition(params.getPosition());
@@ -625,6 +653,30 @@ public class PdfAsHelper {
session.setAttribute(PDF_SIGNER, signer);
session.setAttribute(PDF_SL_INTERACTIVE, connector);
+ String qrCodeContent = PdfAsHelper.getQRCodeContent(request);
+
+ if(qrCodeContent != null) {
+ if(profile == null) {
+ // get default Profile
+ profile = config.getValue("sig_obj.type.default");
+ }
+
+ if(profile == null) {
+ logger.warn("Failed to determine default profile! Using hard coded!");
+ profile = "SIGNATURBLOCK_SMALL_DE";
+ }
+
+ ByteArrayOutputStream qrbaos = new ByteArrayOutputStream();
+ try {
+ String key = "sig_obj." + profile + ".value.SIG_LABEL";
+ QRCodeGenerator.generateQRCode(qrCodeContent, qrbaos, 200);
+ String value = Base64.encodeBase64String(qrbaos.toByteArray());
+ config.setValue(key, value);
+ } finally {
+ IOUtils.closeQuietly(qrbaos);
+ }
+ }
+
// set Signature Profile (null use default ...)
signParameter.setSignatureProfileId(profile);