diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2019-06-07 10:43:43 +0200 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2019-06-07 10:43:43 +0200 |
commit | cbd8e754af9c4898f7834e0c147c3e86b87d6f5f (patch) | |
tree | ff67d70313a98bbc803b017d1d98182182c05352 | |
parent | 4392bf1deba6ac8c6c28a48d896b0fb7a8757a34 (diff) | |
download | moa-id-spss-cbd8e754af9c4898f7834e0c147c3e86b87d6f5f.tar.gz moa-id-spss-cbd8e754af9c4898f7834e0c147c3e86b87d6f5f.tar.bz2 moa-id-spss-cbd8e754af9c4898f7834e0c147c3e86b87d6f5f.zip |
fix problems in configuration tool
5 files changed, 65 insertions, 16 deletions
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 11fbccc0a..3929238f6 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 @@ -1149,18 +1149,19 @@ public class GeneralMOAIDConfig { return eidSystemServiceURL; } + public boolean isMoaidMode() { + return moaidMode; + } + /** - * @param eidSystemServiceURL the elgaMandateServiceURL to set + * @param eidSystemServiceURL the E-ID Service URL to set */ - public void setEidSystemeServiceURL(String eidSystemServiceURL) { + public void setEidSystemServiceURL(String eidSystemServiceURL) { if (MiscUtil.isNotEmpty(eidSystemServiceURL)) this.eidSystemServiceURL = KeyValueUtils.removeAllNewlineFromString(eidSystemServiceURL); else this.eidSystemServiceURL = eidSystemServiceURL; } - - public boolean isMoaidMode() { - return moaidMode; - } + } 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 7c3daf928..8e057db0f 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 @@ -691,7 +691,8 @@ public class EditGeneralConfigAction extends BasicAction { StringUtils.chomp(moaconfig.getElgaMandateServiceURL().trim())); } - } + } else + dbconfig.setElgaMandateServiceURLs(null); } @@ -710,8 +711,10 @@ public class EditGeneralConfigAction extends BasicAction { dbconfig.setEidSystemServiceURLs( StringUtils.chomp(moaconfig.getEidSystemServiceURL().trim())); - } - } + } + + } else + dbconfig.setEidSystemServiceURLs(null); if (isMoaidMode) { diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java index 6902a668f..31126d14f 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java @@ -167,7 +167,8 @@ public class EditOAAction extends BasicOAAction { } - getStorkOA().setHelperAttributes(attributes); + if (getStorkOA() != null) + getStorkOA().setHelperAttributes(attributes); UserDatabase userdb = configuration.getUserManagement().getUserWithID(authUser .getUserID()); @@ -180,11 +181,16 @@ public class EditOAAction extends BasicOAAction { return Constants.STRUTS_SUCCESS; } - session.setAttribute( - Constants.SESSION_OAUTH20SECRET, - ((OAOAuth20Config) formList.get(new OAOAuth20Config().getName())) + if (formList.get(new OAOAuth20Config().getName()) != null) + session.setAttribute( + Constants.SESSION_OAUTH20SECRET, + ((OAOAuth20Config) formList.get(new OAOAuth20Config().getName())) .getClientSecret()); - session.setAttribute(Constants.SESSION_BKUFORMPREVIEW, getFormOA().getFormMap()); + + if (getFormOA() != null) + session.setAttribute(Constants.SESSION_BKUFORMPREVIEW, getFormOA().getFormMap()); + + nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name(); return Constants.STRUTS_OA_EDIT; 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 ca2df5b66..06e53bf53 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 @@ -726,7 +726,7 @@ public class GeneralMOAIDConfigurationTask extends AbstractTaskValidator impleme //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_CENTRAL_EIDASNODE_URL)); + List<String> currentSzrgwServiceURLs = KeyValueUtils.getListOfCSVValues(dbconfig.getStringValue(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL)); if (MiscUtil.isNotEmpty(szrgwServiceURLs)) { String normalizedSzrgwServiceURLs = KeyValueUtils.normalizeCSVValueString(szrgwServiceURLs); if (!normalizedSzrgwServiceURLs .equals(szrgwServiceURLs)) { @@ -755,6 +755,45 @@ public class GeneralMOAIDConfigurationTask extends AbstractTaskValidator impleme keysToDelete.add(service); } } + + + //normalize CSV of SZR-GW service URLs + String eidServiceURLs = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_EID_SYSTEM_SERVICE_URL, getKeyPrefix())); + List<String> currenteidServiceURLs = KeyValueUtils.getListOfCSVValues(dbconfig.getStringValue(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_EID_SYSTEM_SERVICE_URL)); + if (MiscUtil.isNotEmpty(eidServiceURLs)) { + String normalizedeidServiceURLs = KeyValueUtils.normalizeCSVValueString(eidServiceURLs); + if (!normalizedeidServiceURLs.equals(eidServiceURLs)) { + newConfigValues.put(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_EID_SYSTEM_SERVICE_URL, normalizedeidServiceURLs); + log.debug("Change key: " + MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_EID_SYSTEM_SERVICE_URL + + " from value: " + input.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_EID_SYSTEM_SERVICE_URL) + + " to value: " + normalizedeidServiceURLs); + } + + //check if service URLs are removed + for (String el : KeyValueUtils.getListOfCSVValues(eidServiceURLs)) { + if (currenteidServiceURLs.contains(el)) + currenteidServiceURLs.remove(el); + } + + } else if (!currenteidServiceURLs.isEmpty() && MiscUtil.isEmpty(eidServiceURLs)) { + keysToDelete.add(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_EID_SYSTEM_SERVICE_URL); + + } + + //update OA configuration + if (!currenteidServiceURLs.isEmpty()) { + String[] servicesOAs = dbconfig.findConfigurationId( + MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES_OA + + ".%." + + MOAIDConfigurationConstants.SERVICE_EXTERNAL_EID_SYSTEM_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); diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralSTORKConfigurationTask.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralSTORKConfigurationTask.java index 4567afcba..8556348ba 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralSTORKConfigurationTask.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralSTORKConfigurationTask.java @@ -187,7 +187,7 @@ public static final List<String> KEYWHITELIST; // check qaa try { String eIDAS_LOA = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_QAA, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL)); - if (!MOAIDConstants.ALLOWED_eIDAS_LOA.contains(eIDAS_LOA)) { + if (eIDAS_LOA != null && !MOAIDConstants.ALLOWED_eIDAS_LOA.contains(eIDAS_LOA)) { log.warn("eIDAS LoA is not allowed : " + eIDAS_LOA); errors.add(new ValidationObjectIdentifier( MOAIDConfigurationConstants.GENERAL_AUTH_STORK_QAA, |