aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/moazs/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/config')
-rw-r--r--src/main/java/at/gv/egiz/moazs/config/MoaSigConfig.java19
1 files changed, 8 insertions, 11 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 05ecac1..0b7bdc7 100644
--- a/src/main/java/at/gv/egiz/moazs/config/MoaSigConfig.java
+++ b/src/main/java/at/gv/egiz/moazs/config/MoaSigConfig.java
@@ -2,10 +2,12 @@ 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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -28,15 +30,18 @@ public class MoaSigConfig {
private final String keyStoreType;
private final String defaultTrustProfile;
private final String spssConfigFilePath;
+ private final FileUtils fileUtils;
public MoaSigConfig(@Value("${javax.net.ssl.trustStoreType}") String trustStoreType,
@Value("${javax.net.ssl.keyStoreType}") String keyStoreType,
@Value("${moa.spss.server.default-trustprofile}") String defaultTrustProfile,
- @Value("${moa.spss.server.configuration}") String spssConfigFilePath) throws FileNotFoundException {
+ @Value("${moa.spss.server.configuration}") String spssConfigFilePath,
+ @Autowired FileUtils fileUtils) throws FileNotFoundException {
this.trustStoreType = trustStoreType;
this.keyStoreType = keyStoreType;
this.defaultTrustProfile = defaultTrustProfile;
this.spssConfigFilePath = spssConfigFilePath;
+ this.fileUtils = fileUtils;
fallBackToSpringEnvForMoaSPSSConfigProperty();
fallBackToSpringEnvForJavaxNetSSLStoreTypeProperty();
}
@@ -45,7 +50,7 @@ public class MoaSigConfig {
log.info("value of spssConfigFilePath is {}", spssConfigFilePath);
if(System.getProperty(MOA_SPSS_CONFIG_FILE_PROPERTY) == null) {
- var realPath = determinePath(spssConfigFilePath);
+ var realPath = fileUtils.determinePath(spssConfigFilePath);
var realFile = new File(realPath);
if(realFile.exists() && realFile.canRead()) {
@@ -57,15 +62,7 @@ public class MoaSigConfig {
}
}
- private String determinePath(String abstractPath) {
- if (new File(abstractPath).isAbsolute()) {
- return abstractPath;
- } else {
- //resolve relative path as classpath resource
- //java.lang.Class needs relative resources to start with "/"
- return this.getClass().getResource("/" + abstractPath).getFile();
- }
- }
+
private void fallBackToSpringEnvForJavaxNetSSLStoreTypeProperty() {
if (System.getProperty(JAVAX_SSL_TRUSTSTORE_TYPE_PROPERTY) == null) {