Allow absolute URL in exportLocation.
authorScott Cantor <cantor.2@osu.edu>
Mon, 23 Jul 2007 15:58:11 +0000 (15:58 +0000)
committerScott Cantor <cantor.2@osu.edu>
Mon, 23 Jul 2007 15:58:11 +0000 (15:58 +0000)
shibsp/ServiceProvider.cpp
shibsp/impl/XMLServiceProvider.cpp

index 48b947a..4b74096 100644 (file)
@@ -359,8 +359,12 @@ pair<bool,long> ServiceProvider::doExport(SPRequest& request, bool requireSessio
             else {
                 const URLEncoder* encoder = XMLToolingConfig::getConfig().getURLEncoder();
                 string exportName = "Shib-Assertion-00";
-                const char* handlerURL=request.getHandlerURL(targetURL.c_str());
-                string baseURL = string(handlerURL) + exportLocation.second + "?key=" + session->getID() + "&ID=";
+                string baseURL;
+                if (!strncmp(exportLocation.second, "http", 4))
+                    baseURL = exportLocation.second;
+                else
+                    baseURL = string(request.getHandlerURL(targetURL.c_str())) + exportLocation.second;
+                baseURL = baseURL + "?key=" + session->getID() + "&ID=";
                 const vector<const char*>& tokens = session->getAssertionIDs();
                 vector<const char*>::size_type count = 0;
                 for (vector<const char*>::const_iterator tokenids = tokens.begin(); tokenids!=tokens.end(); ++tokenids) {
index 958df0e..9e965b3 100644 (file)
@@ -526,7 +526,10 @@ XMLApplication::XMLApplication(
                 handler = conf.HandlerManager.newPlugin(samlconstants::SAML20_BINDING_URI, make_pair(sessions->getElement(), getId()));
                 m_handlers.push_back(handler);
 
-                // Insert into location map.
+                // Insert into location map. If it contains the handlerURL, we skip past that part.
+                const char* pch = strstr(location.second, sessions->getString("handlerURL").second);
+                if (pch)
+                    location.second = pch + strlen(sessions->getString("handlerURL").second);
                 if (*location.second == '/')
                     m_handlerMap[location.second]=handler;
                 else