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 /id/moa-id-webgui/src/main/java | |
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
Diffstat (limited to 'id/moa-id-webgui/src/main/java')
2 files changed, 41 insertions, 2 deletions
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, |