aboutsummaryrefslogtreecommitdiff
path: root/id/moa-id-webgui/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'id/moa-id-webgui/src/main/java')
-rw-r--r--id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesAuthenticationInformationTask.java76
1 files changed, 76 insertions, 0 deletions
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 25855dcb6..956d07c44 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
@@ -279,6 +279,82 @@ public class ServicesAuthenticationInformationTask extends AbstractTaskValidator
LanguageHelper.getErrorString("validation.general.szrgw.url.valid", new Object[]{check})));
}
+
+
+
+
+
+ check = input.get(MOAIDConfigurationConstants.SERVICE_AUTH_SL20_ENDPOINTS);
+ if (input.get(MOAIDConfigurationConstants.SERVICE_AUTH_SL20_ENABLED) != null &&
+ Boolean.valueOf(input.get(MOAIDConfigurationConstants.SERVICE_AUTH_SL20_ENABLED))) {
+ if (MiscUtil.isNotEmpty(check)) {
+ log.debug("Validate SL2.0 configuration ... ");
+ List<String> sl20Endpoints = KeyValueUtils.getListOfCSVValues(check);
+ if (sl20Endpoints.size() == 1) {
+ String value = sl20Endpoints.get(0);
+
+ if (!value.startsWith(KeyValueUtils.DEFAULT_VALUE + KeyValueUtils.KEYVVALUEDELIMITER) &&
+ value.contains(KeyValueUtils.KEYVVALUEDELIMITER)) {
+ log.warn("SL2.0 endpoint '" + value + "' has wrong format");
+ errors.add(new ValidationObjectIdentifier(
+ MOAIDConfigurationConstants.SERVICE_AUTH_SL20_ENDPOINTS,
+ "SL2.0 - EndPoint URLs",
+ LanguageHelper.getErrorString("validation.general.sl20.endpoints.wrong", new Object[]{value})));
+
+ } else if (!value.startsWith(KeyValueUtils.DEFAULT_VALUE + KeyValueUtils.KEYVVALUEDELIMITER) &&
+ !value.contains(KeyValueUtils.KEYVVALUEDELIMITER) ) {
+ log.info("Find one SL2.0 endpoint without 'default='. Start updateing ... ");
+ sl20Endpoints.remove(0);
+ sl20Endpoints.add(KeyValueUtils.DEFAULT_VALUE + KeyValueUtils.KEYVVALUEDELIMITER + value);
+
+ }
+
+ } else {
+ boolean findDefault = false;
+ for (String el : sl20Endpoints) {
+ if (!el.contains(KeyValueUtils.KEYVVALUEDELIMITER)) {
+ log.warn("SL2.0 endpoint '" + el + "' has wrong format");
+ errors.add(new ValidationObjectIdentifier(
+ MOAIDConfigurationConstants.SERVICE_AUTH_SL20_ENDPOINTS,
+ "SL2.0 - EndPoint URLs",
+ LanguageHelper.getErrorString("validation.general.sl20.endpoints.wrong", new Object[]{el})));
+
+ } else {
+ if (el.startsWith(KeyValueUtils.DEFAULT_VALUE + KeyValueUtils.KEYVVALUEDELIMITER)) {
+ log.debug("Find default endpoint.");
+ findDefault = true;
+
+ } else {
+ String firstPart = el.split(KeyValueUtils.KEYVVALUEDELIMITER)[0];
+ try {
+ Integer.valueOf(firstPart);
+
+ } catch (NumberFormatException e) {
+ log.warn("SL2.0 endpoint '" + el + "' has wrong format", e);
+ errors.add(new ValidationObjectIdentifier(
+ MOAIDConfigurationConstants.SERVICE_AUTH_SL20_ENDPOINTS,
+ "SL2.0 - EndPoint URLs",
+ LanguageHelper.getErrorString("validation.general.sl20.endpoints.wrong", new Object[]{el})));
+
+ }
+ }
+ }
+ }
+
+ if (!findDefault) {
+ log.warn("SL2.0 endpoints contains NO default endpoint");
+ errors.add(new ValidationObjectIdentifier(
+ MOAIDConfigurationConstants.SERVICE_AUTH_SL20_ENDPOINTS,
+ "SL2.0 - EndPoint URLs",
+ LanguageHelper.getErrorString("validation.general.sl20.endpoints.default", new Object[]{})));
+
+ }
+ }
+ }
+ }
+
+
+
if (!errors.isEmpty())
throw new ConfigurationTaskValidationException(errors);