diff options
Diffstat (limited to 'id.server/src/at/gv/egovernment/moa/id/config')
5 files changed, 118 insertions, 10 deletions
diff --git a/id.server/src/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java b/id.server/src/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java index f91222ac3..6d3e05c29 100644 --- a/id.server/src/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java +++ b/id.server/src/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java @@ -111,7 +111,9 @@ public class ConfigurationBuilder { private static final String OA_PROXY_SESSION_TIMEOUT_XPATH = CONF + "ProxyComponent/@sessionTimeOut"; /** an XPATH-Expression */ private static final String OA_PROXY_LOGIN_PARA_XPATH = CONF + "ProxyComponent/@loginParameterResolverImpl"; - /** an XPATH-Expression */ + /** an XPATH-Expression */ + private static final String OA_PROXY_LOGIN_PARA_CONF_XPATH = CONF + "ProxyComponent/@loginParameterResolverConfiguration"; + /** an XPATH-Expression */ private static final String OA_PROXY_CONNECTION_BUILDER_XPATH = CONF + "ProxyComponent/@connectionBuilderImpl"; /** an XPATH-Expression */ private static final String CONNECTION_PARAMETER_URL_XPATH = @@ -160,6 +162,12 @@ public class ConfigurationBuilder { private static final String TRUSTED_CA_CERTIFICATES_XPATH = ROOT + CONF + "TrustedCACertificates"; + + /** + * main configuration file directory name used to configure MOA-ID + */ + private String rootConfigFileDir; + /** The root element of the MOA-ID configuration */ private Element configElem; @@ -168,8 +176,9 @@ public class ConfigurationBuilder { * * @param configElem The root element of the MOA-ID configuration. */ - public ConfigurationBuilder(Element configElem) { + public ConfigurationBuilder(Element configElem, String rootConfigDir) { this.configElem = configElem; + this.rootConfigFileDir = rootConfigDir; } /** @@ -386,10 +395,18 @@ public class ConfigurationBuilder { ConnectionParameter result = new ConnectionParameter(); result.setAcceptedServerCertificates( XPathUtils.getElementValue(root,CONNECTION_PARAMETER_ACCEPTED_CERTS_XPATH,null)); + + result.setAcceptedServerCertificates(FileUtils.makeAbsoluteURL( + result.getAcceptedServerCertificates(), rootConfigFileDir)); + result.setUrl( XPathUtils.getAttributeValue(root, CONNECTION_PARAMETER_URL_XPATH, "")); result.setClientKeyStore( XPathUtils.getElementValue(root,CONNECTION_PARAMETERN_KEYSTORE_XPATH,null)); + + result.setClientKeyStore(FileUtils.makeAbsoluteURL( + result.getClientKeyStore(), rootConfigFileDir)); + result.setClientKeyStorePassword( XPathUtils.getAttributeValue(root,CONNECTION_PARAMETER_KEYSTORE_PASS_XPATH,"")); @@ -422,9 +439,11 @@ public class ConfigurationBuilder { Element proxyComponentElem = (Element) XPathUtils.selectSingleNode(oAElem,OA_PROXY_COMPONENT_XPATH); if (proxyComponentElem != null) { oap.setConfigFileURL(XPathUtils.getAttributeValue(oAElem, OA_PROXY_URL_XPATH, null)); + oap.setConfigFileURL(FileUtils.makeAbsoluteURL(oap.getConfigFileURL(), rootConfigFileDir)); // default session time out: 3600 sec = 1 h oap.setSessionTimeOut(new Integer(XPathUtils.getAttributeValue(oAElem,OA_PROXY_SESSION_TIMEOUT_XPATH,"3600")).intValue()); oap.setLoginParameterResolverImpl(XPathUtils.getAttributeValue(oAElem, OA_PROXY_LOGIN_PARA_XPATH, null)); + oap.setLoginParameterResolverConfiguration(XPathUtils.getAttributeValue(oAElem, OA_PROXY_LOGIN_PARA_CONF_XPATH, null)); oap.setConnectionBuilderImpl(XPathUtils.getAttributeValue(oAElem,OA_PROXY_CONNECTION_BUILDER_XPATH, null)); ConnectionParameter conPara = buildConnectionParameter(proxyComponentElem); diff --git a/id.server/src/at/gv/egovernment/moa/id/config/ConfigurationProvider.java b/id.server/src/at/gv/egovernment/moa/id/config/ConfigurationProvider.java index 5d523ba62..48e82011d 100644 --- a/id.server/src/at/gv/egovernment/moa/id/config/ConfigurationProvider.java +++ b/id.server/src/at/gv/egovernment/moa/id/config/ConfigurationProvider.java @@ -34,7 +34,14 @@ public class ConfigurationProvider { * The name of the generic configuration property giving the certstore directory path. */ public static final String DIRECTORY_CERTSTORE_PARAMETER_PROPERTY = - "DirectoryCertStoreParameters.RootDir"; + "DirectoryCertStoreParameters.RootDir"; + + /** + * The name of the generic configuration property switching the ssl revocation checking on/off + */ + public static final String TRUST_MANAGER_REVOCATION_CHECKING = + "TrustManager.RevocationChecking"; + /** * A <code>Map</code> which contains generic configuration information. Maps a @@ -100,6 +107,8 @@ public class ConfigurationProvider { * @return String */ public String getTrustedCACertificates() { + return trustedCACertificates; } + } diff --git a/id.server/src/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java b/id.server/src/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java index e3c869d53..2e133130c 100644 --- a/id.server/src/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java +++ b/id.server/src/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java @@ -1,10 +1,11 @@ package at.gv.egovernment.moa.id.config.auth; import java.io.BufferedInputStream; +import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; - +import java.net.MalformedURLException; import org.w3c.dom.Element; import at.gv.egovernment.moa.id.config.ConfigurationBuilder; @@ -59,6 +60,20 @@ public class AuthConfigurationProvider extends ConfigurationProvider { */ public static final String BKU_SELECTION_TYPE_HTMLSELECT = "HTMLSelect"; + + /** + * The name of the generic configuration property allowing https connection to + * the user frontend servlets ("StartAuthentication" and "SelectBKU" servlets) + */ + public static final String FRONTEND_SERVLETS_ENABLE_HTTP_CONNECTION_PROPERTY = + "FrontendServlets.EnableHTTPConnection"; + + /** + * The name of the generic configuration property allowing to set a individual + * DATA URL used to communicate with the BKU (SecurityLayer) + */ + public static final String INDIVIDUAL_DATA_URL_PREFIX = + "FrontendServlets.DataURLPrefix"; /** Singleton instance. <code>null</code>, if none has been created. */ private static AuthConfigurationProvider instance; @@ -67,6 +82,11 @@ public class AuthConfigurationProvider extends ConfigurationProvider { // configuration data // + /** + * main configuration file directory name used to configure MOA-ID + */ + private String rootConfigFileDir; + /** * configuration files containing transformations for rendering in the * secure viewer of the security layer implementation; @@ -172,7 +192,7 @@ public class AuthConfigurationProvider extends ConfigurationProvider { InputStream stream = null; Element configElem; ConfigurationBuilder builder; - + try { // load the main config file stream = new BufferedInputStream(new FileInputStream(fileName)); @@ -189,8 +209,16 @@ public class AuthConfigurationProvider extends ConfigurationProvider { } } try { + // determine the directory of the root config file + rootConfigFileDir = new File(fileName).getParent(); + try { + rootConfigFileDir = new File(rootConfigFileDir).toURL().toString(); + } catch (MalformedURLException t) { + throw new ConfigurationException("config.03", null, t); + } + // build the internal datastructures - builder = new ConfigurationBuilder(configElem); + builder = new ConfigurationBuilder(configElem, rootConfigFileDir); bKUConnectionParameter = builder.buildAuthBKUConnectionParameter(); bKUSelectable = (bKUConnectionParameter!=null); bKUSelectionType = builder.buildAuthBKUSelectionType(); @@ -205,7 +233,9 @@ public class AuthConfigurationProvider extends ConfigurationProvider { identityLinkX509SubjectNames = builder.getIdentityLink_X509SubjectNames(); defaultChainingMode = builder.getDefaultChainingMode(); chainingModes = builder.buildChainingModes(); - trustedCACertificates = builder.getTrustedCACertificates(); } + trustedCACertificates = builder.getTrustedCACertificates(); + trustedCACertificates = FileUtils.makeAbsoluteURL(trustedCACertificates, rootConfigFileDir); } + catch (Throwable t) { throw new ConfigurationException("config.02", null, t); } @@ -216,9 +246,13 @@ public class AuthConfigurationProvider extends ConfigurationProvider { * @throws Exception on any exception thrown */ private void loadTransformsInfos() throws Exception { + 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; } diff --git a/id.server/src/at/gv/egovernment/moa/id/config/proxy/OAProxyParameter.java b/id.server/src/at/gv/egovernment/moa/id/config/proxy/OAProxyParameter.java index f08c60736..a16dcfa26 100644 --- a/id.server/src/at/gv/egovernment/moa/id/config/proxy/OAProxyParameter.java +++ b/id.server/src/at/gv/egovernment/moa/id/config/proxy/OAProxyParameter.java @@ -26,6 +26,12 @@ public class OAProxyParameter { * defaults to {@link at.gv.egovernment.moa.id.proxy.DefaultLoginParameterResolver} */ private String loginParameterResolverImpl; + + /** + * Configuration Parameter of LoginParameterResolver + */ + private String loginParameterResolverConfiguration; + /** * implementation of {@link at.gv.egovernment.moa.id.proxy.ConnectionBuilder} interface * to be used for connecting to the online application; @@ -44,6 +50,7 @@ public class OAProxyParameter { * parameters for logging into the online application */ private OAConfiguration oaConfiguration; + /** * Returns the configFileURL. @@ -126,6 +133,14 @@ public class OAProxyParameter { } /** + * Returns the loginParameterResolverConfiguration. + * @return String + */ + public String getLoginParameterResolverConfiguration() { + return loginParameterResolverConfiguration; + } + + /** * Sets the connectionBuilderImpl. * @param connectionBuilderImpl The connectionBuilderImpl to set */ @@ -142,6 +157,14 @@ public class OAProxyParameter { } /** + * Sets the loginParameterResolverConfiguration. + * @param loginParameterResolverImpl The loginParameterResolverImpl to set + */ + public void setLoginParameterResolverConfiguration(String loginParameterResolverConfiguration) { + this.loginParameterResolverConfiguration = loginParameterResolverConfiguration; + } + + /** * Returns the oaConfiguration. * @return OAConfiguration */ diff --git a/id.server/src/at/gv/egovernment/moa/id/config/proxy/ProxyConfigurationProvider.java b/id.server/src/at/gv/egovernment/moa/id/config/proxy/ProxyConfigurationProvider.java index 897d14da9..622ae6f82 100644 --- a/id.server/src/at/gv/egovernment/moa/id/config/proxy/ProxyConfigurationProvider.java +++ b/id.server/src/at/gv/egovernment/moa/id/config/proxy/ProxyConfigurationProvider.java @@ -1,7 +1,9 @@ package at.gv.egovernment.moa.id.config.proxy; +import java.io.File; import java.io.FileInputStream; import java.io.IOException; +import java.net.MalformedURLException; import org.w3c.dom.Element; @@ -11,6 +13,7 @@ import at.gv.egovernment.moa.id.config.ConfigurationProvider; import at.gv.egovernment.moa.id.config.ConnectionParameter; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.DOMUtils; +import at.gv.egovernment.moa.util.FileUtils; /** * A class providing access to the Proxy Part of the MOA-ID configuration data. @@ -32,6 +35,11 @@ public class ProxyConfigurationProvider extends ConfigurationProvider { /** Singleton instance. <code>null</code>, if none has been created. */ private static ProxyConfigurationProvider instance; + /** + * main configuration file directory name used to configure MOA-ID + */ + private String rootConfigFileDir; + // // configuration data // @@ -117,14 +125,29 @@ public class ProxyConfigurationProvider extends ConfigurationProvider { } } try { + // determine the directory of the root config file + rootConfigFileDir = new File(fileName).getParent(); + try { + rootConfigFileDir = new File(rootConfigFileDir).toURL().toString(); + } catch (MalformedURLException t) { + throw new ConfigurationException("config.03", null, t); + } + // build the internal datastructures - builder = new ConfigurationBuilder(configElem); + builder = new ConfigurationBuilder(configElem, rootConfigFileDir); authComponentConnectionParameter = builder.buildAuthComponentConnectionParameter(); - onlineApplicationProxyParameter = builder.buildOnlineApplicationProxyParameters(); + + onlineApplicationProxyParameter = builder.buildOnlineApplicationProxyParameters(); + for(int i = 0; i < onlineApplicationProxyParameter.length; i++) { + onlineApplicationProxyParameter[i].setConfigFileURL(FileUtils.makeAbsoluteURL(onlineApplicationProxyParameter[i].getConfigFileURL(), rootConfigFileDir)); + } + genericConfiguration = builder.buildGenericConfiguration(); defaultChainingMode = builder.getDefaultChainingMode(); chainingModes = builder.buildChainingModes(); trustedCACertificates = builder.getTrustedCACertificates(); + trustedCACertificates = FileUtils.makeAbsoluteURL(trustedCACertificates, rootConfigFileDir); + } catch (Throwable t) { throw new ConfigurationException("config.02", null, t); @@ -166,5 +189,5 @@ public class ProxyConfigurationProvider extends ConfigurationProvider { } return null; } - + }
\ No newline at end of file |