From 7822346ccba084677534b4226080ef41de7b9865 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Wed, 22 Jul 2015 09:59:33 +0200 Subject: fix problem with SAML1 in legacy mode and targetFriendlyName --- .../parser/StartAuthentificationParameterParser.java | 19 +++++++++++++++++++ .../moa/id/commons/validation/TargetValidator.java | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'id/server') diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java index 3b4e5e735..ded261bfc 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java @@ -34,6 +34,7 @@ import at.gv.egovernment.moa.id.auth.data.AuthenticationSession; import at.gv.egovernment.moa.id.auth.exception.AuthenticationException; import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.exception.WrongParametersException; +import at.gv.egovernment.moa.id.config.TargetToSectorNameMapper; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; import at.gv.egovernment.moa.id.moduls.IRequest; @@ -137,7 +138,25 @@ public class StartAuthentificationParameterParser extends MOAIDAuthConstants{ Logger.error("Selected target is invalid. Using target: " + target); throw new WrongParametersException("StartAuthentication", PARAM_TARGET, "auth.12"); } + if (MiscUtil.isNotEmpty(targetConfig)) + targetFriendlyName = targetFriendlyNameConfig; + else { + String sectorName = TargetToSectorNameMapper.getSectorNameViaTarget(target); + if (MiscUtil.isNotEmpty(sectorName)) + targetFriendlyName = sectorName; + + else { + //check target contains subSector + int delimiter = target.indexOf("-"); + if (delimiter > 0) { + targetFriendlyName = + TargetToSectorNameMapper.getSectorNameViaTarget(target.substring(0, delimiter)); + + } + } + } + } else { // use target from config target = targetConfig; diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/TargetValidator.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/TargetValidator.java index 2ad50568a..f2f7afcf8 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/TargetValidator.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/TargetValidator.java @@ -88,7 +88,7 @@ public class TargetValidator { } public static String getTargetFriendlyName(String target) { - String name = targetList.get(target); + String name = targetList.get(target.toUpperCase()); if (MiscUtil.isNotEmpty(name)) return name; @@ -97,7 +97,7 @@ public class TargetValidator { } public static boolean isValidTarget(String target) { - return targetList.containsKey(target); + return targetList.containsKey(target.toUpperCase()); } -- cgit v1.2.3