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.java59
1 files changed, 30 insertions, 29 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 67433dde7..71d2aae37 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
@@ -22,6 +22,8 @@
******************************************************************************/
package at.gv.egovernment.moa.id.auth.parser;
+import iaik.util.logging.Log;
+
import java.io.UnsupportedEncodingException;
import java.util.List;
@@ -36,6 +38,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.commons.db.dao.config.TemplateType;
import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider;
import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;
import at.gv.egovernment.moa.id.moduls.IRequest;
@@ -44,6 +47,7 @@ import at.gv.egovernment.moa.id.protocols.saml1.SAML1Protocol;
import at.gv.egovernment.moa.id.util.ParamValidatorUtils;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.BoolUtils;
+import at.gv.egovernment.moa.util.FileUtils;
import at.gv.egovernment.moa.util.MiscUtil;
import at.gv.egovernment.moa.util.StringUtils;
import at.gv.egovernment.moa.util.URLEncoder;
@@ -164,7 +168,9 @@ public class StartAuthentificationParameterParser implements MOAIDAuthConstants{
allowedbkus.addAll(AuthConfigurationProvider.getInstance().getDefaultBKUURLs());
if (!ParamValidatorUtils.isValidBKUURI(bkuURL, allowedbkus))
throw new WrongParametersException("StartAuthentication", PARAM_BKU, "auth.12");
-
+
+ moasession.setBkuURL(bkuURL);
+
if (!oaParam.getBusinessService()) {
if (isEmpty(target))
throw new WrongParametersException("StartAuthentication",
@@ -199,26 +205,13 @@ public class StartAuthentificationParameterParser implements MOAIDAuthConstants{
authURL = authURL.concat(":" + req.getServerPort());
}
authURL = authURL.concat(req.getContextPath() + "/");
-
- if (isEmpty(authURL))
- throw new WrongParametersException("StartAuthentication",
- "AuthURL", "auth.05");
-
- // check if HTTP Connection may be allowed (through
- // FRONTEND_SERVLETS_ENABLE_HTTP_CONNECTION_PROPERTY)
- //INFO: removed from MOA-ID 2.0 Config
-// String boolStr = AuthConfigurationProvider
-// .getInstance()
-// .getGenericConfigurationParameter(
-// AuthConfigurationProvider.FRONTEND_SERVLETS_ENABLE_HTTP_CONNECTION_PROPERTY);
-
- if ((!authURL.startsWith("https:"))
-// && (false == BoolUtils.valueOf(boolStr))
- )
+
+ if (!authURL.startsWith("https:"))
throw new AuthenticationException("auth.07",
new Object[] { authURL + "*" });
- moasession.setAuthURL(authURL);
+ //set Auth URL from configuration
+ moasession.setAuthURL(AuthConfigurationProvider.getInstance().getPublicURLPrefix() + "/");
//check and set SourceID
if (oaParam.getSAML1Parameter() != null) {
@@ -227,16 +220,24 @@ public class StartAuthentificationParameterParser implements MOAIDAuthConstants{
moasession.setSourceID(sourceID);
}
- // BKU URL has not been set yet, even if session already exists
- if (bkuURL == null) {
- if (req.getScheme() != null && req.getScheme().equalsIgnoreCase("https")) {
- bkuURL = DEFAULT_BKU_HTTPS;
- } else {
- bkuURL = DEFAULT_BKU;
- }
- }
- moasession.setBkuURL(bkuURL);
-
+ if (MiscUtil.isEmpty(templateURL)) {
+
+ List<TemplateType> templateURLList = oaParam.getTemplateURL();
+
+ if ( templateURLList != null && templateURLList.size() > 0
+ && MiscUtil.isNotEmpty(templateURLList.get(0).getURL()) ) {
+ templateURL = FileUtils.makeAbsoluteURL(
+ oaParam.getTemplateURL().get(0).getURL(),
+ AuthConfigurationProvider.getInstance().getRootConfigFileDir());
+ Log.info("No SL-Template in request, load SL-Template from OA config (URL: " + templateURL + ")");
+
+ } else {
+ Logger.error("NO SL-Tempalte found in OA config");
+ throw new WrongParametersException("StartAuthentication", PARAM_TEMPLATE, "auth.12");
+
+ }
+
+ }
if (!ParamValidatorUtils.isValidTemplate(req, templateURL, oaParam.getTemplateURL()))
throw new WrongParametersException("StartAuthentication", PARAM_TEMPLATE, "auth.12");
@@ -275,7 +276,7 @@ public class StartAuthentificationParameterParser implements MOAIDAuthConstants{
oaURL = request.getOAURL();
target = request.getTarget();
-
+
parse(moasession, target, oaURL, bkuURL, templateURL, useMandate, ccc, modul, action, req);
}