aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/moazs/config
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-07-09 14:11:47 +0200
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-07-09 14:11:47 +0200
commit8aba1b4f18f5fbfebdf239b4b4945b628e439905 (patch)
tree0004115e44b8d6ddf48542b7413d4f54fa76dc27 /src/main/java/at/gv/egiz/moazs/config
parent65163646205b6e05139485fe957bceabe531f447 (diff)
downloadmoa-zs-8aba1b4f18f5fbfebdf239b4b4945b628e439905.tar.gz
moa-zs-8aba1b4f18f5fbfebdf239b4b4945b628e439905.tar.bz2
moa-zs-8aba1b4f18f5fbfebdf239b4b4945b628e439905.zip
Refactor Needles Interfaces and Rename "process" to "backend"
Reason: - Interfaces with a single method can be replaced with interfaces from java.util.function. - Less interfaces = less code = less maintenance! - Spring can inject beans by name so we name dependencies correctly to prevent ambiguity. Others: - Rename process to backend since backend gives a better description of its components.
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/config')
-rw-r--r--src/main/java/at/gv/egiz/moazs/config/MoaSigConfig.java12
-rw-r--r--src/main/java/at/gv/egiz/moazs/config/PreprocessConfig.java7
-rw-r--r--src/main/java/at/gv/egiz/moazs/config/ServicesConfig.java3
3 files changed, 10 insertions, 12 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/config/MoaSigConfig.java b/src/main/java/at/gv/egiz/moazs/config/MoaSigConfig.java
index 0b7bdc7..e02c11d 100644
--- a/src/main/java/at/gv/egiz/moazs/config/MoaSigConfig.java
+++ b/src/main/java/at/gv/egiz/moazs/config/MoaSigConfig.java
@@ -3,8 +3,7 @@ package at.gv.egiz.moazs.config;
import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.ISignatureVerificationService;
import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.SignatureVerificationService;
import at.gv.egiz.moazs.util.FileUtils;
-import at.gv.egiz.moazs.verify.MoaSPSSSignatureVerifier;
-import at.gv.egiz.moazs.verify.SignatureVerifier;
+import at.gv.egiz.moazs.backend.SignatureVerifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -14,6 +13,7 @@ import org.springframework.context.annotation.Configuration;
import java.io.File;
import java.io.FileNotFoundException;
+import java.util.function.Consumer;
@Configuration
@@ -62,8 +62,6 @@ public class MoaSigConfig {
}
}
-
-
private void fallBackToSpringEnvForJavaxNetSSLStoreTypeProperty() {
if (System.getProperty(JAVAX_SSL_TRUSTSTORE_TYPE_PROPERTY) == null) {
log.info(SET_PROPERTY_MSG_TEMPLATE, JAVAX_SSL_TRUSTSTORE_TYPE_PROPERTY, trustStoreType);
@@ -87,11 +85,11 @@ public class MoaSigConfig {
}
@Bean
- public SignatureVerifier signatureVerifier(@Value("${moa.spss.is-active}") boolean isMoaSPSSActive,
- @Value("${moa.spss.is-manifest-check-active}") boolean isManifestCheckActive) {
+ public Consumer<byte[]> signatureVerifier(@Value("${moa.spss.is-active}") boolean isMoaSPSSActive,
+ @Value("${moa.spss.is-manifest-check-active}") boolean isManifestCheckActive) {
if (isMoaSPSSActive) {
log.info("Moa SPSS is active. Signatures in SOAP Messages will be verified.");
- return new MoaSPSSSignatureVerifier(moaSigVerifyService(), defaultTrustProfile, isManifestCheckActive);
+ return new SignatureVerifier(moaSigVerifyService(), defaultTrustProfile, isManifestCheckActive);
} else {
log.warn("Moa SPSS is not active. Signatures in SOAP Messages will not be verified.");
return signedXMLdocument -> {};
diff --git a/src/main/java/at/gv/egiz/moazs/config/PreprocessConfig.java b/src/main/java/at/gv/egiz/moazs/config/PreprocessConfig.java
index 76bfb30..29797dd 100644
--- a/src/main/java/at/gv/egiz/moazs/config/PreprocessConfig.java
+++ b/src/main/java/at/gv/egiz/moazs/config/PreprocessConfig.java
@@ -21,15 +21,14 @@ public class PreprocessConfig {
return generator.generate();
}
- @Value("${verify-completeness-of-default-delivery-request-configuration:true}")
- private boolean verifyCompletenessOfDefaultConfiguration;
-
@Bean
@Autowired
public ConfigProfileGenerator configProfileGenerator(
SpringPropertiesFacade properties,
MzsDeliveryRequestValidator validator,
- ConfigUtil util) {
+ ConfigUtil util,
+ @Value("${verify-completeness-of-default-delivery-request-configuration:true}")
+ boolean verifyCompletenessOfDefaultConfiguration) {
return configProfileGeneratorBuilder()
.withProperties(properties)
diff --git a/src/main/java/at/gv/egiz/moazs/config/ServicesConfig.java b/src/main/java/at/gv/egiz/moazs/config/ServicesConfig.java
index 42019b1..c16dfd2 100644
--- a/src/main/java/at/gv/egiz/moazs/config/ServicesConfig.java
+++ b/src/main/java/at/gv/egiz/moazs/config/ServicesConfig.java
@@ -38,7 +38,8 @@ public class ServicesConfig {
return new Zuse2AppPortService();
}
- @Bean public App2Mzs app2mzs() {
+ @Bean
+ public App2Mzs app2mzs() {
return new App2Mzs();
}