Form generator for discovery along with sample form.
[shibboleth/sp.git] / shibsp / AbstractSPRequest.cpp
index cb2d3eb..e7de1cd 100644 (file)
@@ -81,17 +81,10 @@ Session* AbstractSPRequest::getSession(bool checkTimeout, bool ignoreAddress, bo
     else if (cache)
         m_sessionTried = true;
 
-    // Get session ID from cookie.
-    const Application& app = getApplication();
-    pair<string,const char*> shib_cookie = app.getCookieNameProps("_shibsession_");
-    const char* session_id = getCookie(shib_cookie.first.c_str());
-    if (!session_id || !*session_id)
-        return NULL;
-
     // Need address checking and timeout settings.
     time_t timeout=0;
     if (checkTimeout || !ignoreAddress) {
-        const PropertySet* props=app.getPropertySet("Sessions");
+        const PropertySet* props=getApplication().getPropertySet("Sessions");
         if (props) {
             if (checkTimeout) {
                 pair<bool,unsigned int> p=props->getUnsignedInt("timeout");
@@ -106,7 +99,7 @@ Session* AbstractSPRequest::getSession(bool checkTimeout, bool ignoreAddress, bo
 
     // The cache will either silently pass a session or NULL back, or throw an exception out.
     Session* session = getServiceProvider().getSessionCache()->find(
-        session_id, app, ignoreAddress ? NULL : getRemoteAddr().c_str(), checkTimeout ? &timeout : NULL
+        getApplication(), *this, ignoreAddress ? NULL : getRemoteAddr().c_str(), checkTimeout ? &timeout : NULL
         );
     if (cache)
         m_session = session;
@@ -199,37 +192,6 @@ vector<const char*>::size_type AbstractSPRequest::getParameters(const char* name
     return values.size();
 }
 
-const char* AbstractSPRequest::getCookie(const char* name) const
-{
-    if (m_cookieMap.empty()) {
-        string cookies=getHeader("Cookie");
-
-        string::size_type pos=0,cname,namelen,val,vallen;
-        while (pos !=string::npos && pos < cookies.length()) {
-            while (isspace(cookies[pos])) pos++;
-            cname=pos;
-            pos=cookies.find_first_of("=",pos);
-            if (pos == string::npos)
-                break;
-            namelen=pos-cname;
-            pos++;
-            if (pos==cookies.length())
-                break;
-            val=pos;
-            pos=cookies.find_first_of(";",pos);
-            if (pos != string::npos) {
-                vallen=pos-val;
-                pos++;
-                m_cookieMap.insert(make_pair(cookies.substr(cname,namelen),cookies.substr(val,vallen)));
-            }
-            else
-                m_cookieMap.insert(make_pair(cookies.substr(cname,namelen),cookies.substr(val)));
-        }
-    }
-    map<string,string>::const_iterator lookup=m_cookieMap.find(name);
-    return (lookup==m_cookieMap.end()) ? NULL : lookup->second.c_str();
-}
-
 const char* AbstractSPRequest::getHandlerURL(const char* resource) const
 {
     if (!resource)