From 097dbd04ab511fec2e6c31ec69c6723af1164334 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 21 Oct 2016 10:28:22 +0200 Subject: add functionality to support more than one ELGA mandate-service Conflicts: id/server/modules/moa-id-module-elga_mandate_service/src/main/java/at/gv/egovernment/moa/id/auth/modules/elgamandates/utils/ELGAMandateServiceMetadataProvider.java --- .../moa/id/commons/api/AuthConfiguration.java | 22 ++++++++++-- .../commons/api/ConnectionParameterInterface.java | 2 +- .../config/ConfigurationMigrationUtils.java | 29 ++++++++++++++-- .../config/MOAIDConfigurationConstants.java | 9 +++-- .../dao/config/deprecated/MOAIDConfiguration.java | 18 ++++++++++ .../commons/db/dao/config/deprecated/Mandates.java | 39 ++++++++++++++++++++++ .../dao/config/deprecated/OnlineApplication.java | 28 +++++++++++++--- .../moa/id/commons/utils/KeyValueUtils.java | 6 ++-- 8 files changed, 139 insertions(+), 14 deletions(-) (limited to 'id/server/moa-id-commons/src/main') diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/AuthConfiguration.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/AuthConfiguration.java index fa08dcab6..6b51c8683 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/AuthConfiguration.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/AuthConfiguration.java @@ -7,6 +7,7 @@ import java.util.Properties; import at.gv.egovernment.moa.id.commons.api.data.ProtocolAllowed; import at.gv.egovernment.moa.id.commons.api.exceptions.ConfigurationException; import at.gv.util.config.EgovUtilPropertiesConfiguration; +import iaik.pki.revocation.RevocationSourceTypes; public interface AuthConfiguration extends ConfigurationProvider{ @@ -46,9 +47,19 @@ public interface AuthConfiguration extends ConfigurationProvider{ public ConnectionParameterInterface getMoaSpConnectionParameter() throws ConfigurationException; - public ConnectionParameterInterface getForeignIDConnectionParameter() throws ConfigurationException; + public ConnectionParameterInterface getForeignIDConnectionParameter(IOAAuthParameters oaParameters) throws ConfigurationException; - public ConnectionParameterInterface getOnlineMandatesConnectionParameter() throws ConfigurationException; + /** + * Get parameters to connect the Online Mandate-Service (MIS) + * + * Use an Online-Application specific MIS instance URL if it exists, + * otherwise use the first entry of the general configuration + * + * @param oaParameters Online-Application configuration, or null if the default service-url should be always used + * @return Connection parameters with OA specific or general information + * @throws ConfigurationException + */ + public ConnectionParameterInterface getOnlineMandatesConnectionParameter(IOAAuthParameters oaParameters) throws ConfigurationException; public String getMoaSpIdentityLinkTrustProfileID(boolean useTestTrustStore) throws ConfigurationException; @@ -159,4 +170,11 @@ public interface AuthConfiguration extends ConfigurationProvider{ @Deprecated public boolean isHTTPAuthAllowed(); + + /** + * Get the perverted X509 revocation method order for SSL certificate validation + * + * @return Array of {@link RevocationSourceTypes} values + */ + public String[] getRevocationMethodOrder(); } diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/ConnectionParameterInterface.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/ConnectionParameterInterface.java index 89a21661b..21b07a483 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/ConnectionParameterInterface.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/ConnectionParameterInterface.java @@ -25,7 +25,7 @@ package at.gv.egovernment.moa.id.commons.api; public interface ConnectionParameterInterface { - public boolean isHTTPSURL(); +// public boolean isHTTPSURL(); public String getUrl(); public String getAcceptedServerCertificates(); diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java index a221d30e4..6099760e0 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java @@ -171,6 +171,10 @@ public class ConfigurationMigrationUtils { } } + //convert selected SZR-GW service + if (MiscUtil.isNotEmpty(oa.getSelectedSZRGWServiceURL())) + result.put(MOAIDConfigurationConstants.SERVICE_EXTERNAL_SZRGW_SERVICE_URL, oa.getSelectedSZRGWServiceURL()); + AuthComponentOA oaauth = oa.getAuthComponentOA(); if (oaauth != null) { @@ -227,7 +231,15 @@ public class ConfigurationMigrationUtils { if (mandateProfiles != null) result.put(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_OVS_USE, Boolean.TRUE.toString()); else - result.put(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_OVS_USE, Boolean.FALSE.toString()); + result.put(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_OVS_USE, Boolean.FALSE.toString()); + + + if (MiscUtil.isNotEmpty(mandates.getSelectedMISServiceURL())) + result.put(MOAIDConfigurationConstants.SERVICE_EXTERNAL_MIS_SERVICE_URL, mandates.getSelectedMISServiceURL()); + + if (MiscUtil.isNotEmpty(mandates.getSelecteELGAServiceURL())) + result.put(MOAIDConfigurationConstants.SERVICE_EXTERNAL_ELGA_MANDATE_SERVICE_URL, mandates.getSelecteELGAServiceURL()); + } //convert KeyBoxSelector @@ -749,7 +761,9 @@ public class ConfigurationMigrationUtils { dbOA.setEventCodes(oa.get(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_EVENTCODES)); } - + + dbOA.setSelectedSZRGWServiceURL(oa.get(MOAIDConfigurationConstants.SERVICE_EXTERNAL_SZRGW_SERVICE_URL)); + if (Boolean.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_BUSINESSSERVICE))) { dbOA.setType(MOA_CONFIG_BUSINESSSERVICE); @@ -861,6 +875,9 @@ public class ConfigurationMigrationUtils { dbProfiles.add(el.trim()); mandates.setProfiles(null); + + mandates.setSelectedMISServiceURL(oa.get(MOAIDConfigurationConstants.SERVICE_EXTERNAL_MIS_SERVICE_URL)); + mandates.setSelecteELGAServiceURL(oa.get(MOAIDConfigurationConstants.SERVICE_EXTERNAL_ELGA_MANDATE_SERVICE_URL)); } } else { @@ -1162,6 +1179,13 @@ public class ConfigurationMigrationUtils { public static Map convertHyberJaxBMOAIDConfigToKeyValue(MOAIDConfiguration config) { Map result = new HashMap(); if (config != null) { + + if (MiscUtil.isNotEmpty(config.getElgaMandateServiceURLs())) + result.put(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL, + config.getElgaMandateServiceURLs()); + + + AuthComponentGeneral auth = config.getAuthComponentGeneral(); if (auth != null) { @@ -1483,6 +1507,7 @@ public class ConfigurationMigrationUtils { MOAIDConfiguration dbconfig = new MOAIDConfiguration(); + dbconfig.setElgaMandateServiceURLs(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL)); AuthComponentGeneral dbauth = dbconfig.getAuthComponentGeneral(); if (dbauth == null) { diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java index 7d9fc452a..9fe90daa4 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java @@ -49,12 +49,13 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants { private static final String STORK = "stork"; private static final String TEMPLATES = "templates"; private static final String INTERFEDERATION = "interfederation"; + private static final String ELGA_MANDATE_SERVICE_URL = "modules.elga_mandate.service.entityID"; private static final String PROTOCOLS = "protocols"; private static final String SAML1 = "saml1"; private static final String PVP2X = "pvp2x"; private static final String OPENID = "openID"; - + private static final String SERVICE_AUTH_TARGET = AUTH + "." + TARGET; private static final String SERVICE_AUTH_TARGET_PUBLIC = SERVICE_AUTH_TARGET + ".public"; private static final String SERVICE_AUTH_TARGET_BUSINESS = SERVICE_AUTH_TARGET + ".business"; @@ -182,7 +183,9 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants { public static final String SERVICE_REVERSION_LOGS_ENABLED = SERVICE_REVERSION + ".log.enabled"; public static final String SERVICE_REVERSION_LOGS_EVENTCODES = SERVICE_REVERSION + ".log.eventcodes"; - + public static final String SERVICE_EXTERNAL_ELGA_MANDATE_SERVICE_URL = ELGA_MANDATE_SERVICE_URL; + public static final String SERVICE_EXTERNAL_MIS_SERVICE_URL = "modules.mis.service.url"; + public static final String SERVICE_EXTERNAL_SZRGW_SERVICE_URL = "modules.szrgw.service.url"; //Namespaces for general MOA-ID config public static final String GENERAL_PUBLICURLPREFIX = PREFIX_MOAID_GENERAL + ".publicURLPrefix"; @@ -219,6 +222,8 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants { public static final String GENERAL_AUTH_SERVICES_SZRGW_URL = GENERAL_AUTH + ".services.szrgw.url"; public static final String GENERAL_AUTH_SERVICES_HVB_URL = GENERAL_AUTH + ".services.hvb.url"; + public static final String GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL = PREFIX_MOAID_GENERAL + "." + ELGA_MANDATE_SERVICE_URL; + public static final String GENERAL_AUTH_SSO_SERVICENAME = GENERAL_AUTH + "." + SSO + ".servicename"; public static final String GENERAL_AUTH_SSO_TARGET = GENERAL_AUTH + "." + SSO + ".target"; public static final String GENERAL_AUTH_SSO_AUTHBLOCK_TEXT = GENERAL_AUTH + "." + SSO + ".authblock.text"; diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java index 810139c84..c251c7abb 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java @@ -184,6 +184,8 @@ public class MOAIDConfiguration @XmlTransient protected String eventCodes = null; + @XmlTransient + protected String elgaMandateServiceURLs = null; /** @@ -481,11 +483,27 @@ public class MOAIDConfiguration + + public Long getHjid() { return hjid; } /** + * @return the elgaMandateServiceURLs + */ + public String getElgaMandateServiceURLs() { + return elgaMandateServiceURLs; + } + + /** + * @param elgaMandateServiceURLs the elgaMandateServiceURLs to set + */ + public void setElgaMandateServiceURLs(String elgaMandateServiceURLs) { + this.elgaMandateServiceURLs = elgaMandateServiceURLs; + } + + /** * Sets the value of the hjid property. * * @param value diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/Mandates.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/Mandates.java index a87a6d1f6..58b8972a1 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/Mandates.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/Mandates.java @@ -17,6 +17,7 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import org.jvnet.jaxb2_commons.lang.Equals; @@ -70,6 +71,12 @@ public class Mandates protected Long hjid; // protected transient List profileNameItems; + @XmlTransient + protected String selectedMISServiceURL; + + @XmlTransient + protected String selecteELGAServiceURL; + /** * Gets the value of the profiles property. * @@ -145,11 +152,43 @@ public class Mandates + + public Long getHjid() { return hjid; } /** + * @return the selectedMISServiceURL + */ + public String getSelectedMISServiceURL() { + return selectedMISServiceURL; + } + + /** + * @param selectedMISServiceURL the selectedMISServiceURL to set + */ + public void setSelectedMISServiceURL(String selectedMISServiceURL) { + this.selectedMISServiceURL = selectedMISServiceURL; + } + + + + /** + * @return the selecteELGAServiceURL + */ + public String getSelecteELGAServiceURL() { + return selecteELGAServiceURL; + } + + /** + * @param selecteELGAServiceURL the selecteELGAServiceURL to set + */ + public void setSelecteELGAServiceURL(String selecteELGAServiceURL) { + this.selecteELGAServiceURL = selecteELGAServiceURL; + } + + /** * Sets the value of the hjid property. * * @param value diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java index 6a838c261..4aee10bc1 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java @@ -9,12 +9,9 @@ package at.gv.egovernment.moa.id.commons.db.dao.config.deprecated; import java.io.Serializable; -import javax.persistence.Basic; -import javax.persistence.Column; -import javax.persistence.Entity; + import javax.persistence.EnumType; import javax.persistence.Enumerated; -import javax.persistence.Table; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; @@ -23,7 +20,7 @@ import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import com.sun.tools.xjc.runtime.ZeroOneBooleanAdapter; + import org.jvnet.jaxb2_commons.lang.Equals; import org.jvnet.jaxb2_commons.lang.EqualsStrategy; import org.jvnet.jaxb2_commons.lang.HashCode; @@ -33,6 +30,8 @@ import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; import org.jvnet.jaxb2_commons.locator.ObjectLocator; import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; +import com.sun.tools.xjc.runtime.ZeroOneBooleanAdapter; + /** *

Java class for OnlineApplication complex type. @@ -107,8 +106,27 @@ public class OnlineApplication @XmlTransient protected String eventCodes = null; + @XmlTransient + protected String selectedSZRGWServiceURL = null; + + + /** + * @return the selectedSZRGWServiceURL + */ + public String getSelectedSZRGWServiceURL() { + return selectedSZRGWServiceURL; + } + + /** + * @param selectedSZRGWServiceURL the selectedSZRGWServiceURL to set + */ + public void setSelectedSZRGWServiceURL(String selectedSZRGWServiceURL) { + this.selectedSZRGWServiceURL = selectedSZRGWServiceURL; + } + + /** * @return the isRevisionsLogActive */ public Boolean getIsRevisionsLogActive() { diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java index add929e1d..bc567e5d2 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java @@ -31,6 +31,8 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.apache.commons.lang3.StringUtils; + import at.gv.egovernment.moa.util.MiscUtil; /** @@ -250,9 +252,9 @@ public class KeyValueUtils { String[] codes = value.split(CSV_DELIMITER); for (String el: codes) { if (normalizedCodes == null) - normalizedCodes = el.trim(); + normalizedCodes = StringUtils.chomp(el.trim()); else - normalizedCodes += "," + el; + normalizedCodes += "," + StringUtils.chomp(el.trim()); } } -- cgit v1.2.3