Complete support for pre-created sessions, TARGET as sessionID
authorgilbert <gilbert@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 17 Nov 2005 15:20:53 +0000 (15:20 +0000)
committergilbert <gilbert@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 17 Nov 2005 15:20:53 +0000 (15:20 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@1909 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

lib/shib-filter.jar
src/edu/internet2/middleware/shibboleth/serviceprovider/AssertionConsumerServlet.java
src/edu/internet2/middleware/shibboleth/serviceprovider/FilterSupportImpl.java
src/edu/internet2/middleware/shibboleth/serviceprovider/SessionManager.java

index 26d5ea4..a6128f0 100644 (file)
Binary files a/lib/shib-filter.jar and b/lib/shib-filter.jar differ
index d4a1503..351e692 100644 (file)
@@ -163,8 +163,11 @@ public class AssertionConsumerServlet extends HttpServlet {
                                        outputStream.print(attributeResponse.toString());
                                } else {
                     if (target.indexOf(':')>0) {
-                        // Ordinary URL target
-                        response.sendRedirect(target+"?"+SESSIONPARM+"="+sessionId);
+                        // Ordinary URL target. Should not occur any more
+                        if (target.indexOf('?')>0)
+                            response.sendRedirect(target+"&"+SESSIONPARM+"="+sessionId);
+                        else
+                            response.sendRedirect(target+"?"+SESSIONPARM+"="+sessionId);
                     } else {
                         // Assume Target is SessionID of 
                         Session session =context.getSessionManager().findSession(sessionId, applicationId);
@@ -173,7 +176,7 @@ public class AssertionConsumerServlet extends HttpServlet {
                             if (savedTarget!=null)
                                 target=savedTarget;
                         }
-                        response.sendRedirect(target+"?"+SESSIONPARM+"="+sessionId);
+                        response.sendRedirect(target);
                     }
                                }
             } catch (IOException e) {
@@ -254,6 +257,7 @@ public class AssertionConsumerServlet extends HttpServlet {
         BrowserProfileRequest bpr = new BrowserProfileRequest();
         bpr.SAMLArt = data.SAMLArt;
         bpr.SAMLResponse = data.SAMLResponse;
+        
         bpr.TARGET = data.target;
         
         // Process the encoded SAMLResponse or, if Artifact, fetch
index a58a978..284cc47 100644 (file)
@@ -24,8 +24,6 @@ package edu.internet2.middleware.shibboleth.serviceprovider;
 
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.Map;
-
 import org.apache.log4j.Logger;
 import org.opensaml.SAMLException;
 
@@ -147,15 +145,22 @@ public class FilterSupportImpl implements FilterSupport {
         * @param applicationId
         * @return Map of (attribute,value) pairs
         */
-    public Map /*<String,String>*/ 
-    getSessionAttributes(String sessionId, String applicationId) {
+    public SessionInfo 
+    getSessionInfo(String sessionId, String applicationId) {
+        SessionInfo sessionInfo = new SessionInfo();
         SessionManager sm = context.getSessionManager();
         Session session = 
             sm.findSession(sessionId, applicationId);
+        sessionInfo.savedTarget=session.getSavedTargetURL();
         if (session==null)
-            return null;
-        Map /*<String,String>*/ attributes = SessionManager.mapAttributes(session);
-        return attributes;
+            sessionInfo.sessionStatus = SessionInfo.SESSION_NOT_FOUND;
+        else if (!session.isInitialized())
+            sessionInfo.sessionStatus = SessionInfo.SESSION_NOT_INITIALIZED;
+        else if (!applicationId.equals(session.getApplicationId()))
+            sessionInfo.sessionStatus = SessionInfo.SESSION_BAD_APPLICATIONID;
+        else 
+            sessionInfo.attributes = SessionManager.mapAttributes(session);
+        return sessionInfo;
     }
 
 
index c2caff6..778cce3 100644 (file)
@@ -114,13 +114,8 @@ public class SessionManager {
                        log.warn("Session not found with ID "+sessionId);
                        return null;
                }
-               if (!s.isInitialized()) {
-                       log.warn("Uninitialized (reserved) Session has ID "+sessionId);
-                   return null;
-               }
                if (!applicationId.equals(s.getApplicationId())) {
                        log.error("Session ID "+sessionId+" doesn't match application "+applicationId);
-                       return null;
                }
                if (s.isExpired()) {
                        log.error("Session ID "+sessionId+" has expired.");