aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv/egiz')
-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/helper/PdfAsHelper.java6
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java9
3 files changed, 26 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 f073ca56..4555d6a1 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
@@ -44,6 +44,7 @@ public class WebConfiguration {
public static final String PDF_AS_WORK_DIR = "pdfas.dir";
public static final String MOA_SS_ENABLED = "moa.enabled";
+ public static final String SOAP_SIGN_ENABLED = "soap.sign.enabled";
public static final String KEYSTORE_ENABLED = "ks.enabled";
public static final String KEYSTORE_FILE = "ks.file";
@@ -161,6 +162,16 @@ public class WebConfiguration {
return false;
}
+ public static boolean getSoapSignEnabled() {
+ String value = properties.getProperty(SOAP_SIGN_ENABLED);
+ if(value != null) {
+ if(value.equals("true")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public static boolean isShowErrorDetails() {
String value = properties.getProperty(ERROR_DETAILS);
if(value != null) {
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 5c0f94c4..0f33056e 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
@@ -348,8 +348,14 @@ public class PdfAsHelper {
IPlainSigner signer;
if (params.getConnector().equals(Connector.MOA)) {
+ if(!WebConfiguration.getMOASSEnabled()) {
+ throw new PdfAsWebException("MOA connector disabled.");
+ }
signer = new PAdESSigner(new MOAConnector(config));
} else if(params.getConnector().equals(Connector.JKS)) {
+ if(!WebConfiguration.getKeystoreEnabled()) {
+ throw new PdfAsWebException("JKS connector disabled.");
+ }
signer = new PKCS7DetachedSigner(
WebConfiguration.getKeystoreFile(),
WebConfiguration.getKeystoreAlias(),
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java
index c8283d28..07ffd7c4 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java
@@ -28,6 +28,7 @@ public class PDFASSigningImpl implements PDFASSigning {
public byte[] signPDFDokument(byte[] inputDocument,
PDFASSignParameters parameters) {
+ checkSoapSignEnabled();
try {
return PdfAsHelper.synchornousServerSignature(inputDocument,
parameters);
@@ -42,6 +43,7 @@ public class PDFASSigningImpl implements PDFASSigning {
}
public PDFASSignResponse signPDFDokument(PDFASSignRequest request) {
+ checkSoapSignEnabled();
if (request == null) {
logger.warn("SOAP Sign Request is null!");
return null;
@@ -62,6 +64,7 @@ public class PDFASSigningImpl implements PDFASSigning {
}
public PDFASBulkSignResponse signPDFDokument(PDFASBulkSignRequest request) {
+ checkSoapSignEnabled();
List<PDFASSignResponse> responses = new ArrayList<PDFASSignResponse>();
if (request.getSignRequests() != null) {
for (int i = 0; i < request.getSignRequests().size(); i++) {
@@ -83,4 +86,10 @@ public class PDFASSigningImpl implements PDFASSigning {
}
}
+ private void checkSoapSignEnabled() {
+ if(!WebConfiguration.getSoapSignEnabled()) {
+ throw new WebServiceException("Service disabled!");
+ }
+ }
+
}