aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java
diff options
context:
space:
mode:
authorBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-06-12 14:12:55 +0200
committerBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-06-12 14:12:55 +0200
commit1a7c5fa9e31919215731e1c9e7c2e5f6feeca290 (patch)
tree82a69eb420a722856d3724886a82e56ac26976cf /id/server/idserverlib/src/main/java
parent67946391a3b22689ad667d55720f8f105381c735 (diff)
parent7cc4df3996d4725e4390dc5282a7200260d9dfe2 (diff)
downloadmoa-id-spss-1a7c5fa9e31919215731e1c9e7c2e5f6feeca290.tar.gz
moa-id-spss-1a7c5fa9e31919215731e1c9e7c2e5f6feeca290.tar.bz2
moa-id-spss-1a7c5fa9e31919215731e1c9e7c2e5f6feeca290.zip
Merge branch 'moa-2.1-Snapshot' of gitlab.iaik.tugraz.at:afitzek/moa-idspss into moa-2.1-Snapshot
Diffstat (limited to 'id/server/idserverlib/src/main/java')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java1
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java22
2 files changed, 17 insertions, 6 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java
index 4709f8c68..e7abf0f9a 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java
@@ -1877,6 +1877,7 @@ public class AuthenticationServer implements MOAIDAuthConstants {
Template template = velocityEngine.getTemplate("/resources/templates/saml2-post-binding-moa.vm");
VelocityContext context = new VelocityContext();
context.put("SAMLRequest", PEPSUtil.encodeSAMLToken(authnRequest.getTokenSaml()));
+ context.put("RelayState", moasession.getSessionID());
context.put("action", destination);
StringWriter writer = new StringWriter();
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java
index 024944c72..25749c8bc 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java
@@ -114,18 +114,28 @@ public class PEPSConnectorServlet extends AuthServlet {
//check if https or only http
super.checkIfHTTPisAllowed(request.getRequestURL().toString());
- Logger.debug("Trying to find MOA Session-ID");
+ Logger.debug("Trying to find MOA Session-ID ...");
String moaSessionID = request.getParameter(PARAM_SESSIONID);
// escape parameter strings
moaSessionID= StringEscapeUtils.escapeHtml(moaSessionID);
if (StringUtils.isEmpty(moaSessionID)) {
- //No authentication session has been started before
- Logger.error("MOA-SessionID was not found, no previous AuthnRequest had been started");
- Logger.debug("PEPSConnectorURL was: " + request.getRequestURL());
- throw new AuthenticationException("auth.02", new Object[] { moaSessionID });
- }
+ //check if SAML2 relaystate includes a MOA sessionID
+ moaSessionID = request.getParameter("RelayState");
+ moaSessionID= StringEscapeUtils.escapeHtml(moaSessionID);
+
+ if (StringUtils.isEmpty(moaSessionID)) {
+ //No authentication session has been started before
+ Logger.error("MOA-SessionID was not found, no previous AuthnRequest had been started");
+ Logger.debug("PEPSConnectorURL was: " + request.getRequestURL());
+ throw new AuthenticationException("auth.02", new Object[] { moaSessionID });
+
+ } else
+ Logger.trace("MOA SessionID " + moaSessionID + " is found in SAML2 relayState.");
+
+ } else
+ Logger.trace("MOA SessionID " + moaSessionID + " is found in http GET parameter.");
if (!ParamValidatorUtils.isValidSessionID(moaSessionID))
throw new WrongParametersException("VerifyAuthenticationBlock", PARAM_SESSIONID, "auth.12");