diff options
Diffstat (limited to 'id/moa-id-webgui/src/main/java')
5 files changed, 58 insertions, 15 deletions
diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/MOAIDConfigurationModul.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/MOAIDConfigurationModul.java index 80ee9d8c1..9238ea3df 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/MOAIDConfigurationModul.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/MOAIDConfigurationModul.java @@ -191,10 +191,9 @@ public class MOAIDConfigurationModul implements ConfigurationModul{ } catch (ConfigurationValidationException e) { logger.warn("Validation of MOA-ID configuration FAILED."); - //TODO: update ConfigurationStorageException to add specific information of validation errors - throw new ConfigurationStorageException( - "Configuration validation finds " + e.getValidationErrors().size() + " errors!", - e, false, false); + //TODO: update ConfigurationStorageException to add specific information of validation errors + throw new ConfigurationStorageException(e.getFormatedErrorMessage(), + e, false, false); } try { diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/exception/ConfigurationValidationException.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/exception/ConfigurationValidationException.java index 859f2e45e..1b5020eb3 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/exception/ConfigurationValidationException.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/exception/ConfigurationValidationException.java @@ -22,8 +22,13 @@ */ package at.gv.egovernment.moa.id.config.webgui.exception; +import java.io.UnsupportedEncodingException; +import java.nio.charset.Charset; import java.util.List; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.JsonNodeFactory; + /** * @author tlenz * @@ -46,4 +51,24 @@ public class ConfigurationValidationException extends Exception { } + /** + * @return + */ + public String getFormatedErrorMessage() { + + ArrayNode valuesArray = JsonNodeFactory.instance.arrayNode(); + for (ValidationObjectIdentifier el : errors) { + valuesArray.add(el.getMessage()); + } + + try { + return new String(valuesArray.toString().getBytes(), "ISO-8859-1"); + + } catch (UnsupportedEncodingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return valuesArray.textValue(); + } + } + } 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 d061ce29b..8e8feefe0 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 @@ -24,6 +24,7 @@ package at.gv.egovernment.moa.id.config.webgui.validation.task.impl; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Pattern; @@ -33,6 +34,7 @@ import org.slf4j.LoggerFactory; import at.gv.egiz.components.configuration.api.Configuration; 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; import at.gv.egovernment.moa.id.config.webgui.exception.ConfigurationTaskValidationException; import at.gv.egovernment.moa.id.config.webgui.exception.ValidationObjectIdentifier; @@ -76,7 +78,22 @@ public class ServicesAuthenticationInformationTask extends AbstractTaskValidator @Override public Map<String, String> postProcessing(Map<String, String> input, List<String> keysToDelete, Configuration dbconfig) { - return null; + Map<String, String> newConfigValues = new HashMap<String, String>(); + + //normalize CSV encoded value string of mandate profiles + String mandateProfiles = input.get(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_OVS_PROFILES); + if (MiscUtil.isNotEmpty(mandateProfiles)) { + newConfigValues.put( + MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_OVS_PROFILES, + KeyValueUtils.normalizeCSVValueString(mandateProfiles)); + + } + + if (newConfigValues.isEmpty()) + return null; + else + return newConfigValues; + } /* (non-Javadoc) diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesProtocolOpenIDTask.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesProtocolOpenIDTask.java index e8cdbba90..51f93adca 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesProtocolOpenIDTask.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesProtocolOpenIDTask.java @@ -71,7 +71,7 @@ public class ServicesProtocolOpenIDTask extends AbstractTaskValidator implements */ @Override public String getName() { - return "Service - General Configuration Task"; + return "Service - Protocol OpenID-Connect Task"; } /* (non-Javadoc) diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesTargetTask.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesTargetTask.java index 766032f1f..5d23a60f6 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesTargetTask.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesTargetTask.java @@ -168,15 +168,17 @@ public class ServicesTargetTask extends AbstractTaskValidator implements ITaskVa //check PublicURL Prefix allows PublicService String uniqueID = input.get(MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER); - if (!ValidationHelper.isPublicServiceAllowed(input.get(uniqueID))) { - log.warn("PublicURLPrefix does not allow PublicService: " + uniqueID); - errors.add(new ValidationObjectIdentifier( - MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET, - "PublicService - Target", - LanguageHelper.getErrorString("validation.general.target.publicserviceurl", - new Object[] {uniqueID}) )); - - } + + //TODO: reactivate if Role based user management is complete! +// if (!ValidationHelper.isPublicServiceAllowed(input.get(uniqueID))) { +// log.warn("PublicURLPrefix does not allow PublicService: " + uniqueID); +// errors.add(new ValidationObjectIdentifier( +// MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET, +// "PublicService - Target", +// LanguageHelper.getErrorString("validation.general.target.publicserviceurl", +// new Object[] {uniqueID}) )); +// +// } //check Target check = input.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET); |