From 871e8fefefdd935bc99db467d43f4ec61dba251d Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Mon, 18 Jan 2016 17:34:23 +0100 Subject: add virtual IDP enabled flag to configuration --- .../task/impl/GeneralMOAIDConfigurationTask.java | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'id/moa-id-webgui/src/main/java/at') 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 891295777..1c3e0fe13 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 @@ -29,6 +29,7 @@ import java.util.List; import java.util.Map; import java.util.regex.Pattern; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -114,17 +115,32 @@ public class GeneralMOAIDConfigurationTask extends AbstractTaskValidator impleme } check = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX, getKeyPrefix())); + String isVirtualIDPEnabled = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_ISVIRTUALIDPSENABLED, getKeyPrefix())); if (MiscUtil.isNotEmpty(check)) { String[] preFixList = check.split(","); - for (String el : preFixList) { - if (!ValidationHelper.validateURL(el.trim())) { - log.info("Public URL Prefix is not valid"); + if (isVirtualIDPEnabled != null && Boolean.valueOf(isVirtualIDPEnabled)) { + for (String el : preFixList) { + if (!ValidationHelper.validateURL(el.trim())) { + log.info("Public URL Prefix is not valid"); + errors.add(new ValidationObjectIdentifier( + MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX, + "Public URL Prefix", + LanguageHelper.getErrorString("validation.general.publicURLprefix.valid", new Object[]{el}))); + } + } + } else { + if (!ValidationHelper.validateURL( + StringUtils.chomp(preFixList[0].trim()))) { + log.info("Public URL Prefix " + preFixList[0] + " is not valid"); errors.add(new ValidationObjectIdentifier( MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX, "Public URL Prefix", - LanguageHelper.getErrorString("validation.general.publicURLprefix.valid", new Object[]{el}))); + LanguageHelper.getErrorString("validation.general.publicURLprefix.valid", new Object[]{preFixList[0]}))); + } + } + } else { log.info("PublicURL Prefix is empty."); errors.add(new ValidationObjectIdentifier( -- cgit v1.2.3