summaryrefslogtreecommitdiff
path: root/eaaf_core_utils
diff options
context:
space:
mode:
Diffstat (limited to 'eaaf_core_utils')
-rw-r--r--eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/HttpClientFactory.java22
1 files changed, 10 insertions, 12 deletions
diff --git a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/HttpClientFactory.java b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/HttpClientFactory.java
index bfbe6ae2..d1cde6fa 100644
--- a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/HttpClientFactory.java
+++ b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/HttpClientFactory.java
@@ -1,8 +1,7 @@
package at.gv.egiz.eaaf.core.impl.utils;
-import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
@@ -38,6 +37,8 @@ import org.apache.http.ssl.SSLContexts;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.ResourceLoader;
import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
import at.gv.egiz.eaaf.core.exceptions.EAAFConfigurationException;
@@ -45,6 +46,7 @@ import at.gv.egiz.eaaf.core.exceptions.EAAFConfigurationException;
public class HttpClientFactory implements IHttpClientFactory {
private static final Logger log = LoggerFactory.getLogger(HttpClientFactory.class);
@Autowired(required=true) private IConfiguration basicConfig;
+ @Autowired(required=true) ResourceLoader resourceLoader;
public static final String PROP_CONFIG_CLIENT_HTTP_CONNECTION_POOL_USE = "client.http.connection.pool.use";
public static final String PROP_CONFIG_CLIENT_HTTP_CONNECTION_POOL_MAXTOTAL = "client.http.connection.pool.maxtotal";
@@ -270,17 +272,13 @@ public class HttpClientFactory implements IHttpClientFactory {
log.debug("Read keyStore path: {} from configuration", localKeyStorePath);
if (StringUtils.isNotEmpty(localKeyStorePath)) {
- String absFilePath = FileUtils.makeAbsoluteURL(localKeyStorePath, basicConfig.getConfigurationRootDirectory());
-
- if (absFilePath.startsWith("file:")) {
- absFilePath = absFilePath.substring("file:".length());
-
- }
-
- final File keyStoreFile = new File(absFilePath);
+ final String absFilePath = FileUtils.makeAbsoluteURL(localKeyStorePath, basicConfig.getConfigurationRootDirectory());
+ final Resource ressource = resourceLoader.getResource(absFilePath);
+ final InputStream is = ressource.getInputStream();
log.trace("Load keyStore: {} with password: {}", absFilePath, keyStorePassword);
- clientStore.load(new FileInputStream(keyStoreFile), keyStorePassword.toCharArray());
-
+ clientStore.load(is, keyStorePassword.toCharArray());
+ is.close();
+
return clientStore;
} else {