diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2016-01-15 16:55:45 +0100 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2016-01-15 16:55:45 +0100 |
commit | 52cfe0524d896d65254f480bd975554be3f2cb14 (patch) | |
tree | c9a363dcc4bb668d0569191b54fc1e7fcaf6e080 /id/moa-id-webgui/src/main/java/at/gv | |
parent | 539018744865c4b10f689672f11f9ae0ddf65fef (diff) | |
parent | 52a855d948a6c3090b5d696774896deac95b621f (diff) | |
download | moa-id-spss-52cfe0524d896d65254f480bd975554be3f2cb14.tar.gz moa-id-spss-52cfe0524d896d65254f480bd975554be3f2cb14.tar.bz2 moa-id-spss-52cfe0524d896d65254f480bd975554be3f2cb14.zip |
Merge branch 'multiple_IDP_publicURLPrefixes' into moa-id-3.0.0-snapshot
Conflicts:
id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthConstants.java
id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/GenerateIFrameTemplateServlet.java
id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/assertion/PVP2AssertionBuilder.java
Diffstat (limited to 'id/moa-id-webgui/src/main/java/at/gv')
-rw-r--r-- | id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralMOAIDConfigurationTask.java | 48 |
1 files changed, 34 insertions, 14 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..616d9f0f4 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 @@ -115,13 +115,16 @@ public class GeneralMOAIDConfigurationTask extends AbstractTaskValidator impleme check = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX, 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(","); + for (String el : preFixList) { + if (!ValidationHelper.validateURL(el)) { + 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 { log.info("PublicURL Prefix is empty."); errors.add(new ValidationObjectIdentifier( @@ -511,15 +514,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(","); + 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 += "," + 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)) { |