aboutsummaryrefslogtreecommitdiff
path: root/id
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2014-04-10 14:24:11 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2014-04-10 14:24:11 +0200
commitb3d3d3af963ed03704d73272aaf906e2eb109c0d (patch)
treeed2788300338b410e3a708c2d7d543d56960c7bd /id
parent42819b8b0bc4a99a0e9ff47ea9d4b3228bc0648f (diff)
downloadmoa-id-spss-b3d3d3af963ed03704d73272aaf906e2eb109c0d.tar.gz
moa-id-spss-b3d3d3af963ed03704d73272aaf906e2eb109c0d.tar.bz2
moa-id-spss-b3d3d3af963ed03704d73272aaf906e2eb109c0d.zip
change all file paths to relative or absolute paths
Diffstat (limited to 'id')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java58
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/MailHelper.java19
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/monitoring/IdentityLinkTestModule.java8
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/monitoring/TestManager.java3
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/OAuth20Configuration.java5
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/config/PVPConfiguration.java7
6 files changed, 47 insertions, 53 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java
index e65163946..bcc9a87ab 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java
@@ -55,6 +55,7 @@ import at.gv.egovernment.moa.id.configuration.auth.pvp2.MetaDataVerificationFilt
import at.gv.egovernment.moa.id.configuration.exception.ConfigurationException;
import at.gv.egovernment.moa.id.configuration.utils.UserRequestCleaner;
import at.gv.egovernment.moa.id.protocols.pvp2x.config.PVPConfiguration;
+import at.gv.egovernment.moa.util.FileUtils;
import at.gv.egovernment.moa.util.MiscUtil;
@@ -190,14 +191,15 @@ public class ConfigurationProvider {
}
- String file = getPVP2MetadataKeystoreURL();
- log.debug("Load KeyStore from URL " + file);
- if (MiscUtil.isEmpty(file)) {
+ String fileURL = getPVP2MetadataKeystoreURL();
+ log.debug("Load KeyStore from URL " + fileURL);
+ if (MiscUtil.isEmpty(fileURL)) {
log.info("Metadata KeyStoreURL is empty");
throw new ConfigurationException("Metadata KeyStoreURL is empty");
}
-
- FileInputStream inputStream = new FileInputStream(file);
+
+ URL keystoreURL = new URL((FileUtils.makeAbsoluteURL(fileURL, getConfigRootDir())));
+ InputStream inputStream = keystoreURL.openStream();
keyStore.load(inputStream, getPVP2MetadataKeystorePassword().toCharArray());
inputStream.close();
}
@@ -344,11 +346,7 @@ public class ConfigurationProvider {
String url = props.getProperty("general.mail.useraccountrequest.verification.template");
if (MiscUtil.isNotEmpty(url)) {
- if (url.startsWith(Constants.FILEPREFIX))
- return url;
-
- else
- return configRootDir + "/" + url;
+ return url;
} else {
log.warn("MailUserAcountVerificationTemplate is empty");
@@ -363,19 +361,15 @@ public class ConfigurationProvider {
public String getMailUserAcountActivationTemplate() throws ConfigurationException {
String url = props.getProperty("general.mail.useraccountrequest.isactive.template");
-
if (MiscUtil.isNotEmpty(url)) {
- if (url.startsWith(Constants.FILEPREFIX))
- return url;
-
- else
- return configRootDir + "/" + url;
-
+ return url;
+
} else {
- log.warn("MailUserAcountVerificationTemplate is empty");
+ log.warn("MailUserAcountActivationTemplate is empty");
throw new ConfigurationException("MailUserAcountActivationTemplate is empty");
-
+
}
+
}
public String getMailOAActivationSubject() {
@@ -394,29 +388,22 @@ public class ConfigurationProvider {
String url = props.getProperty("general.mail.createOArequest.isactive.template");
if (MiscUtil.isNotEmpty(url)) {
- if (url.startsWith(Constants.FILEPREFIX))
- return url;
-
- else
- return configRootDir + "/" + url;
-
+ return url;
+
} else {
log.warn("MailOAActivationTemplate is empty");
throw new ConfigurationException("MailOAActivationTemplate is empty");
-
+
}
+
}
public String getMailUserAcountRevocationTemplate() throws ConfigurationException {
String url = props.getProperty("general.mail.useraccountrequest.rejected.template");
if (MiscUtil.isNotEmpty(url)) {
- if (url.startsWith(Constants.FILEPREFIX))
return url;
-
- else
- return configRootDir + "/" + url;
-
+
} else {
log.warn("MailUserAcountVerificationTemplate is empty");
throw new ConfigurationException("MailUserAcountRevocationTemplate is empty");
@@ -432,11 +419,7 @@ public class ConfigurationProvider {
String url = props.getProperty("general.mail.admin.adresses.template");
if (MiscUtil.isNotEmpty(url)) {
- if (url.startsWith(Constants.FILEPREFIX))
- return url;
-
- else
- return configRootDir + "/" + url;
+ return url;
} else {
log.warn("MailUserAcountVerificationTemplate is empty");
@@ -462,7 +445,8 @@ public class ConfigurationProvider {
throw new ConfigurationException("NO IDP Certificate to verify IDP Metadata");
}
- InputStream certstream = new FileInputStream(metadataCert);
+ URL keystoreURL = new URL((FileUtils.makeAbsoluteURL(metadataCert, getConfigRootDir())));
+ InputStream certstream = keystoreURL.openStream();
X509Certificate cert = new X509Certificate(certstream);
BasicX509Credential idpCredential = new BasicX509Credential();
idpCredential.setEntityCertificate(cert);
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/MailHelper.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/MailHelper.java
index 0aeed8cb5..caed3e469 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/MailHelper.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/MailHelper.java
@@ -27,6 +27,7 @@ import java.io.FileInputStream;
import java.io.InputStream;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
+import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
@@ -48,6 +49,7 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
import at.gv.egovernment.moa.id.configuration.Constants;
import at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider;
import at.gv.egovernment.moa.id.configuration.exception.ConfigurationException;
+import at.gv.egovernment.moa.util.FileUtils;
import at.gv.egovernment.moa.util.MiscUtil;
public class MailHelper {
@@ -67,7 +69,7 @@ public class MailHelper {
ConfigurationProvider config = ConfigurationProvider.getInstance();
String templateurl = config.getMailUserAcountVerificationTemplate();
- String template = readTemplateFromURL(templateurl);
+ String template = readTemplateFromURL(templateurl, config.getConfigRootDir());
if (userdb.isIsMandateUser() != null && userdb.isIsMandateUser()) {
template = template.replace(PATTERN_GIVENNAME, userdb.getInstitut());
@@ -100,7 +102,7 @@ public class MailHelper {
ConfigurationProvider config = ConfigurationProvider.getInstance();
String templateurl = config.getMailAdminTemplate();
- String template = readTemplateFromURL(templateurl);
+ String template = readTemplateFromURL(templateurl, config.getConfigRootDir());
template = template.replace(PATTERN_OPENOAS, String.valueOf(numOpenOAs));
template = template.replace(PATTERN_OPENUSERS, String.valueOf(numOpenUsers));
@@ -115,7 +117,7 @@ public class MailHelper {
ConfigurationProvider config = ConfigurationProvider.getInstance();
String templateurl = config.getMailUserAcountActivationTemplate();
- String template = readTemplateFromURL(templateurl);
+ String template = readTemplateFromURL(templateurl, config.getConfigRootDir());
if (MiscUtil.isNotEmpty(institut)) {
template = template.replace(PATTERN_GIVENNAME, institut);
template = template.replace(PATTERN_FAMILYNAME, "");
@@ -143,7 +145,7 @@ public class MailHelper {
ConfigurationProvider config = ConfigurationProvider.getInstance();
String templateurl = config.getMailOAActivationTemplate();
- String template = readTemplateFromURL(templateurl);
+ String template = readTemplateFromURL(templateurl, config.getConfigRootDir());
if (MiscUtil.isNotEmpty(institut)) {
template = template.replace(PATTERN_GIVENNAME, institut);
template = template.replace(PATTERN_FAMILYNAME, "");
@@ -172,7 +174,7 @@ public class MailHelper {
ConfigurationProvider config = ConfigurationProvider.getInstance();
String templateurl = config.getMailUserAcountRevocationTemplate();
- String template = readTemplateFromURL(templateurl);
+ String template = readTemplateFromURL(templateurl, config.getConfigRootDir());
if (userdb.isIsMandateUser() != null && userdb.isIsMandateUser()) {
template = template.replace(PATTERN_GIVENNAME, userdb.getInstitut());
@@ -190,11 +192,12 @@ public class MailHelper {
userdb.getMail(), template);
}
- private static String readTemplateFromURL(String templateurl) throws ConfigurationException {
+ private static String readTemplateFromURL(String templateurl, String rootDir) throws ConfigurationException {
InputStream input;
try {
- File file = new File(templateurl);
- input = new FileInputStream(file);
+
+ URL keystoreURL = new URL(FileUtils.makeAbsoluteURL(templateurl, rootDir));
+ input = keystoreURL.openStream();
StringWriter writer = new StringWriter();
IOUtils.copy(input, writer);
input.close();
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/monitoring/IdentityLinkTestModule.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/monitoring/IdentityLinkTestModule.java
index b95c08044..6c2f3e75a 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/monitoring/IdentityLinkTestModule.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/monitoring/IdentityLinkTestModule.java
@@ -22,9 +22,8 @@
*******************************************************************************/
package at.gv.egovernment.moa.id.monitoring;
-import java.io.File;
-import java.io.FileInputStream;
import java.io.InputStream;
+import java.net.URL;
import java.util.List;
import org.w3c.dom.Element;
@@ -49,8 +48,9 @@ public class IdentityLinkTestModule implements TestModuleInterface {
public void initializeTest(long delayParam, String url) throws Exception{
if (MiscUtil.isNotEmpty(url)) {
- File idlfile = new File(url);
- InputStream idlstream = new FileInputStream(idlfile);
+
+ URL keystoreURL = new URL(url);
+ InputStream idlstream = keystoreURL.openStream();
identityLink = new IdentityLinkAssertionParser(idlstream).parseIdentityLink();
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/monitoring/TestManager.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/monitoring/TestManager.java
index ccfa6d5d1..84581abe8 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/monitoring/TestManager.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/monitoring/TestManager.java
@@ -30,6 +30,7 @@ import java.util.Map;
import at.gv.egovernment.moa.id.config.ConfigurationException;
import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider;
import at.gv.egovernment.moa.logging.Logger;
+import at.gv.egovernment.moa.util.FileUtils;
public class TestManager {
@@ -54,7 +55,7 @@ public class TestManager {
//add IdentityLink verification test
IdentityLinkTestModule test2 = new IdentityLinkTestModule();
- String idlurl = config.getMonitoringTestIdentityLinkURL();
+ String idlurl = FileUtils.makeAbsoluteURL(config.getMonitoringTestIdentityLinkURL(), config.getRootConfigFileDir());
try {
test2.initializeTest(0, idlurl);
tests.put(test2.getName(), test2);;
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/OAuth20Configuration.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/OAuth20Configuration.java
index 8d45a5d86..93a2f7d6d 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/OAuth20Configuration.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/OAuth20Configuration.java
@@ -26,6 +26,7 @@ import java.util.Properties;
import at.gv.egovernment.moa.id.config.ConfigurationException;
import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider;
+import at.gv.egovernment.moa.util.FileUtils;
public class OAuth20Configuration {
@@ -44,10 +45,12 @@ public class OAuth20Configuration {
public static final String JWT_KEY_PASSWORD = "jwt.ks.key.password";
private Properties props;
+ private String rootDir = null;
private OAuth20Configuration() {
try {
props = AuthConfigurationProvider.getInstance().getGeneralOAuth20ProperiesConfig();
+ rootDir = AuthConfigurationProvider.getInstance().getRootConfigFileDir();
}
catch (ConfigurationException e) {
e.printStackTrace();
@@ -55,7 +58,7 @@ public class OAuth20Configuration {
}
public String getJWTKeyStore() {
- return props.getProperty(JWT_KEYSTORE);
+ return FileUtils.makeAbsoluteURL(props.getProperty(JWT_KEYSTORE), rootDir);
}
public String getJWTKeyStorePassword() {
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/config/PVPConfiguration.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/config/PVPConfiguration.java
index ebfffb648..9f2ad2e1b 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/config/PVPConfiguration.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/config/PVPConfiguration.java
@@ -55,6 +55,7 @@ import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider;
import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;
import at.gv.egovernment.moa.id.protocols.pvp2x.utils.SAML2Utils;
import at.gv.egovernment.moa.logging.Logger;
+import at.gv.egovernment.moa.util.FileUtils;
import at.gv.egovernment.moa.util.MiscUtil;
public class PVPConfiguration {
@@ -112,12 +113,14 @@ public class PVPConfiguration {
//PVP2 generalpvpconfigdb;
Properties props;
+ String rootDir = null;
private PVPConfiguration() {
try {
//generalpvpconfigdb = AuthConfigurationProvider.getInstance().getGeneralPVP2DBConfig();
props = AuthConfigurationProvider.getInstance().getGeneralPVP2ProperiesConfig();
-
+ rootDir = AuthConfigurationProvider.getInstance().getRootConfigFileDir();
+
} catch (ConfigurationException e) {
e.printStackTrace();
}
@@ -147,7 +150,7 @@ public class PVPConfiguration {
}
public String getIDPKeyStoreFilename() {
- return props.getProperty(IDP_JAVAKEYSTORE);
+ return FileUtils.makeAbsoluteURL(props.getProperty(IDP_JAVAKEYSTORE), rootDir);
}
public String getIDPKeyStorePassword() {