From 1bbc93e69f0cb632da91cccf164ecfbe82fc0d99 Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Mon, 23 Jul 2007 15:58:11 +0000 Subject: [PATCH] Allow absolute URL in exportLocation. --- shibsp/ServiceProvider.cpp | 8 ++++++-- shibsp/impl/XMLServiceProvider.cpp | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/shibsp/ServiceProvider.cpp b/shibsp/ServiceProvider.cpp index 48b947a..4b74096 100644 --- a/shibsp/ServiceProvider.cpp +++ b/shibsp/ServiceProvider.cpp @@ -359,8 +359,12 @@ pair 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& tokens = session->getAssertionIDs(); vector::size_type count = 0; for (vector::const_iterator tokenids = tokens.begin(); tokenids!=tokens.end(); ++tokenids) { diff --git a/shibsp/impl/XMLServiceProvider.cpp b/shibsp/impl/XMLServiceProvider.cpp index 958df0e..9e965b3 100644 --- a/shibsp/impl/XMLServiceProvider.cpp +++ b/shibsp/impl/XMLServiceProvider.cpp @@ -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 -- 2.1.4