diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-02-05 10:55:04 +0100 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-02-05 10:55:04 +0100 |
commit | a0bfe818095656234eca2f5cbaa093ea49a0122d (patch) | |
tree | 0c634a9d09453247beb4a4de9b4a373f91010554 /pdf-as-web | |
parent | a8183a22b3a5bd9b062a1cded09a75ec8fa3be8e (diff) | |
download | pdf-as-4-a0bfe818095656234eca2f5cbaa093ea49a0122d.tar.gz pdf-as-4-a0bfe818095656234eca2f5cbaa093ea49a0122d.tar.bz2 pdf-as-4-a0bfe818095656234eca2f5cbaa093ea49a0122d.zip |
MOA-SS integration done
Diffstat (limited to 'pdf-as-web')
3 files changed, 51 insertions, 0 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/config/WebConfiguration.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/config/WebConfiguration.java index c7520347..b978b361 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/config/WebConfiguration.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/config/WebConfiguration.java @@ -20,6 +20,8 @@ public class WebConfiguration { public static final String ERROR_DETAILS = "error.showdetails"; public static final String PDF_AS_WORK_DIR = "pdfas.dir"; + public static final String MOA_SS_ENABLED = "moa.enabled"; + public static final String KEYSTORE_ENABLED = "ks.enabled"; public static final String KEYSTORE_FILE = "ks.file"; public static final String KEYSTORE_TYPE = "ks.type"; @@ -116,6 +118,15 @@ public class WebConfiguration { return properties.getProperty(KEYSTORE_KEY_PASS); } + public static boolean getMOASSEnabled() { + String value = properties.getProperty(MOA_SS_ENABLED); + if(value != null) { + if(value.equals("true")) { + return true; + } + } + return false; + } public static boolean getKeystoreEnabled() { String value = properties.getProperty(KEYSTORE_ENABLED); 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 dddd80dd..fe26f097 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 @@ -235,9 +235,41 @@ public class ExternSignServlet extends HttpServlet { IPlainSigner signer; if (connector.equals("bku") || connector.equals("onlinebku") || connector.equals("mobilebku")) { // start asynchronous signature creation + + if(connector.equals("bku")) { + if(WebConfiguration.getLocalBKUURL() == null) { + throw new PdfAsWebException("Invalid connector bku is not supported"); + } + } + + if(connector.equals("onlinebku")) { + if(WebConfiguration.getLocalBKUURL() == null) { + throw new PdfAsWebException("Invalid connector onlinebku is not supported"); + } + } + + if(connector.equals("mobilebku")) { + if(WebConfiguration.getLocalBKUURL() == null) { + throw new PdfAsWebException("Invalid connector mobilebku is not supported"); + } + } + PdfAsHelper.startSignature(request, response, getServletContext(), pdfData); } else if (connector.equals("jks") || connector.equals("moa")) { // start synchronous siganture creation + + if(connector.equals("jks")) { + if(!WebConfiguration.getKeystoreEnabled()) { + throw new PdfAsWebException("Invalid connector jks is not supported"); + } + } + + if(connector.equals("moa")) { + if(!WebConfiguration.getMOASSEnabled()) { + throw new PdfAsWebException("Invalid connector moa is not supported"); + } + } + byte[] pdfSignedData = PdfAsHelper.synchornousSignature(request, response, pdfData); PdfAsHelper.setSignedPdf(request, response, pdfSignedData); diff --git a/pdf-as-web/src/main/webapp/index.jsp b/pdf-as-web/src/main/webapp/index.jsp index 355c7838..6383f8a3 100644 --- a/pdf-as-web/src/main/webapp/index.jsp +++ b/pdf-as-web/src/main/webapp/index.jsp @@ -51,6 +51,14 @@ <% } %> + <% + if (WebConfiguration.getMOASSEnabled()) { + %> + <button type="submit" value="moa" name="connector" + id="moa">MOA-SS</button> + <% + } + %> </form> </body> </html>
\ No newline at end of file |