aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf-as-moa/src/main/resources/META-INF/MANIFEST.MF (renamed from pdf-as-moa/src/main/java/META-INF/MANIFEST.MF)0
-rw-r--r--pdf-as-moa/src/main/resources/META-INF/services/at.gv.egiz.pdfas.lib.impl.verify.IVerifier (renamed from pdf-as-moa/src/main/java/META-INF/services/at.gv.egiz.pdfas.lib.impl.verify.IVerifier)0
-rw-r--r--pdf-as-web-db/.gitignore1
-rw-r--r--pdf-as-web-db/build.gradle27
-rw-r--r--pdf-as-web-db/src/main/java/at/gv/egiz/pdfas/web/store/DBRequestStore.java (renamed from pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/store/DBRequestStore.java)1
-rw-r--r--pdf-as-web-db/src/main/java/at/gv/egiz/pdfas/web/store/db/Request.java (renamed from pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/store/db/Request.java)0
-rw-r--r--pdf-as-web/build.gradle13
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SoapServiceServlet.java48
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java117
-rw-r--r--pdf-as-web/src/main/webapp/META-INF/cxf/org.apache.cxf.Logger1
-rw-r--r--pdf-as-web/src/main/webapp/WEB-INF/sun-jaxws.xml11
-rw-r--r--pdf-as-web/src/main/webapp/WEB-INF/web.xml20
-rw-r--r--settings.gradle2
13 files changed, 166 insertions, 75 deletions
diff --git a/pdf-as-moa/src/main/java/META-INF/MANIFEST.MF b/pdf-as-moa/src/main/resources/META-INF/MANIFEST.MF
index 5e949512..5e949512 100644
--- a/pdf-as-moa/src/main/java/META-INF/MANIFEST.MF
+++ b/pdf-as-moa/src/main/resources/META-INF/MANIFEST.MF
diff --git a/pdf-as-moa/src/main/java/META-INF/services/at.gv.egiz.pdfas.lib.impl.verify.IVerifier b/pdf-as-moa/src/main/resources/META-INF/services/at.gv.egiz.pdfas.lib.impl.verify.IVerifier
index 1ace6960..1ace6960 100644
--- a/pdf-as-moa/src/main/java/META-INF/services/at.gv.egiz.pdfas.lib.impl.verify.IVerifier
+++ b/pdf-as-moa/src/main/resources/META-INF/services/at.gv.egiz.pdfas.lib.impl.verify.IVerifier
diff --git a/pdf-as-web-db/.gitignore b/pdf-as-web-db/.gitignore
new file mode 100644
index 00000000..ae3c1726
--- /dev/null
+++ b/pdf-as-web-db/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/pdf-as-web-db/build.gradle b/pdf-as-web-db/build.gradle
new file mode 100644
index 00000000..c29fff66
--- /dev/null
+++ b/pdf-as-web-db/build.gradle
@@ -0,0 +1,27 @@
+apply plugin: 'java'
+apply plugin: 'eclipse'
+
+jar {
+ manifest {
+ attributes 'Implementation-Title': 'PDF-AS-4 Web Extension Library', 'JARMANIFEST': 'PDF-AS-LIB'
+ }
+}
+
+repositories {
+ mavenLocal()
+ mavenCentral()
+}
+
+dependencies {
+ compile project (':pdf-as-web')
+ compile "org.hibernate:hibernate-core:4.3.6.Final"
+ compile "org.hibernate:hibernate-entitymanager:4.3.6.Final"
+ compile group: 'log4j', name: 'log4j', version: '1.2.17'
+ compile group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
+ testCompile group: 'junit', name: 'junit', version: '4.+'
+}
+
+task releases(type: Copy) {
+ from jar.outputs
+ into rootDir.toString() + "/releases/" + version
+} \ No newline at end of file
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/store/DBRequestStore.java b/pdf-as-web-db/src/main/java/at/gv/egiz/pdfas/web/store/DBRequestStore.java
index 6ca6d9a4..a1b88270 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/store/DBRequestStore.java
+++ b/pdf-as-web-db/src/main/java/at/gv/egiz/pdfas/web/store/DBRequestStore.java
@@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory;
import at.gv.egiz.pdfas.api.ws.PDFASSignRequest;
import at.gv.egiz.pdfas.web.config.WebConfiguration;
+import at.gv.egiz.pdfas.web.store.IRequestStore;
import at.gv.egiz.pdfas.web.store.db.Request;
public class DBRequestStore implements IRequestStore {
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/store/db/Request.java b/pdf-as-web-db/src/main/java/at/gv/egiz/pdfas/web/store/db/Request.java
index d7377166..d7377166 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/store/db/Request.java
+++ b/pdf-as-web-db/src/main/java/at/gv/egiz/pdfas/web/store/db/Request.java
diff --git a/pdf-as-web/build.gradle b/pdf-as-web/build.gradle
index 64111a3a..d854a365 100644
--- a/pdf-as-web/build.gradle
+++ b/pdf-as-web/build.gradle
@@ -21,20 +21,13 @@ dependencies {
compile project (':signature-standards:sigs-pkcs7detached')
compile project (':signature-standards:sigs-pades')
compile group: 'commons-fileupload', name: 'commons-fileupload', version: '1.3.1'
- compile 'org.apache.commons:commons-collections4:4.0'
- compile 'commons-io:commons-io:2.4'
compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.7'
+ compile 'org.slf4j:slf4j-log4j12:1.7.7'
compile group: 'opensymphony', name: 'sitemesh', version: '2.4.2'
- compile 'javax.xml.ws:jaxws-api:2.2.11'
compile "commons-codec:commons-codec:1.9"
- compile 'com.sun.xml.ws:jaxws-rt:2.2.8'
- compile 'com.sun.xml.bind:jaxb-impl:2.2.7'
compile 'org.apache.commons:commons-lang3:3.3.2'
- compile 'org.apache.httpcomponents:httpclient:4.3.5'
- compile "org.hibernate:hibernate-core:4.3.6.Final"
- compile "org.hibernate:hibernate-entitymanager:4.3.6.Final"
- //compile "mysql:mysql-connector-java:5.1.33"
- compile group: 'org.apache.pdfbox', name: 'pdfbox', version: '1.8.5'
+ compile 'org.apache.cxf:cxf-rt-transports-http:3.0.1'
+ compile 'org.apache.cxf:cxf-rt-frontend-jaxws:3.0.1'
providedCompile "javax.servlet:servlet-api:2.5"
testCompile group: 'junit', name: 'junit', version: '4.+'
}
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SoapServiceServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SoapServiceServlet.java
new file mode 100644
index 00000000..71395304
--- /dev/null
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SoapServiceServlet.java
@@ -0,0 +1,48 @@
+package at.gv.egiz.pdfas.web.servlets;
+
+import javax.servlet.ServletConfig;
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.feature.LoggingFeature;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.gv.egiz.pdfas.web.ws.PDFASSigningImpl;
+import at.gv.egiz.pdfas.web.ws.PDFASVerificationImpl;
+
+public class SoapServiceServlet extends CXFNonSpringServlet {
+
+ private static final Logger logger = LoggerFactory
+ .getLogger(SoapServiceServlet.class);
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -8903883276191902043L;
+
+ @Override
+ protected void loadBus(ServletConfig sc) {
+ super.loadBus(sc);
+
+ // You could add the endpoint publish codes here
+ Bus bus = this.getBus();
+ BusFactory.setDefaultBus(bus);
+ Endpoint signEp = Endpoint.publish("/wssign", new PDFASSigningImpl());
+ /*
+ * SOAPBinding signBinding = (SOAPBinding)signEp.getBinding();
+ signBinding.setMTOMEnabled(true);
+ */
+
+ Endpoint verifyEp = Endpoint.publish("/wsverify", new PDFASVerificationImpl());
+ /*
+ SOAPBinding verifyBinding = (SOAPBinding)verifyEp.getBinding();
+ verifyBinding.setMTOMEnabled(true);
+ */
+
+ }
+}
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 02c1af5e..6df63a3b 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
@@ -53,91 +53,110 @@ public class PDFASSigningImpl implements PDFASSigning {
private static final Logger logger = LoggerFactory
.getLogger(PDFASSigningImpl.class);
-
- /*public byte[] signPDFDokument(byte[] inputDocument,
- PDFASSignParameters parameters) {
- checkSoapSignEnabled();
- try {
- return PdfAsHelper.synchornousServerSignature(inputDocument,
- parameters);
- } catch (Throwable e) {
- logger.error("Server Signature failed.", e);
- if (WebConfiguration.isShowErrorDetails()) {
- throw new WebServiceException("Server Signature failed.", e);
- } else {
- throw new WebServiceException("Server Signature failed.");
- }
- }
- }*/
+
+ /*
+ * public byte[] signPDFDokument(byte[] inputDocument, PDFASSignParameters
+ * parameters) { checkSoapSignEnabled(); try { return
+ * PdfAsHelper.synchornousServerSignature(inputDocument, parameters); }
+ * catch (Throwable e) { logger.error("Server Signature failed.", e); if
+ * (WebConfiguration.isShowErrorDetails()) { throw new
+ * WebServiceException("Server Signature failed.", e); } else { throw new
+ * WebServiceException("Server Signature failed."); } } }
+ */
public PDFASSignResponse signPDFDokument(PDFASSignRequest request) {
+ logger.debug("Starting SOAP Sign Request");
checkSoapSignEnabled();
if (request == null) {
logger.warn("SOAP Sign Request is null!");
return null;
}
+
PDFASSignResponse response = new PDFASSignResponse();
try {
- if(request.getParameters().getConnector().equals(Connector.MOA) ||
- request.getParameters().getConnector().equals(Connector.JKS)) {
+ if(request.getParameters().getConnector() == null) {
+ throw new WebServiceException(
+ "Invalid connector value!");
+ }
+
+ if (request.getParameters().getConnector().equals(Connector.MOA)
+ || request.getParameters().getConnector()
+ .equals(Connector.JKS)) {
// Plain server based signatures!!
- response = PdfAsHelper.synchornousServerSignature(request.getInputData(),
- request.getParameters());
-
-
+ response = PdfAsHelper.synchornousServerSignature(
+ request.getInputData(), request.getParameters());
+
VerifyResult verifyResult = null;
- if(request.getVerificationLevel().equals(VerificationLevel.FULL_CERT_PATH)) {
- List<VerifyResult> verResults = PdfAsHelper.synchornousVerify(response.getSignedPDF(), -1,
- SignatureVerificationLevel.FULL_VERIFICATION);
-
- if(verResults.size() != 1) {
- throw new WebServiceException("Document verification failed!");
+ if (request.getVerificationLevel() != null &&
+ request.getVerificationLevel().equals(
+ VerificationLevel.FULL_CERT_PATH)) {
+ List<VerifyResult> verResults = PdfAsHelper
+ .synchornousVerify(
+ response.getSignedPDF(),
+ -1,
+ SignatureVerificationLevel.FULL_VERIFICATION);
+
+ if (verResults.size() != 1) {
+ throw new WebServiceException(
+ "Document verification failed!");
}
verifyResult = verResults.get(0);
} else {
- List<VerifyResult> verResults = PdfAsHelper.synchornousVerify(response.getSignedPDF(), -1,
- SignatureVerificationLevel.INTEGRITY_ONLY_VERIFICATION);
-
- if(verResults.size() != 1) {
- throw new WebServiceException("Document verification failed!");
+ List<VerifyResult> verResults = PdfAsHelper
+ .synchornousVerify(
+ response.getSignedPDF(),
+ -1,
+ SignatureVerificationLevel.INTEGRITY_ONLY_VERIFICATION);
+
+ if (verResults.size() != 1) {
+ throw new WebServiceException(
+ "Document verification failed!");
}
verifyResult = verResults.get(0);
}
-
- response.getVerificationResponse().setCertificateCode(verifyResult.getCertificateCheck().getCode());
- response.getVerificationResponse().setValueCode(verifyResult.getValueCheckCode().getCode());
+
+ response.getVerificationResponse().setCertificateCode(
+ verifyResult.getCertificateCheck().getCode());
+ response.getVerificationResponse().setValueCode(
+ verifyResult.getValueCheckCode().getCode());
} else {
// Signatures with user interaction!!
- String id = RequestStore.getInstance().createNewStoreEntry(request);
-
- if(id == null) {
+ String id = RequestStore.getInstance().createNewStoreEntry(
+ request);
+
+ if (id == null) {
throw new WebServiceException("Failed to store request");
}
-
+
String userEntryURL = PdfAsHelper.generateUserEntryURL(id);
-
+
logger.debug("Generated request store: " + id);
logger.debug("Generated UI URL: " + userEntryURL);
-
- if(userEntryURL == null) {
- throw new WebServiceException("Failed to generate User Entry URL");
+
+ if (userEntryURL == null) {
+ throw new WebServiceException(
+ "Failed to generate User Entry URL");
}
-
+
response.setRedirectUrl(userEntryURL);
}
} catch (Throwable e) {
+ logger.error("Error in Soap Service", e);
if (e.getCause() != null) {
response.setError(e.getCause().getMessage());
} else {
response.setError(e.getMessage());
}
+ } finally {
+ logger.debug("Done SOAP Sign Request");
}
response.setRequestID(request.getRequestID());
return response;
}
public PDFASBulkSignResponse signPDFDokument(PDFASBulkSignRequest request) {
+ logger.debug("Starting SOAP BulkSign Request");
checkSoapSignEnabled();
List<PDFASSignResponse> responses = new ArrayList<PDFASSignResponse>();
if (request.getSignRequests() != null) {
@@ -150,9 +169,11 @@ public class PDFASSigningImpl implements PDFASSigning {
}
PDFASBulkSignResponse response = new PDFASBulkSignResponse();
response.setSignResponses(responses);
+ logger.debug("Done SOAP Sign Request");
return response;
}
logger.error("Server Signature failed. [PDFASBulkSignRequest is NULL]");
+
if (WebConfiguration.isShowErrorDetails()) {
throw new WebServiceException("PDFASBulkSignRequest is NULL");
} else {
@@ -161,9 +182,9 @@ public class PDFASSigningImpl implements PDFASSigning {
}
private void checkSoapSignEnabled() {
- if(!WebConfiguration.getSoapSignEnabled()) {
+ if (!WebConfiguration.getSoapSignEnabled()) {
throw new WebServiceException("Service disabled!");
}
- }
-
+ }
+
}
diff --git a/pdf-as-web/src/main/webapp/META-INF/cxf/org.apache.cxf.Logger b/pdf-as-web/src/main/webapp/META-INF/cxf/org.apache.cxf.Logger
new file mode 100644
index 00000000..067508e1
--- /dev/null
+++ b/pdf-as-web/src/main/webapp/META-INF/cxf/org.apache.cxf.Logger
@@ -0,0 +1 @@
+org.apache.cxf.common.logging.Slf4jLogger \ No newline at end of file
diff --git a/pdf-as-web/src/main/webapp/WEB-INF/sun-jaxws.xml b/pdf-as-web/src/main/webapp/WEB-INF/sun-jaxws.xml
deleted file mode 100644
index f62b8484..00000000
--- a/pdf-as-web/src/main/webapp/WEB-INF/sun-jaxws.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
- version="2.0">
- <endpoint name="SOAP Sign"
- implementation="at.gv.egiz.pdfas.web.ws.PDFASSigningImpl"
- url-pattern="/wssign"/>
-
- <endpoint name="SOAP Verify"
- implementation="at.gv.egiz.pdfas.web.ws.PDFASVerificationImpl"
- url-pattern="/wsverify"/>
-</endpoints> \ No newline at end of file
diff --git a/pdf-as-web/src/main/webapp/WEB-INF/web.xml b/pdf-as-web/src/main/webapp/WEB-INF/web.xml
index 82d00fdf..f8b886ca 100644
--- a/pdf-as-web/src/main/webapp/WEB-INF/web.xml
+++ b/pdf-as-web/src/main/webapp/WEB-INF/web.xml
@@ -29,15 +29,15 @@
<url-pattern>/*</url-pattern>
</filter-mapping>
- <listener>
+ <!-- listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
- </listener>
+ </listener-->
- <servlet>
+ <!-- servlet>
<servlet-name>SOAPSign</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
- </servlet>
+ </servlet-->
<servlet>
<servlet-name>SignServlet</servlet-name>
<description>
@@ -47,6 +47,12 @@
<load-on-startup>0</load-on-startup>
</servlet>
<servlet>
+ <servlet-name>CXFServlet</servlet-name>
+ <display-name>CXFServlet</display-name>
+ <description></description>
+ <servlet-class>at.gv.egiz.pdfas.web.servlets.SoapServiceServlet</servlet-class>
+ </servlet>
+ <servlet>
<servlet-name>ProvidePDF</servlet-name>
<display-name>ProvidePDF</display-name>
<description></description>
@@ -116,9 +122,13 @@
servlet mappings, including zero. It is also legal to define more than one
mapping for the same servlet, if you wish to. -->
- <servlet-mapping>
+ <!-- servlet-mapping>
<servlet-name>SOAPSign</servlet-name>
<url-pattern>/wssign</url-pattern>
+ </servlet-mapping -->
+ <servlet-mapping>
+ <servlet-name>CXFServlet</servlet-name>
+ <url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SignServlet</servlet-name>
diff --git a/settings.gradle b/settings.gradle
index eaf6c71b..546c2d6c 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,2 +1,2 @@
-include "pdf-as-common", "signature-standards:sigs-pkcs7detached", "signature-standards:sigs-pades", "pdf-as-lib", "pdf-as-moa", "pdf-as-tests", "pdf-as-cli", "pdf-as-legacy", "pdf-as-web", "pdf-as-web-client"
+include "pdf-as-common", "signature-standards:sigs-pkcs7detached", "signature-standards:sigs-pades", "pdf-as-lib", "pdf-as-moa", "pdf-as-tests", "pdf-as-cli", "pdf-as-legacy", "pdf-as-web", "pdf-as-web-db", "pdf-as-web-client"