aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2015-09-02 17:06:24 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2015-09-02 17:06:24 +0200
commitaa1dda4e14e7aebd3ec0df5e50493d273a65d999 (patch)
treea92576ddbc803dc640e2bf3e94cef508159b1663
parentbf97a44c97eac39401200cc2e57f6aba08e2008b (diff)
downloadmoa-id-spss-aa1dda4e14e7aebd3ec0df5e50493d273a65d999.tar.gz
moa-id-spss-aa1dda4e14e7aebd3ec0df5e50493d273a65d999.tar.bz2
moa-id-spss-aa1dda4e14e7aebd3ec0df5e50493d273a65d999.zip
fix problem with private service applications and target friendlyname
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java79
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/TargetValidator.java5
2 files changed, 47 insertions, 37 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 ded261bfc..32ee2a126 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
@@ -125,42 +125,51 @@ public class StartAuthentificationParameterParser extends MOAIDAuthConstants{
// get target and target friendly name from config
String targetConfig = oaParam.getTarget();
String targetFriendlyNameConfig = oaParam.getTargetFriendlyName();
-
- if (StringUtils.isEmpty(targetConfig)
- || (module.equals(SAML1Protocol.PATH) &&
- !StringUtils.isEmpty(target))
- ) {
- //INFO: ONLY SAML1 legacy mode
- // if SAML1 is used and target attribute is given in request
- // use requested target
- // check target parameter
- if (!ParamValidatorUtils.isValidTarget(target)) {
- 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;
+
+ if (!oaParam.getBusinessService()) {
+ if (StringUtils.isEmpty(targetConfig)
+ || (module.equals(SAML1Protocol.PATH) &&
+ !StringUtils.isEmpty(target))
+ ) {
+ //INFO: ONLY SAML1 legacy mode
+ // if SAML1 is used and target attribute is given in request
+ // use requested target
+ // check target parameter
+ if (!ParamValidatorUtils.isValidTarget(target)) {
+ Logger.error("Selected target is invalid. Using target: " + target);
+ throw new WrongParametersException("StartAuthentication", PARAM_TARGET, "auth.12");
+ }
+ if (MiscUtil.isNotEmpty(targetConfig))
+ targetFriendlyName = targetFriendlyNameConfig;
else {
- //check target contains subSector
- int delimiter = target.indexOf("-");
- if (delimiter > 0) {
- targetFriendlyName =
- TargetToSectorNameMapper.getSectorNameViaTarget(target.substring(0, delimiter));
-
- }
- }
+ 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;
+ targetFriendlyName = targetFriendlyNameConfig;
}
-
+ moasession.setTarget(target);
+ moasession.setTargetFriendlyName(targetFriendlyName);
+
} else {
- // use target from config
- target = targetConfig;
- targetFriendlyName = targetFriendlyNameConfig;
+ Logger.debug("Business: " + moasession.getBusinessService() + " stork: " + moasession.getStorkService());
+ moasession.setDomainIdentifier(oaParam.getIdentityLinkDomainIdentifier());
+
}
@@ -204,13 +213,9 @@ public class StartAuthentificationParameterParser extends MOAIDAuthConstants{
}
moasession.setPublicOAURLPrefix(oaParam.getPublicURLPrefix());
-
- moasession.setTarget(target);
moasession.setBusinessService(oaParam.getBusinessService());
+
//moasession.setStorkService(oaParam.getStorkService());
- Logger.debug("Business: " + moasession.getBusinessService() + " stork: " + moasession.getStorkService());
- moasession.setTargetFriendlyName(targetFriendlyName);
- moasession.setDomainIdentifier(oaParam.getIdentityLinkDomainIdentifier());
}
//check OnlineApplicationURL
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 f2f7afcf8..aeccfe608 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,6 +88,9 @@ public class TargetValidator {
}
public static String getTargetFriendlyName(String target) {
+ if (MiscUtil.isEmpty(target))
+ return null;
+
String name = targetList.get(target.toUpperCase());
if (MiscUtil.isNotEmpty(name))
@@ -97,6 +100,8 @@ public class TargetValidator {
}
public static boolean isValidTarget(String target) {
+ if (MiscUtil.isEmpty(target))
+ return false;
return targetList.containsKey(target.toUpperCase());
}