aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2015-07-22 09:59:33 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2015-07-22 09:59:33 +0200
commit7822346ccba084677534b4226080ef41de7b9865 (patch)
treecd615c26a65dedcae15b78edb30d8251f9ef0558
parent6296d40caa4fa071be939450373e9ce83b65b409 (diff)
downloadmoa-id-spss-7822346ccba084677534b4226080ef41de7b9865.tar.gz
moa-id-spss-7822346ccba084677534b4226080ef41de7b9865.tar.bz2
moa-id-spss-7822346ccba084677534b4226080ef41de7b9865.zip
fix problem with SAML1 in legacy mode and targetFriendlyName
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java19
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/TargetValidator.java4
2 files changed, 21 insertions, 2 deletions
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());
}