From ff9703e221414e9840638911b53f441eb86afb72 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 3 Jul 2015 13:21:37 +0200 Subject: fix problems with absolut configuration paths --- .../auth/PropertyBasedAuthConfigurationProvider.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'id/server/idserverlib') diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java index 08a8dcdf2..9535c9aa3 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java @@ -5,6 +5,8 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.math.BigInteger; +import java.net.MalformedURLException; +import java.net.URI; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -63,7 +65,14 @@ public class PropertyBasedAuthConfigurationProvider extends ConfigurationProvide public PropertyBasedAuthConfigurationProvider(String fileName) throws ConfigurationException { File propertiesFile = new File(fileName); rootConfigFileDir = propertiesFile.getParent(); - + try { + rootConfigFileDir = new File(rootConfigFileDir).toURI().toURL().toString(); + + } catch (MalformedURLException t) { + throw new ConfigurationException("config.03", null, t); + + } + System.getProperties().setProperty("location", "file:" + fileName); context = new ClassPathXmlApplicationContext( new String[] { "moaid.configuration.beans.xml", @@ -946,7 +955,7 @@ public class PropertyBasedAuthConfigurationProvider extends ConfigurationProvide @Override public String getCertstoreDirectory() { try { - String path = configuration.getStringValue( + String path = rootConfigFileDir + configuration.getStringValue( MOAIDConfigurationConstants.GENERAL_AUTH_CERTSTORE_URL); if (MiscUtil.isNotEmpty(path)) return path; @@ -966,7 +975,7 @@ public class PropertyBasedAuthConfigurationProvider extends ConfigurationProvide @Override public String getTrustedCACertificates() { try { - String path = configuration.getStringValue( + String path = rootConfigFileDir + configuration.getStringValue( MOAIDConfigurationConstants.GENERAL_AUTH_TRUSTSTORE_URL); if (MiscUtil.isNotEmpty(path)) return path; -- cgit v1.2.3