From a1ee0567607fe43909cd7fc1b75ace3197a2fa0b Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 3 Jul 2015 12:47:58 +0200 Subject: fix some configuration problems --- .../moa/id/auth/MOAIDAuthInitializer.java | 77 ++++++++++++---------- .../AuthenticationBlockAssertionBuilder.java | 11 +++- .../CreateXMLSignatureResponseValidator.java | 9 ++- .../moa/id/config/auth/OAAuthParameter.java | 2 +- .../PropertyBasedAuthConfigurationProvider.java | 7 +- .../moa/id/config/stork/STORKConfig.java | 30 +++++---- .../protocols/pvp2x/config/PVPConfiguration.java | 21 +++--- .../id/storage/AuthenticationSessionStoreage.java | 8 ++- 8 files changed, 98 insertions(+), 67 deletions(-) (limited to 'id/server/idserverlib/src/main/java/at/gv') diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthInitializer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthInitializer.java index 39ab28285..65e3b10d7 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthInitializer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthInitializer.java @@ -131,43 +131,50 @@ public class MOAIDAuthInitializer { Constants.nSMap.put(Constants.DSIG_PREFIX, Constants.DSIG_NS_URI); // Loads the configuration - AuthConfiguration authConf = AuthConfigurationProviderFactory.reload(); - - ConnectionParameter moaSPConnParam = authConf - .getMoaSpConnectionParameter(); - - // If MOA-SP API calls: loads MOA-SP configuration and configures IAIK - if (moaSPConnParam == null) { - try { - LoggingContextManager.getInstance().setLoggingContext( - new LoggingContext("startup")); - ConfigurationProvider config = ConfigurationProvider - .getInstance(); - new IaikConfigurator().configure(config); - } catch (at.gv.egovernment.moa.spss.server.config.ConfigurationException ex) { - throw new ConfigurationException("config.10", new Object[] { ex - .toString() }, ex); + try { + AuthConfiguration authConf = AuthConfigurationProviderFactory.reload(); + + ConnectionParameter moaSPConnParam = authConf + .getMoaSpConnectionParameter(); + + // If MOA-SP API calls: loads MOA-SP configuration and configures IAIK + if (moaSPConnParam == null) { + try { + LoggingContextManager.getInstance().setLoggingContext( + new LoggingContext("startup")); + ConfigurationProvider config = ConfigurationProvider + .getInstance(); + new IaikConfigurator().configure(config); + } catch (at.gv.egovernment.moa.spss.server.config.ConfigurationException ex) { + throw new ConfigurationException("config.10", new Object[] { ex + .toString() }, ex); + } } + + // Initializes IAIKX509TrustManager logging + /* + String log4jConfigURL = System.getProperty("log4j.configuration"); + Logger.info("Log4J Configuration: " + log4jConfigURL); + if (log4jConfigURL != null) { + IAIKX509TrustManager.initLog(new LoggerConfigImpl(log4jConfigURL)); + } + */ + + // Initializes the Axis secure socket factory for use in calling the + // MOA-SP web service + if (moaSPConnParam != null && moaSPConnParam.isHTTPSURL()) { + SSLSocketFactory ssf = SSLUtils.getSSLSocketFactory(authConf, + moaSPConnParam); + AxisSecureSocketFactory.initialize(ssf); + } + + + } catch (ConfigurationException e) { + Logger.error("MOA-ID-Auth start-up FAILED. Error during application configuration."); + System.exit(-1); + } - - // Initializes IAIKX509TrustManager logging - /* - String log4jConfigURL = System.getProperty("log4j.configuration"); - Logger.info("Log4J Configuration: " + log4jConfigURL); - if (log4jConfigURL != null) { - IAIKX509TrustManager.initLog(new LoggerConfigImpl(log4jConfigURL)); - } - */ - - // Initializes the Axis secure socket factory for use in calling the - // MOA-SP web service - if (moaSPConnParam != null && moaSPConnParam.isHTTPSURL()) { - SSLSocketFactory ssf = SSLUtils.getSSLSocketFactory(authConf, - moaSPConnParam); - AxisSecureSocketFactory.initialize(ssf); - } - - + // Starts the session cleaner thread to remove unpicked authentication data AuthenticationSessionCleaner.start(); AuthConfigLoader.start(); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilder.java index 6df0c4742..81699bcdf 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilder.java @@ -265,9 +265,12 @@ public class AuthenticationBlockAssertionBuilder extends AuthenticationAssertion String text = ""; try { - OAAuthParameter oaparam = AuthConfigurationProviderFactory.getInstance().getOnlineApplicationParameter(session.getPublicOAURLPrefix()); - if (MiscUtil.isNotEmpty(text = oaparam.getAditionalAuthBlockText())) + OAAuthParameter oaparam = AuthConfigurationProviderFactory.getInstance().getOnlineApplicationParameter(session.getPublicOAURLPrefix()); + if (MiscUtil.isNotEmpty(oaparam.getAditionalAuthBlockText())) { Logger.info("Use addional AuthBlock Text from OA=" + oaparam.getPublicURLPrefix()); + text = oaparam.getAditionalAuthBlockText(); + } + } catch (ConfigurationException e) { Logger.warn("Addional AuthBlock Text can not loaded from OA!", e); } @@ -418,8 +421,10 @@ public class AuthenticationBlockAssertionBuilder extends AuthenticationAssertion String text = ""; try { OAAuthParameter oaparam = AuthConfigurationProviderFactory.getInstance().getOnlineApplicationParameter(session.getPublicOAURLPrefix()); - if (MiscUtil.isNotEmpty(text = oaparam.getAditionalAuthBlockText())) + if (MiscUtil.isNotEmpty(oaparam.getAditionalAuthBlockText())) { Logger.info("Use addional AuthBlock Text from OA=" + oaparam.getPublicURLPrefix()); + text = oaparam.getAditionalAuthBlockText(); + } } catch (ConfigurationException e) { Logger.warn("Addional AuthBlock Text can not loaded from OA!", e); } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/CreateXMLSignatureResponseValidator.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/CreateXMLSignatureResponseValidator.java index 34613e658..e1ab0025e 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/CreateXMLSignatureResponseValidator.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/CreateXMLSignatureResponseValidator.java @@ -293,8 +293,10 @@ public class CreateXMLSignatureResponseValidator { String text = ""; try { OAAuthParameter oaparam = AuthConfigurationProviderFactory.getInstance().getOnlineApplicationParameter(session.getPublicOAURLPrefix()); - if (MiscUtil.isNotEmpty(text = oaparam.getAditionalAuthBlockText())) + if (MiscUtil.isNotEmpty(oaparam.getAditionalAuthBlockText())) { Logger.info("Use addional AuthBlock Text from OA=" + oaparam.getPublicURLPrefix()); + text = oaparam.getAditionalAuthBlockText(); + } } catch (ConfigurationException e) { Logger.warn("Addional AuthBlock Text can not loaded from OA!", e); } @@ -521,8 +523,11 @@ public class CreateXMLSignatureResponseValidator { String text = ""; try { - if (MiscUtil.isNotEmpty(text = AuthConfigurationProviderFactory.getInstance().getSSOSpecialText())) + if (MiscUtil.isNotEmpty(AuthConfigurationProviderFactory.getInstance().getSSOSpecialText())) { + text = AuthConfigurationProviderFactory.getInstance().getSSOSpecialText(); Logger.info("Use addional AuthBlock Text from SSO=" +text); + + } else text = new String(); } catch (ConfigurationException e) { diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java index dfe4a7448..3bf631108 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java @@ -86,7 +86,7 @@ import at.gv.egovernment.moa.util.MiscUtil; */ public class OAAuthParameter implements IOAAuthParameters { - final public static String DEFAULT_KEYBOXIDENTIFIER = "SECURE_SIGNATURE_KEYPAIR"; + final public static String DEFAULT_KEYBOXIDENTIFIER = "SecureSignatureKeypair"; private Map oaConfiguration; 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 60ae3882e..08a8dcdf2 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 @@ -88,6 +88,11 @@ public class PropertyBasedAuthConfigurationProvider extends ConfigurationProvide Logger.error("OpenSAML initilalization FAILED. ", e); throw new ConfigurationException("config.23", null, e); + } catch (Exception e) { + Logger.error("General error during start-up process.", e); + throw new ConfigurationException("init.02", null, e); + + } finally { if (in != null) try { @@ -839,7 +844,7 @@ public class PropertyBasedAuthConfigurationProvider extends ConfigurationProvide STORKConfig result = null; try { Map storkProps = configuration.getPropertySubset( - MOAIDConfigurationConstants.GENERAL_AUTH_STORK); + MOAIDConfigurationConstants.GENERAL_AUTH_STORK + "."); if (storkProps == null) { Logger.warn("Error in MOA-ID Configuration. No STORK configuration found."); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java index c926e2b01..9532aa9ab 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java @@ -38,6 +38,7 @@ import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; import at.gv.egovernment.moa.id.config.ConfigurationException; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory; import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.util.MiscUtil; import at.gv.egovernment.moa.util.StringUtils; /** @@ -65,7 +66,7 @@ public class STORKConfig { Map storkCPEPSProps = AuthConfigurationProviderFactory.getInstance().getConfigurationWithPrefix( - MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST); + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + "."); if (storkCPEPSProps != null) { Set keyValues = storkCPEPSProps.keySet(); for (Object elObj : keyValues) { @@ -74,19 +75,22 @@ public class STORKConfig { if (el.endsWith(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY)) { int index = el.indexOf("."); String listCounter = el.substring(0, index); - try { - CPEPS moacpep = - new CPEPS(storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY), - new URL(storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL)), - Boolean.valueOf(storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_SUPPORT_XMLDSIG))); - cpepsMap.put(moacpep.getCountryCode(), moacpep); + + if (MiscUtil.isNotEmpty(storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY))) { + try { + CPEPS moacpep = + new CPEPS(storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY), + new URL(storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL)), + Boolean.valueOf(storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_SUPPORT_XMLDSIG))); + cpepsMap.put(moacpep.getCountryCode(), moacpep); - } catch (MalformedURLException e) { - Logger.warn("CPEPS URL " + - storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL) + - " are not parseable.", e); - - } + } catch (MalformedURLException e) { + Logger.warn("CPEPS URL " + + storkCPEPSProps.get(listCounter + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL) + + " are not parseable.", e); + + } + } } } } 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 ca95ff90c..de58c34a1 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 @@ -93,16 +93,16 @@ public class PVPConfiguration { public static final String IDP_ISSUER_NAME = "servicename"; - public static final String IDP_ORG_NAME = "org.name.short"; - public static final String IDP_ORG_DISPNAME = "org.name.full"; - public static final String IDP_ORG_URL = "org.url"; - - public static final String IDP_CONTACT_SURNAME = "contact.familyname"; - public static final String IDP_CONTACT_GIVENNAME = "contact.givenname"; - public static final String IDP_CONTACT_MAIL = "contact.mail"; - public static final String IDP_CONTACT_TYPE = "contact.type"; - public static final String IDP_CONTACT_COMPANY = "contact.company"; - public static final String IDP_CONTACT_PHONE = "contact.phone"; + public static final String IDP_ORG_NAME = "name.short"; + public static final String IDP_ORG_DISPNAME = "name.full"; + public static final String IDP_ORG_URL = "url"; + + public static final String IDP_CONTACT_SURNAME = "familyname"; + public static final String IDP_CONTACT_GIVENNAME = "givenname"; + public static final String IDP_CONTACT_MAIL = "mail"; + public static final String IDP_CONTACT_TYPE = "type"; + public static final String IDP_CONTACT_COMPANY = "company"; + public static final String IDP_CONTACT_PHONE = "phone"; private static String moaIDVersion = null; @@ -255,6 +255,7 @@ public class PVPConfiguration { if (type == null) { Logger.error("IDP Contact with SurName " + contacts.get(IDP_CONTACT_SURNAME) + " has no type defined!"); + type = "unknown"; } ContactPersonTypeEnumeration enumType = null; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java index 1ca5dcce4..d843a171e 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java @@ -385,8 +385,12 @@ public class AuthenticationSessionStoreage { //send transaction tx.commit(); - Logger.debug("Add SSO-Session login information for OA: " + OAUrl - + " and AssertionID: " + SLOInfo.getSessionIndex()); + if (SLOInfo != null) + Logger.debug("Add SSO-Session login information for OA: " + OAUrl + + " and AssertionID: " + SLOInfo.getSessionIndex()); + else + Logger.debug("Add SSO-Session login information for OA: " + OAUrl); + } } catch (MOADatabaseException e) { -- cgit v1.2.3