summaryrefslogtreecommitdiff
path: root/eaaf_modules/eaaf_module_moa-sig/src/main/java
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2020-10-19 17:18:48 +0200
committerThomas Lenz <thomas.lenz@egiz.gv.at>2020-10-19 17:18:48 +0200
commit9d9e9e734724c4d05757059c4dca434c07ac7c46 (patch)
tree4d580918394998277105e145994f1700718d1bc1 /eaaf_modules/eaaf_module_moa-sig/src/main/java
parentaebfb4b0fbc9d208de62930bd5460f52e0956119 (diff)
downloadEAAF-Components-9d9e9e734724c4d05757059c4dca434c07ac7c46.tar.gz
EAAF-Components-9d9e9e734724c4d05757059c4dca434c07ac7c46.tar.bz2
EAAF-Components-9d9e9e734724c4d05757059c4dca434c07ac7c46.zip
refactor MoaSigInitializer to get MOA-Sig configuration object
Diffstat (limited to 'eaaf_modules/eaaf_module_moa-sig/src/main/java')
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eaaf/modules/sigverify/moasig/impl/AbstractSignatureService.java16
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eaaf/modules/sigverify/moasig/impl/MoaSigInitializer.java41
2 files changed, 24 insertions, 33 deletions
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eaaf/modules/sigverify/moasig/impl/AbstractSignatureService.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eaaf/modules/sigverify/moasig/impl/AbstractSignatureService.java
index c7efc677..11881cbf 100644
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eaaf/modules/sigverify/moasig/impl/AbstractSignatureService.java
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eaaf/modules/sigverify/moasig/impl/AbstractSignatureService.java
@@ -4,19 +4,17 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.w3c.dom.Document;
-
import at.gv.egovernment.moa.spss.server.config.ConfigurationException;
-import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
-import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator;
import at.gv.egovernment.moa.spss.server.transaction.TransactionContext;
import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager;
import at.gv.egovernment.moaspss.logging.LoggingContext;
import at.gv.egovernment.moaspss.logging.LoggingContextManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.w3c.dom.Document;
+
public abstract class AbstractSignatureService {
private static final Logger log = LoggerFactory.getLogger(AbstractSignatureService.class);
@@ -51,7 +49,7 @@ public abstract class AbstractSignatureService {
if (txMgr.getTransactionContext() == null) {
log.debug("Set not MOA-Sig transaction context");
final TransactionContext ctx =
- new TransactionContext(transactionID, null, ConfigurationProvider.getInstance());
+ new TransactionContext(transactionID, null, moaSigConfig.getMoaSigConfig());
txMgr.setTransactionContext(ctx);
}
@@ -62,7 +60,7 @@ public abstract class AbstractSignatureService {
}
- new IaikConfigurator().configure(ConfigurationProvider.getInstance());
+ //new IaikConfigurator().configure(moaSigConfig.getMoaSigConfig());
}
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eaaf/modules/sigverify/moasig/impl/MoaSigInitializer.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eaaf/modules/sigverify/moasig/impl/MoaSigInitializer.java
index 880b3791..3f2d4593 100644
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eaaf/modules/sigverify/moasig/impl/MoaSigInitializer.java
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eaaf/modules/sigverify/moasig/impl/MoaSigInitializer.java
@@ -7,23 +7,25 @@ import java.security.Security;
import java.util.Iterator;
import java.util.Map.Entry;
-import javax.annotation.Nonnull;
import javax.annotation.PostConstruct;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-
import at.gv.egiz.eaaf.modules.sigverify.moasig.api.data.ISchemaRessourceProvider;
import at.gv.egiz.eaaf.modules.sigverify.moasig.exceptions.MoaSigServiceConfigurationException;
import at.gv.egovernment.moa.spss.MOAException;
import at.gv.egovernment.moa.spss.api.Configurator;
+import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
import at.gv.egovernment.moaspss.logging.LoggingContext;
import at.gv.egovernment.moaspss.logging.LoggingContextManager;
import at.gv.egovernment.moaspss.util.DOMUtils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
import iaik.asn1.structures.AlgorithmID;
import iaik.security.ec.provider.ECCelerate;
import iaik.security.provider.IAIK;
+import lombok.Getter;
public class MoaSigInitializer {
private static final Logger log = LoggerFactory.getLogger(MoaSigInitializer.class);
@@ -31,18 +33,15 @@ public class MoaSigInitializer {
@Autowired(required = false)
ISchemaRessourceProvider[] schemas;
- private Configurator moaSigConfigurator;
-
/**
* Get MOA-Sig configuration object.
- *
- * @return moa-sig configuration
*/
- @Nonnull
- public Configurator getMoaSigConfigurator() {
- return moaSigConfigurator;
+ @Getter
+ private Configurator moaSigConfigurator;
+
+ @Getter
+ private ConfigurationProvider moaSigConfig;
- }
@PostConstruct
private synchronized void initialize() throws MoaSigServiceConfigurationException {
@@ -53,20 +52,16 @@ public class MoaSigInitializer {
//ECCelerate.addAsProvider();
Security.addProvider(new IAIK());
Security.addProvider(new ECCelerate());
-
+
try {
LoggingContextManager.getInstance().setLoggingContext(new LoggingContext("startup"));
log.debug("MOA-Sig library initialization process ... ");
- Configurator.getInstance().init();
- log.info("MOA-Sig library initialization complete ");
+ moaSigConfigurator = Configurator.getInstance();
+ moaSigConfigurator.init();
- //Security.insertProviderAt(IAIK.getInstance(), 0);
+ moaSigConfig = ConfigurationProvider.getInstance();
- //final ECCelerate eccProvider = ECCelerate.getInstance();
- //if (Security.getProvider(eccProvider.getName()) != null) {
- // Security.removeProvider(eccProvider.getName());
- //}
- //Security.addProvider(new ECCelerate());
+ log.info("MOA-Sig library initialization complete ");
fixJava8_141ProblemWithSslAlgorithms();
@@ -101,8 +96,6 @@ public class MoaSigInitializer {
}
}
- moaSigConfigurator = Configurator.getInstance();
-
} catch (final MOAException e) {
log.error("MOA-SP initialization FAILED!", e.getWrapped());
throw new MoaSigServiceConfigurationException("service.moasig.04",