/* * Copyright 2014 Federal Chancellery Austria * MOA-ID has been developed in a cooperation between BRZ, the Federal * Chancellery Austria - ICT staff unit, and Graz University of Technology. * * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by * the European Commission - subsequent versions of the EUPL (the "Licence"); * You may not use this work except in compliance with the Licence. * You may obtain a copy of the Licence at: * http://www.osor.eu/eupl/ * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. * * This product combines work with different licenses. See the "NOTICE" text * file for details on the various modules and licenses. * The "NOTICE" text file is part of the distribution. Any derivative works * that you distribute must include a readable copy of the "NOTICE" text file. */ package at.gv.egovernment.moa.id.config.webgui.validation.task.impl; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.regex.Pattern; import org.apache.commons.collections4.map.HashedMap; 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.egiz.eaaf.core.impl.utils.KeyValueUtils; import at.gv.egovernment.moa.id.commons.MOAIDConstants; import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; import at.gv.egovernment.moa.id.config.webgui.exception.ConfigurationTaskValidationException; import at.gv.egovernment.moa.id.config.webgui.exception.ValidationObjectIdentifier; import at.gv.egovernment.moa.id.config.webgui.helper.LanguageHelper; import at.gv.egovernment.moa.id.config.webgui.validation.task.AbstractTaskValidator; import at.gv.egovernment.moa.id.config.webgui.validation.task.IDynamicLoadableTaskValidator; import at.gv.egovernment.moa.util.MiscUtil; /** * @author tlenz * */ public class GeneralSTORKConfigurationTask extends AbstractTaskValidator implements IDynamicLoadableTaskValidator { private static final Logger log = LoggerFactory.getLogger(GeneralSTORKConfigurationTask.class); public static final List KEYWHITELIST; static { ArrayList temp = new ArrayList(); temp.add( KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL) + ".\\S?." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY); temp.add( KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL) + ".\\S?." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME); temp.add( KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL) + ".\\S?." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_SUPPORT_XMLDSIG); temp.add( KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL) + ".\\S?." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY); temp.add( KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL) + ".\\S?." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL); temp.add( KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_QAA, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL)); KEYWHITELIST = Collections.unmodifiableList(temp); } /* (non-Javadoc) * @see at.gv.egovernment.moa.id.config.webgui.validation.task.ITaskValidator#validate(java.util.Map) */ @Override public void taskValidate(Map input) throws ConfigurationTaskValidationException { List errors = new ArrayList(); Map validatedCPeps = new HashedMap(); List validatedAttributes = new ArrayList(); //validate C-PEPS entries Map cPepsList = KeyValueUtils.getSubSetWithPrefix(input, KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL)); if (!cPepsList.isEmpty()) { Iterator cPepsKeys = cPepsList.keySet().iterator(); while (cPepsKeys.hasNext()) { String cpepsKey = cPepsKeys.next(); String index = KeyValueUtils.getParentKey(cpepsKey); if (cpepsKey.endsWith(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY)) { String cc = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL) + "." + cpepsKey); String url = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL) + "." + index + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL); log.trace("Extract C-PEPS for country: " + cc + " with URL:" + url); if (!validatedCPeps.containsKey(cc)) { if (MiscUtil.isNotEmpty(cc)) { if (ValidationHelper.containsNotValidCharacter(cc, false)) { log.warn("CPEPS config countrycode contains potentail XSS characters: " + cc); errors.add(new ValidationObjectIdentifier( MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + "." + cpepsKey, "STORK - CPEPS Country", LanguageHelper.getErrorString("validation.stork.cpeps.cc", new Object[] {ValidationHelper.getNotValidCharacter(false)}))); } if(!cc.toLowerCase().matches("(^[a-z][a-z]$)|(^[a-z][a-z]-[a-z,0-9]*)")) { log.warn("CPEPS config countrycode does not comply to ISO 3166-2 : " + cc); errors.add(new ValidationObjectIdentifier( MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + "." + cpepsKey, "STORK - CPEPS Country", LanguageHelper.getErrorString("validation.stork.cpeps.cc", new Object[] {cc}))); } // check url if (MiscUtil.isNotEmpty(url)) { if (!ValidationHelper.validateURL(url)) { log.info("CPEPS config URL is invalid : " + url); errors.add(new ValidationObjectIdentifier( MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + "." + index + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL, "STORK - CPEPS URL", LanguageHelper.getErrorString("validation.stork.cpeps.url"))); } } else { log.warn("CPEPS config url is empty : " + url); errors.add(new ValidationObjectIdentifier( MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + "." + index + "." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL, "STORK - CPEPS URL", LanguageHelper.getErrorString("validation.stork.cpeps.empty", new Object[] {url}))); } } else { log.warn("CPEPS config countrycode is empty : " + cc); // errors.add(new ValidationObjectIdentifier( // MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST // + "." + cpepsKey, // "STORK - CPEPS Country", // LanguageHelper.getErrorString("validation.stork.cpeps.empty", // new Object[] {cc}))); } validatedCPeps.put(cc, url); } else { log.warn("Duplicated C-PEPS country with countryCode: " + cc + " found."); errors.add(new ValidationObjectIdentifier( MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + "." + cpepsKey, "STORK - CPEPS Country", LanguageHelper.getErrorString("validation.stork.cpeps.duplicate"))); } } } } // 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)) { log.warn("eIDAS LoA is not allowed : " + eIDAS_LOA); errors.add(new ValidationObjectIdentifier( MOAIDConfigurationConstants.GENERAL_AUTH_STORK_QAA, "eIDAS - LoA Level", LanguageHelper.getErrorString("validation.stork.qaa.outofrange", new Object[] {eIDAS_LOA}))); } } catch (Exception e) { log.warn("eIDAS LoA can not parsed : " + input.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_QAA)); errors.add(new ValidationObjectIdentifier( MOAIDConfigurationConstants.GENERAL_AUTH_STORK_QAA, "eIDAS - LoA Level", LanguageHelper.getErrorString("validation.stork.qaa.outofrange", new Object[] {input.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_QAA)}))); } // check attributes Map attributeList = KeyValueUtils.getSubSetWithPrefix(input, KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL)); if (!attributeList.isEmpty()) { for(String key : attributeList.keySet()) { if (key.endsWith(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME)) { String value = attributeList.get(key); value = value.replace("eidas/attributes/", ""); // since eIDaS attributes come with a "/", we need to exclude them from validation. TODO Or should we require the admin to escape them in the UI? if (!validatedAttributes.contains(value)) { if (ValidationHelper.containsNotValidCharacter(value, true)) { log.warn("default attributes contains potentail XSS characters: " + value); errors.add(new ValidationObjectIdentifier( MOAIDConfigurationConstants.GENERAL_AUTH_STORK_QAA, "STORK - Attributes", LanguageHelper.getErrorString("validation.stork.requestedattributes", new Object[] {ValidationHelper.getNotValidCharacter(true)}))); } if(!value.toLowerCase().matches("^[A-Za-z]*$")) { log.warn("default attributes do not match the requested format : " + value); errors.add(new ValidationObjectIdentifier( MOAIDConfigurationConstants.GENERAL_AUTH_STORK_QAA, "STORK - Attributes", LanguageHelper.getErrorString("validation.stork.requestedattributes", new Object[] {value}))); } validatedAttributes.add(value); } else { log.warn("Duplicated STORK attribute: " + value + " found."); errors.add(new ValidationObjectIdentifier( MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST + "." + key, "STORK - Attributes", LanguageHelper.getErrorString("validation.stork.requestedattributes"))); } } } } if (!errors.isEmpty()) throw new ConfigurationTaskValidationException(errors); } /* (non-Javadoc) * @see at.gv.egovernment.moa.id.config.webgui.validation.task.ITaskValidator#postProcessing(java.util.Map, java.util.List, at.gv.egiz.components.configuration.api.Configuration) */ @Override public Map postProcessing(Map input, List keysToDelete, Configuration dbconfig) { List currentCEPSCountries = new ArrayList(); List currentAttributeNames = new ArrayList(); List cPESCountriesToAdd = new ArrayList(); List attributeNamesToAdd = new ArrayList(); List cPESCountriesToDelete = new ArrayList(); List attributeNamesToDelete = new ArrayList(); Map newConfigValues = new HashMap(); try { //load current configuration String[] currentCPEPSKeys = dbconfig.findConfigurationId( MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + ".%." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY); if (currentCPEPSKeys != null) { for (String el : currentCPEPSKeys) { String cc = dbconfig.getStringValue(el); if (MiscUtil.isNotEmpty(cc)) currentCEPSCountries.add(cc); else { //if empty, mark do delete String keyToDelete = KeyValueUtils.getParentKey(el) + ".*"; log.trace("Mark C-PEPS key: {} for deleting.", keyToDelete); keysToDelete.add(keyToDelete); } } cPESCountriesToDelete.addAll(currentCEPSCountries); } String[] currentAttributeKeys = dbconfig.findConfigurationId( MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST + ".%." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME); if (currentAttributeKeys != null) { for (String el : currentAttributeKeys) { String cc = dbconfig.getStringValue(el); if (MiscUtil.isNotEmpty(cc)) currentAttributeNames.add(cc); else { //if empty, mark do delete String keyToDelete = KeyValueUtils.getParentKey(el) + ".*"; log.trace("Mark empty STORK attribute key: {} for deleting.", keyToDelete); keysToDelete.add(keyToDelete); } } attributeNamesToDelete.addAll(currentAttributeNames); } //parse new configuration Map cPepsList = KeyValueUtils.getSubSetWithPrefix(input, KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL)); if (!cPepsList.isEmpty()) { Iterator cPepsKeys = cPepsList.keySet().iterator(); while (cPepsKeys.hasNext()) { String cpepsKey = cPepsKeys.next(); if (cpepsKey.endsWith(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY)) { String cc = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL) + "." + cpepsKey); //check new configuration against current configuration if (currentCEPSCountries.contains(cc)) { log.trace("C-PEPS for country {} is already in configuration", cc); cPESCountriesToDelete.remove(cc); } else { if (MiscUtil.isNotEmpty(cc)) { log.trace("C-PEPS for country {} must be added to Service configurations", cc); cPESCountriesToAdd.add(cc); } } } } } Map attributeList = KeyValueUtils.getSubSetWithPrefix(input, KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL)); if (!attributeList.isEmpty()) { Iterator attributeKeys = attributeList.keySet().iterator(); while (attributeKeys.hasNext()) { String attributeKey = attributeKeys.next(); if (attributeKey.endsWith(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME)) { String attributeName = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL) + "." + attributeKey); //check new configuration against current configuration if (currentAttributeNames.contains(attributeName)) { log.trace("STORK Attribute {} is already in configuration", attributeName); attributeNamesToDelete.remove(attributeName); } else { if (MiscUtil.isNotEmpty(attributeName)) { log.trace("STORK Attribute {} must be added to Service configurations", attributeName); attributeNamesToAdd.add(attributeName); } } } } } //add new key/value pairs to online Applications if (!cPESCountriesToAdd.isEmpty() || !attributeNamesToAdd.isEmpty()) { String[] currentOAServices = dbconfig.findConfigurationId( MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES_OA + ".%." + MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER); for(String el : currentOAServices) { String oaKey = KeyValueUtils.getParentKey(el); String[] oaCPEPSList = dbconfig.findConfigurationId( oaKey + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST + ".%." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_COUNTRYCODE); int nextListCounter = KeyValueUtils.findNextFreeListCounter(oaCPEPSList, oaKey + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST); //get all C-PEPS countries from OA List actuallyAddedOACPEPS = new ArrayList(); for (String oaCPEPS : oaCPEPSList) { String oaCC = dbconfig.getStringValue(oaCPEPS); if (MiscUtil.isNotEmpty(oaCC) && !actuallyAddedOACPEPS.contains(oaCC)) actuallyAddedOACPEPS.add(oaCC); } for (String cc : cPESCountriesToAdd) { if (!actuallyAddedOACPEPS.contains(cc)) { log.debug("Add key: " + oaKey + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST + "." + String.valueOf(nextListCounter) + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_COUNTRYCODE + " and value: " + cc + " to configuration."); newConfigValues.put(oaKey + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST + "." + String.valueOf(nextListCounter) + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_COUNTRYCODE , cc); log.debug("Add key: " + oaKey + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST + "." + String.valueOf(nextListCounter) + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_ENABLED + " and value: true" + " to configuration."); newConfigValues.put(oaKey + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST + "." + String.valueOf(nextListCounter) + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_ENABLED , String.valueOf(true)); nextListCounter++; } else { log.info("Configuration is maybe inconsistend! New C-PEPS country: " + cc + " is already added on Service: " + oaKey); } } String[] oaAttributeList = dbconfig.findConfigurationId( oaKey + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST + ".%." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_NAME); int nextAttributeListCounter = KeyValueUtils.findNextFreeListCounter(oaAttributeList, oaKey + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST); //get all STORK attributes from OA List actuallyAddedOAAttributes = new ArrayList(); for (String oaAttr : oaAttributeList) { String oaAttrName = dbconfig.getStringValue(oaAttr); if (MiscUtil.isNotEmpty(oaAttrName) && !actuallyAddedOAAttributes.contains(oaAttrName)) actuallyAddedOAAttributes.add(oaAttrName); } for (String attrName : attributeNamesToAdd) { if (!actuallyAddedOAAttributes.contains(attrName)) { log.debug("Add key: " + oaKey + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST + "." + String.valueOf(nextAttributeListCounter) + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_NAME + " and value: " + attrName + " to configuration."); newConfigValues.put(oaKey + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST + "." + String.valueOf(nextAttributeListCounter) + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_NAME , attrName); log.debug("Add key: " + oaKey + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST + "." + String.valueOf(nextAttributeListCounter) + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_REQUESTED + " and value: true" + " to configuration."); newConfigValues.put(oaKey + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST + "." + String.valueOf(nextAttributeListCounter) + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_REQUESTED , String.valueOf(true)); log.debug("Add key: " + oaKey + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST + "." + String.valueOf(nextAttributeListCounter) + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY + " and value: false" + " to configuration."); newConfigValues.put(oaKey + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST + "." + String.valueOf(nextAttributeListCounter) + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY , String.valueOf(false)); } else { log.info("Configuration is maybe inconsistend! New STORK attribute: " + attrName + " is already added on Service: " + oaKey); } } } } //delete unused key/value pairs from online applications if (!cPESCountriesToDelete.isEmpty()) { for (String el : cPESCountriesToDelete) { //mark general config to delete String[] generalCPEPS = dbconfig.findConfigurationId( MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + ".%." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY); for (String ccKey : generalCPEPS) { String storedCC = dbconfig.getStringValue(ccKey); if (el.equals(storedCC)) { //delete C-PEPS String keyToDelete = KeyValueUtils.getParentKey(ccKey) + ".*"; log.debug("Mark key: " + keyToDelete + " for deleting."); keysToDelete.add(keyToDelete); } } //mark service key to delete String[] servicesOAs = dbconfig.findConfigurationId( MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES_OA + ".%." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST + ".%." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_COUNTRYCODE); for (String ccKey : servicesOAs) { String storedCC = dbconfig.getStringValue(ccKey); if (el.equals(storedCC)) { //delete C-PEPS String keyToDelete = KeyValueUtils.getParentKey(ccKey) + ".*"; log.debug("Mark key: " + keyToDelete + " for deleting."); keysToDelete.add(keyToDelete); } } } } if (!attributeNamesToDelete.isEmpty()) { for (String el : attributeNamesToDelete) { //mark general config to delete String[] generalAttributes = dbconfig.findConfigurationId( MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST + ".%." + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME); for (String attrKey : generalAttributes) { String storedAttr = dbconfig.getStringValue(attrKey); if (el.equals(storedAttr)) { //delete C-PEPS String keyToDelete = KeyValueUtils.getParentKey(attrKey) + ".*"; log.debug("Mark key: " + keyToDelete + " for deleting."); keysToDelete.add(keyToDelete); } } //mark service key to delete String[] servicesOAs = dbconfig.findConfigurationId( MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES_OA + ".%." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST + ".%." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_NAME); for (String attrKey : servicesOAs) { String storedAttr = dbconfig.getStringValue(attrKey); if (el.equals(storedAttr)) { //delete C-PEPS String keyToDelete = KeyValueUtils.getParentKey(attrKey) + ".*"; log.debug("Mark key: " + keyToDelete + " for deleting."); keysToDelete.add(keyToDelete); } } } } } catch (ConfigurationException e) { log.error("Configuration is not accessable!", e); } if (newConfigValues.isEmpty()) return null; else return newConfigValues; } /* (non-Javadoc) * @see at.gv.egovernment.moa.id.config.webgui.validation.task.ITaskValidator#getKeyPrefix() */ @Override public String getKeyPrefix() { return MOAIDConfigurationConstants.GENERAL_AUTH_STORK; } /* (non-Javadoc) * @see at.gv.egovernment.moa.id.config.webgui.validation.task.ITaskValidator#getName() */ @Override public String getName() { return "General STORK Configuration Task"; } /* (non-Javadoc) * @see at.gv.egovernment.moa.id.config.webgui.validation.task.IDynamicLoadableTaskValidator#getModulValidatorPrefix() */ @Override public List getModulValidatorPrefix() { return Arrays.asList(MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL); } /* (non-Javadoc) * @see at.gv.egovernment.moa.id.config.webgui.validation.task.AbstractTaskValidator#getAllAllowedKeys() */ @Override public List getAllAllowedPatterns() { return generatePatternsFromKeys(KEYWHITELIST); } }