aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/moazs/msg
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-05-28 10:48:20 +0200
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-05-28 10:48:20 +0200
commite1f365955aa22cdf8e44429af2b744388ce0c05b (patch)
tree71fec813cce57d4a74650dec259685052c405190 /src/main/java/at/gv/egiz/moazs/msg
parent695ab1f836160d40c4352a2c3127f4f687912817 (diff)
downloadmoa-zs-e1f365955aa22cdf8e44429af2b744388ce0c05b.tar.gz
moa-zs-e1f365955aa22cdf8e44429af2b744388ce0c05b.tar.bz2
moa-zs-e1f365955aa22cdf8e44429af2b744388ce0c05b.zip
Integrate Sign.Verification and Improve Error Handling of Pipeline
- Ensure proper communication of errors between pipeline and mzs service by converting MoaZSExceptions into DeliveryRequestStatus messages. - Revise MoaZSException: Add optional fields; those fields are a) helpful to construct meaningful error messages and b) optional because, depending on where an exception appears, either existent or non-existent and thus optional. Add inner-class Builder. - Integrate Signature Verification into pipeline and add Stub for SignatureVerification. - Move TNVZResponse's Mimetype check into dedicated class (Reason: separate abstration layers). - Update api changes in testcases.
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/msg')
-rw-r--r--src/main/java/at/gv/egiz/moazs/msg/MsgClient.java6
-rw-r--r--src/main/java/at/gv/egiz/moazs/msg/MsgClientFactory.java9
-rw-r--r--src/main/java/at/gv/egiz/moazs/msg/SignatureVerifier.java13
-rw-r--r--src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java7
4 files changed, 20 insertions, 15 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/msg/MsgClient.java b/src/main/java/at/gv/egiz/moazs/msg/MsgClient.java
index fd36a92..82f172d 100644
--- a/src/main/java/at/gv/egiz/moazs/msg/MsgClient.java
+++ b/src/main/java/at/gv/egiz/moazs/msg/MsgClient.java
@@ -8,18 +8,14 @@ import org.apache.cxf.jaxws.JaxWsClientFactoryBean;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.PhaseInterceptor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class MsgClient {
- private static final Logger log = LoggerFactory.getLogger(MsgClient.class);
-
private final DeliveryRequestType msgRequest;
private final ConfigType config;
private final PhaseInterceptor<? extends Message> interceptor;
- MsgClient(DeliveryRequestType msgRequest, ConfigType config, PhaseInterceptor<? extends Message> interceptor) {
+ public MsgClient(DeliveryRequestType msgRequest, ConfigType config, PhaseInterceptor<? extends Message> interceptor) {
this.msgRequest = msgRequest;
this.config = config;
this.interceptor = interceptor;
diff --git a/src/main/java/at/gv/egiz/moazs/msg/MsgClientFactory.java b/src/main/java/at/gv/egiz/moazs/msg/MsgClientFactory.java
index 82468bc..228ebec 100644
--- a/src/main/java/at/gv/egiz/moazs/msg/MsgClientFactory.java
+++ b/src/main/java/at/gv/egiz/moazs/msg/MsgClientFactory.java
@@ -8,14 +8,7 @@ import org.springframework.stereotype.Component;
@Component
public class MsgClientFactory {
- private final StoreSOAPBodyBinaryInRepositoryInterceptor storeResponseInterceptor;
-
- @Autowired
- public MsgClientFactory(StoreSOAPBodyBinaryInRepositoryInterceptor storeResponseInterceptor) {
- this.storeResponseInterceptor = storeResponseInterceptor;
- }
-
- public MsgClient create(DeliveryRequestType msgRequest, ConfigType config) {
+ public MsgClient create(DeliveryRequestType msgRequest, ConfigType config, StoreSOAPBodyBinaryInRepositoryInterceptor storeResponseInterceptor) {
return new MsgClient(msgRequest, config, storeResponseInterceptor);
}
diff --git a/src/main/java/at/gv/egiz/moazs/msg/SignatureVerifier.java b/src/main/java/at/gv/egiz/moazs/msg/SignatureVerifier.java
new file mode 100644
index 0000000..12b1ccb
--- /dev/null
+++ b/src/main/java/at/gv/egiz/moazs/msg/SignatureVerifier.java
@@ -0,0 +1,13 @@
+package at.gv.egiz.moazs.msg;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class SignatureVerifier {
+
+ public boolean verify(byte[] signedXMLdocument) {
+ return true;
+
+ }
+
+}
diff --git a/src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java b/src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java
index 4e023ac..c78c44b 100644
--- a/src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java
+++ b/src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java
@@ -1,6 +1,5 @@
package at.gv.egiz.moazs.msg;
-import at.gv.egiz.moazs.MoaZSException;
import at.gv.egiz.moazs.repository.DeliveryRepository;
import at.gv.egiz.moazs.scheme.SOAPUtils;
import at.gv.egiz.moazs.util.CXFMessageUtils;
@@ -17,6 +16,8 @@ import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
+import static at.gv.egiz.moazs.MoaZSException.moaZSExceptionBuilder;
+
@Component
public class StoreSOAPBodyBinaryInRepositoryInterceptor extends AbstractPhaseInterceptor<Message> {
@@ -48,7 +49,9 @@ public class StoreSOAPBodyBinaryInRepositoryInterceptor extends AbstractPhaseInt
log.info("Store binary DeliveryRequestStatus with AppDeliveryId={}", appDeliveryId);
}
} catch (ParserConfigurationException | SAXException | IOException | NullPointerException e) {
- throw new MoaZSException("Could not extract signed data from message.", e);
+ throw moaZSExceptionBuilder("Could not extract signed data from message.")
+ .withCause(e)
+ .build();
}
}