From 84b4c1da0e05567812ea30e899a4a28f9d421bc0 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 8 Aug 2013 15:51:10 +0200 Subject: some changes in LegacyConfigImporter --- .../id/config/legacy/BuildFromLegacyConfig.java | 29 +++++++++++----------- .../moa/id/config/legacy/ConfigurationBuilder.java | 26 ++++++++++++------- 2 files changed, 32 insertions(+), 23 deletions(-) (limited to 'id/server') diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java index 0c5a50393..762669a70 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java @@ -82,7 +82,7 @@ public class BuildFromLegacyConfig { private static final String GENERIC_CONFIG_PARAM_SOURCEID = "AuthenticationServer.SourceID"; - public static MOAIDConfiguration build(String fileName, String rootConfigFileDir, Properties properies) throws ConfigurationException { + public static MOAIDConfiguration build(File fileName, String rootConfigFileDir) throws ConfigurationException { InputStream stream = null; Element configElem; ConfigurationBuilder builder; @@ -435,20 +435,21 @@ public class BuildFromLegacyConfig { //OA_PVP2 OAPVP2 oa_pvp2 = new OAPVP2(); oa_auth.setOAPVP2(oa_pvp2); - oa_pvp2.setMetadataURL("TODO!!!"); - //TODO: is only a workaround!!!! - Properties props = getGeneralPVP2ProperiesConfig(properies); - File dir = new File(props.getProperty("idp.truststore")); - File[] files = dir.listFiles(); - if (files.length > 0) { - FileInputStream filestream = new FileInputStream(files[0]); - X509Certificate signerCertificate = new X509Certificate(filestream); - oa_pvp2.setCertificate(signerCertificate.getEncoded()); - - } else { - oa_pvp2.setCertificate(null); - } +// oa_pvp2.setMetadataURL("empty"); +// +// //TODO: is only a workaround!!!! +// Properties props = getGeneralPVP2ProperiesConfig(properies); +// File dir = new File(props.getProperty("idp.truststore")); +// File[] files = dir.listFiles(); +// if (files.length > 0) { +// FileInputStream filestream = new FileInputStream(files[0]); +// X509Certificate signerCertificate = new X509Certificate(filestream); +// oa_pvp2.setCertificate(signerCertificate.getEncoded()); +// +// } else { +// oa_pvp2.setCertificate(null); +// } //moa_oas.add(moa_oa); ConfigurationDBUtils.save(moa_oa); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/ConfigurationBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/ConfigurationBuilder.java index c2898f314..1dfebea03 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/ConfigurationBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/ConfigurationBuilder.java @@ -65,6 +65,7 @@ import at.gv.egovernment.moa.util.BoolUtils; import at.gv.egovernment.moa.util.Constants; import at.gv.egovernment.moa.util.DOMUtils; import at.gv.egovernment.moa.util.FileUtils; +import at.gv.egovernment.moa.util.MiscUtil; import at.gv.egovernment.moa.util.StringUtils; import at.gv.egovernment.moa.util.XPathException; import at.gv.egovernment.moa.util.XPathUtils; @@ -406,15 +407,22 @@ public class ConfigurationBuilder { */ public String[] loadTransformsInfos(String[] transformsInfoFileNames) throws Exception { - String[] transformsInfos = new String[transformsInfoFileNames.length]; - for (int i = 0; i < transformsInfoFileNames.length; i++) { - String fileURL = transformsInfoFileNames[i]; - - //if fileURL is relative to rootConfigFileDir make it absolute - fileURL = FileUtils.makeAbsoluteURL(fileURL, rootConfigFileDir_); - String transformsInfo = FileUtils.readURL(fileURL, DEFAULT_ENCODING); - transformsInfos[i] = transformsInfo; - } + String[] transformsInfos; + + if (MiscUtil.isNotEmpty(rootConfigFileDir_)) { + transformsInfos = new String[transformsInfoFileNames.length]; + for (int i = 0; i < transformsInfoFileNames.length; i++) { + String fileURL = transformsInfoFileNames[i]; + + //if fileURL is relative to rootConfigFileDir make it absolute + fileURL = FileUtils.makeAbsoluteURL(fileURL, rootConfigFileDir_); + String transformsInfo = FileUtils.readURL(fileURL, DEFAULT_ENCODING); + transformsInfos[i] = transformsInfo; + } + + } else + transformsInfos = new String[0]; + return transformsInfos; } -- cgit v1.2.3