aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv/egiz/pdfas/web')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/config/WebConfiguration.java11
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java32
2 files changed, 43 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);