diff options
| author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-05-08 14:11:55 +0200 | 
|---|---|---|
| committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-05-08 14:11:55 +0200 | 
| commit | 1d5e1f5f429d225e14f4ce9e6e82a403eac10b6b (patch) | |
| tree | ec2abe98cc365bcd170fcf420ed45288cbfb7e72 /pdf-as-web/src/main/java/at/gv | |
| parent | 5e65a0aa96300e24a6dc7d4be64cf6745f325fc5 (diff) | |
| download | pdf-as-4-1d5e1f5f429d225e14f4ce9e6e82a403eac10b6b.tar.gz pdf-as-4-1d5e1f5f429d225e14f4ce9e6e82a403eac10b6b.tar.bz2 pdf-as-4-1d5e1f5f429d225e14f4ce9e6e82a403eac10b6b.zip | |
Performance Test, Web Options
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv')
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!"); +		} + 	} +	  } | 
