diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2016-10-21 10:13:42 +0200 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2016-11-03 10:45:37 +0100 |
commit | 0b513625b19ba63e5c23b60fbb505cd4a7c232ab (patch) | |
tree | 3d0b305cc976f745f3e6da5c79de943d2e4fa9c3 /id | |
parent | 3ca1a273b2ebc279ec3ad94d9ed38d0b39477679 (diff) | |
download | moa-id-spss-0b513625b19ba63e5c23b60fbb505cd4a7c232ab.tar.gz moa-id-spss-0b513625b19ba63e5c23b60fbb505cd4a7c232ab.tar.bz2 moa-id-spss-0b513625b19ba63e5c23b60fbb505cd4a7c232ab.zip |
update ConfigTool to support more than one ELGA mandate-service
Diffstat (limited to 'id')
16 files changed, 562 insertions, 50 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 ab6c22858..b8f9cff0f 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 @@ -580,7 +580,8 @@ public class ConfigurationProvider { ConfigurationProvider.getInstance().getTrustStoreDirectory(), null, "pkix", - true); + true, + new String[]{"crl"}); httpClient.setCustomSSLTrustStore(metadataurl, protoSocketFactory); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java index ebd2d6283..86ac6f779 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java @@ -68,7 +68,6 @@ public class GeneralMOAIDConfig { public static final String LINE_DELIMITER = ";"; - private String szrgwURL = null; private String alternativeSourceID = null; private String certStoreDirectory = null; private boolean trustmanagerrevocationcheck = true; @@ -87,6 +86,8 @@ public class GeneralMOAIDConfig { private String moaspssAuthTrustProfileTest = null; private String mandateURL = null; + private String szrgwURL = null; + private String elgaMandateServiceURL = null; private boolean protocolActiveSAML1 = false; private boolean protocolActivePVP21 = true; @@ -163,13 +164,47 @@ public class GeneralMOAIDConfig { if (config != null) { AuthComponentGeneral auth = config.getAuthComponentGeneral(); + //get ELGA mandate service URLs from configuration + if (MiscUtil.isNotEmpty(config.getElgaMandateServiceURLs())) { + if (KeyValueUtils.isCSVValueString(config.getElgaMandateServiceURLs())) + elgaMandateServiceURL = KeyValueUtils.normalizeCSVValueString(config.getElgaMandateServiceURLs()); + + else { + if (config.getElgaMandateServiceURLs().contains(KeyValueUtils.CSV_DELIMITER)) { + //remove trailing comma if exist + elgaMandateServiceURL = config.getElgaMandateServiceURLs().substring(0, + config.getElgaMandateServiceURLs().indexOf(KeyValueUtils.CSV_DELIMITER)); + + } else + elgaMandateServiceURL = config.getElgaMandateServiceURLs(); + + } + } + + + if (auth != null) { ForeignIdentities foreign = auth.getForeignIdentities(); if (foreign != null) { ConnectionParameterClientAuthType connect_foreign = foreign.getConnectionParameter(); if (connect_foreign != null) { - szrgwURL = connect_foreign.getURL(); + if (MiscUtil.isNotEmpty(connect_foreign.getURL())) { + if (KeyValueUtils.isCSVValueString(connect_foreign.getURL())) + szrgwURL = KeyValueUtils.normalizeCSVValueString(connect_foreign.getURL()); + + else { + if (connect_foreign.getURL().contains(KeyValueUtils.CSV_DELIMITER)) { + //remove trailing comma if exist + szrgwURL = connect_foreign.getURL().substring(0, + connect_foreign.getURL().indexOf(KeyValueUtils.CSV_DELIMITER)); + + } else + szrgwURL = connect_foreign.getURL(); + + } + + } } STORK stork = foreign.getSTORK(); @@ -251,7 +286,23 @@ public class GeneralMOAIDConfig { if (mandates != null) { ConnectionParameterClientAuthType con = mandates.getConnectionParameter(); if (con != null) { - mandateURL = con.getURL(); + if (MiscUtil.isNotEmpty(con.getURL())) { + if (KeyValueUtils.isCSVValueString(con.getURL())) + mandateURL = KeyValueUtils.normalizeCSVValueString(con.getURL()); + + else { + if (con.getURL().contains(KeyValueUtils.CSV_DELIMITER)) { + //remove trailing comma if exist + mandateURL = con.getURL().substring(0, + con.getURL().indexOf(KeyValueUtils.CSV_DELIMITER)); + + } else + mandateURL = con.getURL(); + + } + + } + } } @@ -392,7 +443,10 @@ public class GeneralMOAIDConfig { * @param szrgwURL the szrgwURL to set */ public void setSzrgwURL(String szrgwURL) { - this.szrgwURL = szrgwURL; + if (MiscUtil.isNotEmpty(szrgwURL)) + this.szrgwURL = KeyValueUtils.removeAllNewlineFromString(szrgwURL); + else + this.szrgwURL = szrgwURL; } /** @@ -518,7 +572,10 @@ public class GeneralMOAIDConfig { * @param mandateURL the mandateURL to set */ public void setMandateURL(String mandateURL) { - this.mandateURL = mandateURL; + if (MiscUtil.isNotEmpty(mandateURL)) + this.mandateURL = KeyValueUtils.removeAllNewlineFromString(mandateURL); + else + this.mandateURL = mandateURL; } /** @@ -1024,6 +1081,23 @@ public class GeneralMOAIDConfig { boolean virtualPublicURLPrefixEnabled) { this.virtualPublicURLPrefixEnabled = virtualPublicURLPrefixEnabled; } + + /** + * @return the elgaMandateServiceURL + */ + public String getElgaMandateServiceURL() { + return elgaMandateServiceURL; + } + + /** + * @param elgaMandateServiceURL the elgaMandateServiceURL to set + */ + public void setElgaMandateServiceURL(String elgaMandateServiceURL) { + if (MiscUtil.isNotEmpty(elgaMandateServiceURL)) + this.elgaMandateServiceURL = KeyValueUtils.removeAllNewlineFromString(elgaMandateServiceURL); + else + this.elgaMandateServiceURL = elgaMandateServiceURL; + } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java index d0232e86a..225f85462 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java @@ -29,8 +29,11 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; +import org.apache.log4j.Logger; + import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA; import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.BKUURLS; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration; import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAKeyBoxSelector; import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.Mandates; import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; @@ -38,7 +41,10 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TemplateType; import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TemplatesType; import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TestCredentials; import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TransformsInfoType; +import at.gv.egovernment.moa.id.commons.utils.KeyValueUtils; +import at.gv.egovernment.moa.id.config.webgui.exception.ConfigurationException; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; +import at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider; import at.gv.egovernment.moa.id.configuration.validation.oa.OAAuthenticationDataValidation; import at.gv.egovernment.moa.util.MiscUtil; @@ -48,6 +54,8 @@ import at.gv.egovernment.moa.util.MiscUtil; */ public class OAAuthenticationData implements IOnlineApplicationData { + private static final Logger log = Logger.getLogger(OAAuthenticationData.class); + private String bkuOnlineURL = null; private String bkuHandyURL = null; private String bkuLocalURL = null; @@ -55,6 +63,13 @@ public class OAAuthenticationData implements IOnlineApplicationData { private String mandateProfiles = null; private boolean useMandates = false; + private List<String> misServicesList = null; + private List<String> elgaServicesList = null; + private List<String> szrgwServicesList = null; + private String misServiceSelected = null; + private String elgaServiceSelected = null; + private String szrgwServiceSelected = null; + private boolean calculateHPI = false; private String keyBoxIdentifier = null; @@ -82,6 +97,26 @@ public class OAAuthenticationData implements IOnlineApplicationData { keyBoxIdentifier = MOAKeyBoxSelector.SECURE_SIGNATURE_KEYPAIR.value(); + + try { + MOAIDConfiguration dbconfig = ConfigurationProvider.getInstance().getDbRead().getMOAIDConfiguration(); + elgaServicesList = KeyValueUtils.getListOfCSVValues(dbconfig.getElgaMandateServiceURLs()); + + try { + misServicesList = KeyValueUtils.getListOfCSVValues( + dbconfig.getAuthComponentGeneral().getOnlineMandates().getConnectionParameter().getURL()); + } catch (NullPointerException e) {} + + try { + szrgwServicesList = KeyValueUtils.getListOfCSVValues( + dbconfig.getAuthComponentGeneral().getForeignIdentities().getConnectionParameter().getURL()); + } catch (NullPointerException e) {} + + } catch (ConfigurationException e) { + log.error("MOA-ID-Configuration initialization FAILED.", e); + + } + // bkuLocalURL = Constants.DEFAULT_LOCALBKU_URL; // bkuHandyURL = Constants.DEFAULT_HANDYBKU_URL; // @@ -111,6 +146,8 @@ public class OAAuthenticationData implements IOnlineApplicationData { public List<String> parse(OnlineApplication dbOA, AuthenticatedUser authUser, HttpServletRequest request) { keyBoxIdentifier = dbOA.getKeyBoxIdentifier().value(); + szrgwServiceSelected = dbOA.getSelectedSZRGWServiceURL(); + AuthComponentOA oaauth = dbOA.getAuthComponentOA(); if (oaauth != null) { BKUURLS bkuurls = oaauth.getBKUURLS(); @@ -177,6 +214,9 @@ public class OAAuthenticationData implements IOnlineApplicationData { else useMandates = false; + misServiceSelected = mandates.getSelectedMISServiceURL(); + elgaServiceSelected = mandates.getSelecteELGAServiceURL(); + } TemplatesType templates = oaauth.getTemplates(); @@ -231,6 +271,9 @@ public class OAAuthenticationData implements IOnlineApplicationData { dbOA.setCalculateHPI(isCalculateHPI()); + if (MiscUtil.isNotEmpty(getSzrgwServiceSelected())) + dbOA.setSelectedSZRGWServiceURL(getSzrgwServiceSelected()); + if (authUser.isAdmin()) { //store BKU-URLs @@ -301,9 +344,16 @@ public class OAAuthenticationData implements IOnlineApplicationData { mandates.setProfiles(null); + if (MiscUtil.isNotEmpty(getMisServiceSelected())) + mandates.setSelectedMISServiceURL(getMisServiceSelected()); + + if (MiscUtil.isNotEmpty(getElgaServiceSelected())) + mandates.setSelecteELGAServiceURL(getElgaServiceSelected()); + } else { mandates.setProfiles(null); mandates.getProfileName().clear(); + } authoa.setMandates(mandates); @@ -655,6 +705,69 @@ public class OAAuthenticationData implements IOnlineApplicationData { boolean useTestAuthblockValidationTrustStore) { this.useTestAuthblockValidationTrustStore = useTestAuthblockValidationTrustStore; } + + /** + * @return the misServiceSelected + */ + public String getMisServiceSelected() { + return misServiceSelected; + } + + /** + * @param misServiceSelected the misServiceSelected to set + */ + public void setMisServiceSelected(String misServiceSelected) { + this.misServiceSelected = misServiceSelected; + } + + /** + * @return the elgaServiceSelected + */ + public String getElgaServiceSelected() { + return elgaServiceSelected; + } + + /** + * @param elgaServiceSelected the elgaServiceSelected to set + */ + public void setElgaServiceSelected(String elgaServiceSelected) { + this.elgaServiceSelected = elgaServiceSelected; + } + + /** + * @return the szrgwServiceSelected + */ + public String getSzrgwServiceSelected() { + return szrgwServiceSelected; + } + + /** + * @param szrgwServiceSelected the szrgwServiceSelected to set + */ + public void setSzrgwServiceSelected(String szrgwServiceSelected) { + this.szrgwServiceSelected = szrgwServiceSelected; + } + + /** + * @return the misServicesList + */ + public List<String> getMisServicesList() { + return misServicesList; + } + + /** + * @return the elgaServicesList + */ + public List<String> getElgaServicesList() { + return elgaServicesList; + } + + /** + * @return the szrgwServicesList + */ + public List<String> getSzrgwServicesList() { + return szrgwServicesList; + } } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java index 40e9b1a90..27a3dcdf3 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java @@ -539,7 +539,22 @@ public class EditGeneralConfigAction extends BasicAction { forcon = new ConnectionParameterClientAuthType(); dbforeign.setConnectionParameter(forcon); } - forcon.setURL(moaconfig.getSzrgwURL()); + + if (KeyValueUtils.isCSVValueString(moaconfig.getSzrgwURL())) + forcon.setURL(KeyValueUtils.normalizeCSVValueString(moaconfig.getSzrgwURL())); + + else { + if (moaconfig.getSzrgwURL().contains(KeyValueUtils.CSV_DELIMITER)) + forcon.setURL( + moaconfig.getSzrgwURL().trim().substring(0, + moaconfig.getSzrgwURL().indexOf(KeyValueUtils.CSV_DELIMITER))); + + else + forcon.setURL( + StringUtils.chomp(moaconfig.getSzrgwURL().trim())); + + } + } ForeignIdentities foreign = dbauth.getForeignIdentities(); @@ -608,6 +623,7 @@ public class EditGeneralConfigAction extends BasicAction { } } + //write MIS Mandate-Service URLs if (MiscUtil.isNotEmpty(moaconfig.getMandateURL())) { OnlineMandates dbmandate = dbauth.getOnlineMandates(); if (dbmandate == null) { @@ -620,9 +636,43 @@ public class EditGeneralConfigAction extends BasicAction { dbmandateconnection = new ConnectionParameterClientAuthType(); dbmandate.setConnectionParameter(dbmandateconnection); } - dbmandateconnection.setURL(moaconfig.getMandateURL()); + + if (KeyValueUtils.isCSVValueString(moaconfig.getMandateURL())) + dbmandateconnection.setURL(KeyValueUtils.normalizeCSVValueString(moaconfig.getMandateURL())); + + else { + if (moaconfig.getMandateURL().contains(KeyValueUtils.CSV_DELIMITER)) + dbmandateconnection.setURL( + moaconfig.getMandateURL().trim().substring(0, + moaconfig.getMandateURL().indexOf(KeyValueUtils.CSV_DELIMITER))); + + else + dbmandateconnection.setURL( + StringUtils.chomp(moaconfig.getMandateURL().trim())); + + } + } + + //write ELGA Mandate-Service URLs + if (MiscUtil.isNotEmpty(moaconfig.getElgaMandateServiceURL())) { + if (KeyValueUtils.isCSVValueString(moaconfig.getElgaMandateServiceURL())) + dbconfig.setElgaMandateServiceURLs(KeyValueUtils.normalizeCSVValueString(moaconfig.getElgaMandateServiceURL())); + + else { + if (moaconfig.getElgaMandateServiceURL().contains(KeyValueUtils.CSV_DELIMITER)) + dbconfig.setElgaMandateServiceURLs( + moaconfig.getElgaMandateServiceURL().trim().substring(0, + moaconfig.getElgaMandateServiceURL().indexOf(KeyValueUtils.CSV_DELIMITER))); + + else + dbconfig.setElgaMandateServiceURLs( + StringUtils.chomp(moaconfig.getElgaMandateServiceURL().trim())); + + } } + + MOASP dbmoasp = dbauth.getMOASP(); if (dbmoasp == null) { dbmoasp = new MOASP(); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java index 617e9cf51..cb546c5a8 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java @@ -162,10 +162,26 @@ public class MOAConfigValidator { // } check = form.getMandateURL(); - if (MiscUtil.isNotEmpty(check)) { - if (!ValidationHelper.validateURL(check)) { - log.info("Not valid Online-Mandate Service URL"); - errors.add(LanguageHelper.getErrorString("validation.general.mandateservice.valid", request)); + if (MiscUtil.isNotEmpty(check)) { + String[] misURLs = check.split(","); + for (String el : misURLs) { + if (MiscUtil.isNotEmpty(el) && !ValidationHelper.validateURL(StringUtils.chomp(el.trim()))) { + log.info("Not valid Online-Mandate Service URL"); + errors.add(LanguageHelper.getErrorString("validation.general.mandateservice.valid", + new Object[]{el}, request)); + } + } + } + + check = form.getElgaMandateServiceURL(); + if (MiscUtil.isNotEmpty(check)) { + String[] elgaServiceURLs = check.split(","); + for (String el : elgaServiceURLs) { + if (MiscUtil.isNotEmpty(el) && !ValidationHelper.validateURL(StringUtils.chomp(el.trim()))) { + log.info("Not valid Online-Mandate Service URL"); + errors.add(LanguageHelper.getErrorString("validation.general.elga.mandateservice.valid", + new Object[]{el}, request)); + } } } @@ -392,13 +408,17 @@ public class MOAConfigValidator { } check = form.getSzrgwURL(); - if (MiscUtil.isNotEmpty(check)) { - if (!ValidationHelper.validateURL(check)) { - log.info("SZRGW URL is not valid"); - errors.add(LanguageHelper.getErrorString("validation.general.szrgw.url.valid", request)); + if (MiscUtil.isNotEmpty(check)) { + String[] szrGWServiceURLs = check.split(","); + for (String el : szrGWServiceURLs) { + if (MiscUtil.isNotEmpty(el) && !ValidationHelper.validateURL(StringUtils.chomp(el.trim()))) { + log.info("Not valid Online-Mandate Service URL"); + errors.add(LanguageHelper.getErrorString("validation.general.szrgw.url.valid", + new Object[]{el}, request)); + } } } - + check = form.getTrustedCACerts(); if (MiscUtil.isEmpty(check)) { log.info("Empty TrustCACerts Directory"); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAAuthenticationDataValidation.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAAuthenticationDataValidation.java index 47c8f23b4..7e6396b75 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAAuthenticationDataValidation.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAAuthenticationDataValidation.java @@ -147,6 +147,34 @@ public class OAAuthenticationDataValidation { } } + check =form.getMisServiceSelected(); + if (MiscUtil.isNotEmpty(check)) { + if (!ValidationHelper.validateURL(check)) { + log.info("Not valid MIS Service URL"); + errors.add(LanguageHelper.getErrorString("validation.general.mandateservice.valid", + new Object[]{check}, request)); + } + } + + check =form.getElgaServiceSelected(); + if (MiscUtil.isNotEmpty(check)) { + if (!ValidationHelper.validateURL(check)) { + log.info("Not valid ELGA Service URL"); + errors.add(LanguageHelper.getErrorString("validation.general.elga.mandateservice.valid", + new Object[]{check}, request)); + } + } + + check =form.getSzrgwServiceSelected(); + if (MiscUtil.isNotEmpty(check)) { + if (!ValidationHelper.validateURL(check)) { + log.info("Not valid SZR-GW Service URL"); + errors.add(LanguageHelper.getErrorString("validation.general.szrgw.url.valid", + new Object[]{check}, request)); + } + } + + if (form.isEnableTestCredentials() && form.getTestCredialOIDList() != null && !form.getTestCredialOIDList().isEmpty()) { for (String el : form.getTestCredialOIDList()) { diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java index 6476ea1f1..970785bdb 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAPVP2ConfigValidation.java @@ -22,8 +22,6 @@ *******************************************************************************/ package at.gv.egovernment.moa.id.configuration.validation.oa; -import iaik.x509.X509Certificate; - import java.io.IOException; import java.security.cert.CertificateException; import java.util.ArrayList; @@ -58,6 +56,7 @@ import at.gv.egovernment.moa.id.protocols.pvp2x.exceptions.filter.SignatureValid import at.gv.egovernment.moa.id.protocols.pvp2x.verification.metadata.SchemaValidationFilter; import at.gv.egovernment.moa.util.Base64Utils; import at.gv.egovernment.moa.util.MiscUtil; +import iaik.x509.X509Certificate; public class OAPVP2ConfigValidation { @@ -135,7 +134,8 @@ public class OAPVP2ConfigValidation { ConfigurationProvider.getInstance().getTrustStoreDirectory(), null, "pkix", - true); + true, + new String[]{"crl"}); httpClient.setCustomSSLTrustStore( form.getMetaDataURL(), diff --git a/id/ConfigWebTool/src/main/resources/applicationResources_de.properties b/id/ConfigWebTool/src/main/resources/applicationResources_de.properties index b77097e70..b488acd63 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources_de.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources_de.properties @@ -151,8 +151,9 @@ webpages.moaconfig.moasp.authblocktransform=Authentfizierungsblock Transformatio webpages.moaconfig.moasp.url=URL zum MOA-SP Service webpages.moaconfig.identitylinksigners=IdentityLinkSigners webpages.moaconfig.services.header=Externe Services -webpages.moaconfig.services.mandates=Online-Vollmachten Service URL -webpages.moaconfig.services.szrgw=SZR Gateway Service URL +webpages.moaconfig.services.mandates=Online-Vollmachten Service URLs (CSV) +webpages.moaconfig.services.szrgw=SZR Gateway Service URLs (CSV) +webpages.moaconfig.services.elgamandateservice=ELGA Mandate Service EntityIDs (CSV) webpages.moaconfig.sso.header=Single Sign-On webpages.moaconfig.sso.PublicUrl=SSO Service URL-Prefix webpages.moaconfig.sso.FriendlyName=SSO Service Name @@ -231,6 +232,8 @@ webpages.oaconfig.general.identification=Eindeutiger Identifikatior (PublicURLPr webpages.oaconfig.general.mandate.header=Vollmachten webpages.oaconfig.general.mandate.profiles=Profile webpages.oaconfig.general.mandate.usemandate=Vollmachten (ja/nein) +webpages.oaconfig.general.mandate.misservice.selected=MIS Vollmachten Service URL +webpages.oaconfig.general.mandate.elgaservice.selected=ELGA Vollmachten Service EntityID webpages.oaconfig.general.friendlyname=Name der Online-Applikation webpages.oaconfig.general.isbusinessservice=Privatwirtschaftliche Applikation webpages.oaconfig.general.isstorkservice=Stork Applikation @@ -255,6 +258,9 @@ webpages.oaconfig.general.aditional.useUTC=UTC Zeit verwenden webpages.oaconfig.general.aditional.calculateHPI="TODO!" webpages.oaconfig.general.isHideBPKAuthBlock=bPK/wbPK im AuthBlock ausblenden +webpages.oaconfig.general.szrgw.header=SZR-Gateway Service +webpages.oaconfig.general.szrgw.selected=SZR-Gateway Service URL + webpages.oaconfig.menu.saml1.show=SAML1 Konfiguration einblenden webpages.oaconfig.menu.saml1.hidden=SAML1 Konfiguration ausblenden webpages.oaconfig.menu.pvp2.show=PVP2 Konfiguration einblenden @@ -396,7 +402,9 @@ validation.general.Defaultchainigmode.empty=Es wurde kein DefaultChainingMode ge validation.general.Defaultchainigmode.valid=Der DefaultChainingMode enth\u00E4lt einen ung\u00F6ltigen Wert. validation.general.IdentityLinkSigners.empty=Es wurde kein IdentityLinkSigner angegeben validation.general.IdentityLinkSigners.valid=Der IdentityLinkSigner in der Zeile {0} enth\u00E4lt ein ung\u00FCltiges Zeichen. Folgende Zeichen sind nicht erlaubt\: {1} -validation.general.mandateservice.valid=Die URL zum Online-Vollmachten Service hat kein g\u00F6ltiges Format. +validation.general.mandateservice.valid=Die URL {0} zum Online-Vollmachten Service hat kein g\u00F6ltiges Format. +validation.general.elga.mandateservice.valid=Die EntityID {0} zum ELGA Vertretungsservice hat kein g\u00F6ltiges Format. +validation.general.szrgw.url.valid=Die URL {0} des SZR Gateways hat kein g\u00F6ltiges Format. validation.general.moasp.auth.transformation.empty=Die Transformation f\u00F6r den Authentfizierungsblock ist leer. validation.general.moasp.auth.transformation.valid=Die Transformation f\u00F6r den Authentfizierungsblock in der Zeile {0} enth\u00E4lt ein ung\u00FCltiges Zeichen. Folgende Zeichen sind nicht erlaubt\: {1} validation.general.moasp.auth.trustprofile.empty=Das TrustProfile zur Pr\u00F6fung des Authentfizierungsblock ist leer. @@ -437,7 +445,6 @@ validation.general.sso.publicurl.valid=Der SSO Service URL-Prefix hat kein g\u00 validation.general.sso.specialauthtext.valid=Der SSO AuthBlockText enth\u00E4lt ein ung\u00FCltiges Zeichen. Folgende Zeichen sind nicht erlaubt\: {0} validation.general.sso.target.empty=Das SSO Target Feld ist leer. validation.general.sso.target.valid=Das SSO Target Feld enth\u00E4lt ein ung\u00FCltiges Target. -validation.general.szrgw.url.valid=Die URL des SZR Gateways hat kein g\u00F6ltiges Format. validation.general.trustedcacerts.empty=Das Feld TrustedCACertificates ist leer. validation.general.trustedcacerts.valid=Das Feld TrustedCACertificates enth\u00E4lt ein ung\u00FCltiges Zeichen. Folgende Zeichen sind nicht erlaubt\: {0} validation.general.slrequest.filename.valid=Der Dateiname der angegebenen SecurtityLayer Transformation enth\u00E4lt ein ung\u00FCltiges Zeichen. Folgende Zeichen sind nicht erlaubt\: {0} diff --git a/id/ConfigWebTool/src/main/resources/applicationResources_en.properties b/id/ConfigWebTool/src/main/resources/applicationResources_en.properties index d62ce3807..a3edd1b8c 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources_en.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources_en.properties @@ -150,8 +150,9 @@ webpages.moaconfig.moasp.authblocktransform=Transformations for authentication b webpages.moaconfig.moasp.url=URL for MOA-SP Service webpages.moaconfig.identitylinksigners=IdentityLinkSigners webpages.moaconfig.services.header=External Services -webpages.moaconfig.services.mandates=Online-Mandate Service URL -webpages.moaconfig.services.szrgw=SZR Gateway Service URL +webpages.moaconfig.services.mandates=Online-Mandate Service URLs (CSV) +webpages.moaconfig.services.szrgw=SZR Gateway Service URLs (CSV) +webpages.moaconfig.services.elgamandateservice=ELGA Mandate Service EntityIDs (CSV) webpages.moaconfig.sso.header=Single Sign-On webpages.moaconfig.sso.PublicUrl=SSO Service URL-Prefix webpages.moaconfig.sso.FriendlyName=SSO Service Name @@ -235,7 +236,9 @@ webpages.oaconfig.bPKEncDec.keyPassword=Key password webpages.oaconfig.general.identification=Unique identifier (PublicURLPrefix) webpages.oaconfig.general.mandate.header=Mandates webpages.oaconfig.general.mandate.profiles=Profile -webpages.oaconfig.general.mandate.usemandate=Mandates (ja/nein) +webpages.oaconfig.general.mandate.usemandate=Mandates (yes/no) +webpages.oaconfig.general.mandate.misservice.selected=MIS Mandate-Service URL +webpages.oaconfig.general.mandate.elgaservice.selected=ELGA Mandate-Service EntityID webpages.oaconfig.general.friendlyname=Name of the Online-Application webpages.oaconfig.general.isbusinessservice=Private sector application webpages.oaconfig.general.isstorkservice=Stork application @@ -260,6 +263,9 @@ webpages.oaconfig.general.aditional.useUTC=Use UTC time webpages.oaconfig.general.aditional.calculateHPI="TODO!" webpages.oaconfig.general.isHideBPKAuthBlock=Hide bPK/wbPK from AuthBlock +webpages.oaconfig.general.szrgw.header=SZR-Gateway Service +webpages.oaconfig.general.szrgw.selected=SZR-Gateway Service URL + webpages.oaconfig.menu.saml1.show=Show SAML1 configuration webpages.oaconfig.menu.saml1.hidden=Hide SAML1 configuration webpages.oaconfig.menu.pvp2.show=Show PVP2 configuration @@ -394,7 +400,9 @@ validation.general.Defaultchainigmode.empty=There is no DefaultChainingMode sele validation.general.Defaultchainigmode.valid=DefaultChainingMode contains invalid value. validation.general.IdentityLinkSigners.empty=There is no IdentityLinkSigner given validation.general.IdentityLinkSigners.valid=IdentityLinkSigner in the line {0} contains forbidden characters. The following characters are not allowed\: {1} -validation.general.mandateservice.valid=URL for Online-Mandating Service has invalid format. +validation.general.mandateservice.valid=URL {0} for Online-Mandating Service has invalid format. +validation.general.elga.mandateservice.valid=EntityID {0} for ELGA Mandate-Service has invalid format. +validation.general.szrgw.url.valid=URL {0} for SZR Gateway has invalid format. validation.general.moasp.auth.transformation.empty=Transformation for authentication block is blank. validation.general.moasp.auth.transformation.valid=Transformation for authentication block in the line {0} contians forbidden characters. The following characters are not allowed\: {1} validation.general.moasp.auth.trustprofile.empty=TrustProfile for checking of authentication block is blank. @@ -435,7 +443,6 @@ validation.general.sso.publicurl.valid=SSO Service URL-Prefix has invalid format validation.general.sso.specialauthtext.valid=SSO AuthBlockText contains forbidden characters. The following characters are not allowed\: {0} validation.general.sso.target.empty=SSO Target field is blank. validation.general.sso.target.valid=SSO Target field contains invalid target. -validation.general.szrgw.url.valid=URL for SZR Gateway has invalid format. validation.general.trustedcacerts.empty=Field TrustedCACertificates is blank. validation.general.trustedcacerts.valid=Das Feld TrustedCACertificates contains forbidden characters. The following characters are not allowed\: {0} validation.general.slrequest.filename.valid=File name of provided SecurityLayer Transformation contains forbidden characters. The following characters are not allowed\: {0} diff --git a/id/ConfigWebTool/src/main/webapp/css/index.css b/id/ConfigWebTool/src/main/webapp/css/index.css index 6b4d310ef..80ccf93be 100644 --- a/id/ConfigWebTool/src/main/webapp/css/index.css +++ b/id/ConfigWebTool/src/main/webapp/css/index.css @@ -408,6 +408,16 @@ div .wwgrp br { text-decoration:none; } +.selectfield_long { + width: 600px; + float: left; + margin-right: 5px; + background: transparent; + overflow: hidden; + border: 1px solid #ccc; + text-decoration:none; +} + .checkbox{ margin-top: 7px; margin-left:0px; diff --git a/id/ConfigWebTool/src/main/webapp/js/common.js b/id/ConfigWebTool/src/main/webapp/js/common.js index f17ee3623..3d5528ad5 100644 --- a/id/ConfigWebTool/src/main/webapp/js/common.js +++ b/id/ConfigWebTool/src/main/webapp/js/common.js @@ -292,5 +292,15 @@ function setPublicURLPrefixTestBox(checkbox) { function generalConfigLoadEvent() { var value = $("#loadGeneralConfig_moaconfig_publicURLPrefix").val(); $("#loadGeneralConfig_moaconfig_publicURLPrefix").val(value.replace(/,/g,",\n")); + + var elga = $("#loadGeneralConfig_moaconfig_elgaMandateServiceURL").val(); + $("#loadGeneralConfig_moaconfig_elgaMandateServiceURL").val(elga.replace(/,/g,",\n")); + + var mis = $("#loadGeneralConfig_moaconfig_mandateURL").val(); + $("#loadGeneralConfig_moaconfig_mandateURL").val(mis.replace(/,/g,",\n")); + + var szrgw = $("#loadGeneralConfig_moaconfig_szrgwURL").val(); + $("#loadGeneralConfig_moaconfig_szrgwURL").val(szrgw.replace(/,/g,",\n")); + return true; } diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp index 45ea159e4..cf9fc19e1 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp @@ -233,18 +233,24 @@ <div class="oa_config_block"> <h3><%=LanguageHelper.getGUIString("webpages.moaconfig.services.header", request) %></h3> - <s:textfield name="moaconfig.mandateURL" + <s:textarea name="moaconfig.mandateURL" value="%{moaconfig.mandateURL}" labelposition="left" key="webpages.moaconfig.services.mandates" cssClass="textfield_long"> - </s:textfield> - <s:textfield name="moaconfig.szrgwURL" + </s:textarea> + <s:textarea name="moaconfig.szrgwURL" value="%{moaconfig.szrgwURL}" labelposition="left" key="webpages.moaconfig.services.szrgw" cssClass="textfield_long"> - </s:textfield> + </s:textarea> + <s:textarea name="moaconfig.elgaMandateServiceURL" + value="%{moaconfig.elgaMandateServiceURL}" + labelposition="left" + key="webpages.moaconfig.services.elgamandateservice" + cssClass="textfield_long"> + </s:textarea> </div> <div class="oa_config_block" > diff --git a/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/authentication.jsp b/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/authentication.jsp index f0b5c816a..ff2b091c6 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/authentication.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/authentication.jsp @@ -127,6 +127,35 @@ cssClass="checkbox"> </s:checkbox> + <s:select list="authOA.misServicesList" + key="webpages.oaconfig.general.mandate.misservice.selected" + labelposition="left" + cssClass="selectfield_long" + value="%{authOA.misServiceSelected}" + name="authOA.misServiceSelected"> + </s:select> + + <s:select list="authOA.elgaServicesList" + key="webpages.oaconfig.general.mandate.elgaservice.selected" + labelposition="left" + cssClass="selectfield_long" + value="%{authOA.elgaServiceSelected}" + name="authOA.elgaServiceSelected"> + </s:select> + </div> + <div class="oa_config_block"> + <h3><%=LanguageHelper.getGUIString("webpages.oaconfig.general.szrgw.header", request) %></h3> + + <s:select list="authOA.szrgwServicesList" + key="webpages.oaconfig.general.szrgw.selected" + labelposition="left" + cssClass="selectfield_long" + value="%{authOA.szrgwServiceSelected}" + name="authOA.szrgwServiceSelected"> + </s:select> + + </div> + </html>
\ No newline at end of file diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralMOAIDConfigurationTask.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralMOAIDConfigurationTask.java index 270d0866c..9b25f17e8 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralMOAIDConfigurationTask.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralMOAIDConfigurationTask.java @@ -34,6 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.gv.egiz.components.configuration.api.Configuration; +import at.gv.egiz.components.configuration.api.ConfigurationException; import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; import at.gv.egovernment.moa.id.commons.utils.KeyValueUtils; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; @@ -76,6 +77,7 @@ public class GeneralMOAIDConfigurationTask extends AbstractTaskValidator impleme temp.add(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_REVOCATIONCHECKING, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL)); temp.add(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL)); temp.add(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL)); + temp.add(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL)); temp.add(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_AUTHBLOCK_TEXT, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL)); temp.add(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_SERVICENAME, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL)); temp.add(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_TARGET, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL)); @@ -256,12 +258,29 @@ public class GeneralMOAIDConfigurationTask extends AbstractTaskValidator impleme check = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL, getKeyPrefix())); if (MiscUtil.isNotEmpty(check)) { - if (!ValidationHelper.validateURL(check)) { - log.info("Not valid Online-Mandate Service URL"); - errors.add(new ValidationObjectIdentifier( - MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL, - "Services - OVS", - LanguageHelper.getErrorString("validation.general.mandateservice.valid"))); + String[] misURLs = check.split(","); + for (String el : misURLs) { + if (MiscUtil.isNotEmpty(el) && !ValidationHelper.validateURL(StringUtils.chomp(el.trim()))) { + log.info("Not valid Online-Mandate Service URL"); + errors.add(new ValidationObjectIdentifier( + MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL, + "Services - OVS", + LanguageHelper.getErrorString("validation.general.mandateservice.valid", new Object[]{el}))); + } + } + } + + check = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL, getKeyPrefix())); + if (MiscUtil.isNotEmpty(check)) { + String[] misURLs = check.split(","); + for (String el : misURLs) { + if (MiscUtil.isNotEmpty(el) && !ValidationHelper.validateURL(StringUtils.chomp(el.trim()))) { + log.info("Not valid ELGA Mandate Service URL"); + errors.add(new ValidationObjectIdentifier( + MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL, + "Services - ELGA", + LanguageHelper.getErrorString("validation.general.elga.mandateservice.valid", new Object[]{el}))); + } } } @@ -477,12 +496,15 @@ public class GeneralMOAIDConfigurationTask extends AbstractTaskValidator impleme check = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL, getKeyPrefix())); if (MiscUtil.isNotEmpty(check)) { - if (!ValidationHelper.validateURL(check)) { - log.info("SZRGW URL is not valid"); - errors.add(new ValidationObjectIdentifier( - MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL, - "Services - SZR-GW URL", - LanguageHelper.getErrorString("validation.general.szrgw.url.valid"))); + String[] szrGWServiceURLs = check.split(","); + for (String el : szrGWServiceURLs) { + if (MiscUtil.isNotEmpty(el) && !ValidationHelper.validateURL(StringUtils.chomp(el.trim()))) { + log.info("SZRGW URL is not valid"); + errors.add(new ValidationObjectIdentifier( + MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL, + "Services - SZR-GW URL", + LanguageHelper.getErrorString("validation.general.szrgw.url.valid", new Object[]{el}))); + } } } @@ -618,6 +640,111 @@ public class GeneralMOAIDConfigurationTask extends AbstractTaskValidator impleme } + //normalize CSV of ELGA mandate-service URLs + try { + String elgaServiceURLs = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL, getKeyPrefix())); + List<String> currentElgaServiceURLs = KeyValueUtils.getListOfCSVValues(dbconfig.getStringValue(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL)); + + if (MiscUtil.isNotEmpty(elgaServiceURLs)) { + String normalizedElgaServiceURLs = KeyValueUtils.normalizeCSVValueString(elgaServiceURLs); + if (!normalizedElgaServiceURLs.equals(elgaServiceURLs)) { + newConfigValues.put(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL, normalizedElgaServiceURLs); + log.debug("Change key: " + MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL + + " from value: " + input.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL) + + " to value: " + normalizedElgaServiceURLs); + } + + //check if service URLs are removed + for (String el : KeyValueUtils.getListOfCSVValues(normalizedElgaServiceURLs)) { + if (currentElgaServiceURLs.contains(el)) + currentElgaServiceURLs.remove(el); + } + } + //update OA configuration + if (!currentElgaServiceURLs.isEmpty()) { + String[] servicesOAs = dbconfig.findConfigurationId( + MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES_OA + + ".%." + + MOAIDConfigurationConstants.SERVICE_EXTERNAL_ELGA_MANDATE_SERVICE_URL); + for (String service : servicesOAs) { + String spElgaService = dbconfig.getStringValue(service); + if (MiscUtil.isNotEmpty(spElgaService) && + currentElgaServiceURLs.contains(spElgaService)) + keysToDelete.add(service); + } + } + + + + //normalize CSV of MIS mandate-service URLs + String misServiceURLs = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL, getKeyPrefix())); + List<String> currentMisServiceURLs = KeyValueUtils.getListOfCSVValues(dbconfig.getStringValue(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL)); + if (MiscUtil.isNotEmpty(misServiceURLs)) { + String normalizedMisServiceURLs = KeyValueUtils.normalizeCSVValueString(misServiceURLs); + if (!normalizedMisServiceURLs .equals(misServiceURLs)) { + newConfigValues.put(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL, normalizedMisServiceURLs); + log.debug("Change key: " + MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL + + " from value: " + input.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL) + + " to value: " + normalizedMisServiceURLs); + } + + //check if service URLs are removed + for (String el : KeyValueUtils.getListOfCSVValues(normalizedMisServiceURLs)) { + if (currentMisServiceURLs.contains(el)) + currentMisServiceURLs.remove(el); + } + } + //update OA configuration + if (!currentMisServiceURLs.isEmpty()) { + String[] servicesOAs = dbconfig.findConfigurationId( + MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES_OA + + ".%." + + MOAIDConfigurationConstants.SERVICE_EXTERNAL_MIS_SERVICE_URL); + for (String service : servicesOAs) { + String spElgaService = dbconfig.getStringValue(service); + if (MiscUtil.isNotEmpty(spElgaService) && + currentMisServiceURLs.contains(spElgaService)) + keysToDelete.add(service); + } + } + + //normalize CSV of SZR-GW service URLs + String szrgwServiceURLs = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL, getKeyPrefix())); + List<String> currentSzrgwServiceURLs = KeyValueUtils.getListOfCSVValues(dbconfig.getStringValue(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL)); + if (MiscUtil.isNotEmpty(szrgwServiceURLs)) { + String normalizedSzrgwServiceURLs = KeyValueUtils.normalizeCSVValueString(szrgwServiceURLs); + if (!normalizedSzrgwServiceURLs .equals(szrgwServiceURLs)) { + newConfigValues.put(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL, normalizedSzrgwServiceURLs); + log.debug("Change key: " + MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL + + " from value: " + input.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL) + + " to value: " + normalizedSzrgwServiceURLs); + } + + //check if service URLs are removed + for (String el : KeyValueUtils.getListOfCSVValues(szrgwServiceURLs)) { + if (currentSzrgwServiceURLs.contains(el)) + currentSzrgwServiceURLs.remove(el); + } + } + //update OA configuration + if (!currentSzrgwServiceURLs.isEmpty()) { + String[] servicesOAs = dbconfig.findConfigurationId( + MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES_OA + + ".%." + + MOAIDConfigurationConstants.SERVICE_EXTERNAL_SZRGW_SERVICE_URL); + for (String service : servicesOAs) { + String spElgaService = dbconfig.getStringValue(service); + if (MiscUtil.isNotEmpty(spElgaService) && + currentSzrgwServiceURLs.contains(spElgaService)) + keysToDelete.add(service); + } + } + + } catch (ConfigurationException e) { + log.error("Configuration is not accessable!", e); + + } + if (newConfigValues.isEmpty()) return null; else diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesAuthenticationInformationTask.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesAuthenticationInformationTask.java index 1819c5c2b..dcbee8e1d 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesAuthenticationInformationTask.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesAuthenticationInformationTask.java @@ -248,7 +248,37 @@ public class ServicesAuthenticationInformationTask extends AbstractTaskValidator } } } - + + check = input.get(MOAIDConfigurationConstants.SERVICE_EXTERNAL_MIS_SERVICE_URL); + if (MiscUtil.isNotEmpty(check) && + !ValidationHelper.validateURL(check)) { + log.info("Not valid MIS Service URL"); + errors.add(new ValidationObjectIdentifier( + MOAIDConfigurationConstants.SERVICE_EXTERNAL_MIS_SERVICE_URL, + "Mandates - MIS", + LanguageHelper.getErrorString("validation.general.mandateservice.valid", new Object[]{check}))); + } + + check = input.get(MOAIDConfigurationConstants.SERVICE_EXTERNAL_ELGA_MANDATE_SERVICE_URL); + if (MiscUtil.isNotEmpty(check) && + !ValidationHelper.validateURL(check)) { + log.info("Not valid ELGA Service URL"); + errors.add(new ValidationObjectIdentifier( + MOAIDConfigurationConstants.SERVICE_EXTERNAL_ELGA_MANDATE_SERVICE_URL, + "Mandates - ELGA", + LanguageHelper.getErrorString("validation.general.elga.mandateservice.valid", new Object[]{check}))); + } + + check = input.get(MOAIDConfigurationConstants.SERVICE_EXTERNAL_SZRGW_SERVICE_URL); + if (MiscUtil.isNotEmpty(check) && + !ValidationHelper.validateURL(check)) { + log.info("Not valid SZR-GW Service URL"); + errors.add(new ValidationObjectIdentifier( + MOAIDConfigurationConstants.SERVICE_EXTERNAL_SZRGW_SERVICE_URL, + "SZR-Gateway - Service URL", + LanguageHelper.getErrorString("validation.general.szrgw.url.valid", new Object[]{check}))); + } + if (!errors.isEmpty()) throw new ConfigurationTaskValidationException(errors); diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesProtocolPVP2XTask.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesProtocolPVP2XTask.java index c55c35da0..00b4ae01e 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesProtocolPVP2XTask.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesProtocolPVP2XTask.java @@ -22,8 +22,6 @@ */ package at.gv.egovernment.moa.id.config.webgui.validation.task.impl; -import iaik.x509.X509Certificate; - import java.io.IOException; import java.security.cert.CertificateException; import java.util.ArrayList; @@ -64,6 +62,7 @@ import at.gv.egovernment.moa.id.config.webgui.validation.utils.MetaDataVerificat import at.gv.egovernment.moa.id.config.webgui.validation.utils.SchemaValidationFilter; import at.gv.egovernment.moa.util.Base64Utils; import at.gv.egovernment.moa.util.MiscUtil; +import iaik.x509.X509Certificate; /** * @author tlenz @@ -196,8 +195,9 @@ public class ServicesProtocolPVP2XTask extends AbstractTaskValidator implements MOAIDWebGUIConfiguration.getInstance().getCertStoreDirectory(), MOAIDWebGUIConfiguration.getInstance().getTrustStoreDirectory(), null, - "pkix", - true); + "pkix", + true, + new String[]{"crl"}); httpClient.setCustomSSLTrustStore( metadataURL, |