aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java113
1 files changed, 59 insertions, 54 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 8a536ca77..e659c9447 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
@@ -38,7 +38,7 @@ 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;
-import at.gv.egovernment.moa.id.protocols.saml1.SAML1Protocol;
+import at.gv.egovernment.moa.id.process.api.ExecutionContext;
import at.gv.egovernment.moa.id.util.ParamValidatorUtils;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.FileUtils;
@@ -126,42 +126,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("id_saml1") &&
+ !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());
+
}
@@ -205,13 +214,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
@@ -271,7 +276,7 @@ public class StartAuthentificationParameterParser extends MOAIDAuthConstants{
}
- public static void parse(HttpServletRequest req, HttpServletResponse resp,
+ public static void parse(ExecutionContext ec, HttpServletRequest req,
AuthenticationSession moasession, IRequest request) throws WrongParametersException, MOAIDException {
@@ -280,23 +285,23 @@ public class StartAuthentificationParameterParser extends MOAIDAuthConstants{
modul = StringEscapeUtils.escapeHtml(modul);
action = StringEscapeUtils.escapeHtml(action);
- if(modul == null) {
- modul = SAML1Protocol.PATH;
- }
-
- if(action == null) {
- action = SAML1Protocol.GETARTIFACT;
- }
+// if(modul == null) {
+// modul = SAML1Protocol.PATH;
+// }
+//
+// if(action == null) {
+// action = SAML1Protocol.GETARTIFACT;
+// }
moasession.setModul(modul);
moasession.setAction(action);
//get Parameters from request
- String target = req.getParameter(PARAM_TARGET);
- String oaURL = req.getParameter(PARAM_OA);
- String bkuURL = req.getParameter(PARAM_BKU);
- String templateURL = req.getParameter(PARAM_TEMPLATE);
- String useMandate = req.getParameter(PARAM_USEMANDATE);
- String ccc = req.getParameter(PARAM_CCC);
+ String target = (String) ec.get(PARAM_TARGET);
+ String oaURL = (String) ec.get(PARAM_OA);
+ String bkuURL = (String) ec.get(PARAM_BKU);
+ String templateURL = (String) ec.get(PARAM_TEMPLATE);
+ String useMandate = (String) ec.get(PARAM_USEMANDATE);
+ String ccc = (String) ec.get(PARAM_CCC);
if (request.getOnlineApplicationConfiguration() != null &&
request.getOnlineApplicationConfiguration().isOnlyMandateAllowed()) {
@@ -305,8 +310,7 @@ public class StartAuthentificationParameterParser extends MOAIDAuthConstants{
useMandate = String.valueOf(request.getOnlineApplicationConfiguration().isOnlyMandateAllowed());
}
-
-
+
oaURL = request.getOAURL();
target = request.getTarget();
@@ -324,4 +328,5 @@ public class StartAuthentificationParameterParser extends MOAIDAuthConstants{
private static boolean isEmpty(String param) {
return param == null || param.length() == 0;
}
+
}