aboutsummaryrefslogtreecommitdiff
path: root/id/moa-id-webgui
diff options
context:
space:
mode:
Diffstat (limited to 'id/moa-id-webgui')
-rw-r--r--id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralMOAIDConfigurationTask.java64
-rw-r--r--id/moa-id-webgui/src/main/resources/applicationResources_de.properties2
-rw-r--r--id/moa-id-webgui/src/main/resources/applicationResources_en.properties2
3 files changed, 52 insertions, 16 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 0e9411042..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,14 +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)) {
- if (!ValidationHelper.validateURL(check)) {
- log.info("Public URL Prefix is not valid");
- errors.add(new ValidationObjectIdentifier(
- MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX,
- "Public URL Prefix",
- LanguageHelper.getErrorString("validation.general.publicURLprefix.valid")));
- }
+ String[] preFixList = check.split(",");
+ 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[]{preFixList[0]})));
+
+ }
+
+ }
+
} else {
log.info("PublicURL Prefix is empty.");
errors.add(new ValidationObjectIdentifier(
@@ -511,15 +530,32 @@ public class GeneralMOAIDConfigurationTask extends AbstractTaskValidator impleme
Map<String, String> newConfigValues = new HashMap<String, String>();
- String pubURLPrefix = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX, getKeyPrefix()));
- if(pubURLPrefix.endsWith("/")) {
- int length = pubURLPrefix.length();
- pubURLPrefix = pubURLPrefix.substring(0, length-1);
- newConfigValues.put(MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX, pubURLPrefix);
+ String pubURLPrefix = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX, getKeyPrefix()));
+ String normalizedPubURLPrefix = KeyValueUtils.normalizeCSVValueString(pubURLPrefix);
+ String[] normalizedPubURLPrefixList = normalizedPubURLPrefix.split(KeyValueUtils.CSV_DELIMITER);
+ String modifiedPubURLPrefixCSV = null;
+
+ for (String el : normalizedPubURLPrefixList) {
+ String newPubURLPrefix = el;
+ if(el.endsWith("/")) {
+ int length = el.length();
+ newPubURLPrefix = el.substring(0, length-1);
+ }
+
+ if (modifiedPubURLPrefixCSV == null)
+ modifiedPubURLPrefixCSV = newPubURLPrefix;
+ else
+ modifiedPubURLPrefixCSV += KeyValueUtils.CSV_DELIMITER + newPubURLPrefix;
+
+ }
+
+ if (!modifiedPubURLPrefixCSV.equals(pubURLPrefix)) {
+ newConfigValues.put(MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX, modifiedPubURLPrefixCSV);
log.debug("Change key: " + MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX
+ " from value: " + input.get(MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX)
- + " to value: " + pubURLPrefix);
- }
+ + " to value: " + modifiedPubURLPrefixCSV);
+ }
+
String ssoTarget = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_TARGET, getKeyPrefix()));
if (MiscUtil.isNotEmpty(ssoTarget)) {
diff --git a/id/moa-id-webgui/src/main/resources/applicationResources_de.properties b/id/moa-id-webgui/src/main/resources/applicationResources_de.properties
index bb0499020..8f7ccd8ab 100644
--- a/id/moa-id-webgui/src/main/resources/applicationResources_de.properties
+++ b/id/moa-id-webgui/src/main/resources/applicationResources_de.properties
@@ -373,7 +373,7 @@ validation.edituser.bpk.valid=Die BPK enth\u00E4lt nicht erlaubte Zeichen. Folge
validation.general.SAML1SourceID=Die SAML1SourceID enth\u00E4lt nicht erlaubte Zeichen. Folgende Zeichen sind nicht erlaubt\: {0}
validation.general.publicURLprefix.empty=Public URL Prefix Feld ist leer.
-validation.general.publicURLprefix.valid=Public URL Prefix hat kein g\u00FCltiges Format.
+validation.general.publicURLprefix.valid=Public URL Prefix {0} hat kein g\u00FCltiges Format.
validation.general.businessservice.empty=Die Application ist weder dem \u00F6ffentlichen noch dem privaten Sektor zugeordnet.
validation.general.certStoreDirectory.empty=CertStoreDirectory Feld ist leer.
validation.general.certStoreDirectory.valid=Das CertStoreDirectory Feld enth\u00E4lt nicht erlaubte Zeichen. Folgende Zeichen sind nicht erlaubt\: {0}
diff --git a/id/moa-id-webgui/src/main/resources/applicationResources_en.properties b/id/moa-id-webgui/src/main/resources/applicationResources_en.properties
index 420ac27ec..9e472e3af 100644
--- a/id/moa-id-webgui/src/main/resources/applicationResources_en.properties
+++ b/id/moa-id-webgui/src/main/resources/applicationResources_en.properties
@@ -371,7 +371,7 @@ validation.edituser.bpk.valid=BPK contains forbidden characters. The following c
validation.general.SAML1SourceID=SAML1SourceID contains forbidden characters. The following characters are not allowed\: {0}
validation.general.publicURLprefix.empty=Public URL Prefix is blank.
-validation.general.publicURLprefix.valid=Public URL Prefix has invalid format.
+validation.general.publicURLprefix.valid=Public URL Prefix {0} has invalid format.
validation.general.businessservice.empty=Online application is no public or private application.
validation.general.certStoreDirectory.empty=CertStoreDirectory is blank.
validation.general.certStoreDirectory.valid=CertStoreDirectory Feld contains forbidden characters. The following characters are not allowed\: {0}