[cpp-sp COMMIT] in /branches/REL_2: schemas/shibboleth-2.0-native-sp-config.xsd shibsp/handler/AssertionConsumerServi...
noreply at shibboleth.net
noreply at shibboleth.net
Wed Feb 8 16:49:18 GMT 2012
Author: scantor
Date: Wed Feb 8 16:49:18 2012
New Revision: 3573
URL: http://svn.shibboleth.net/view/cpp-sp?rev=3573&view=rev
Log:
Hook mechanism to post-process new sessions.
Modified:
branches/REL_2/schemas/shibboleth-2.0-native-sp-config.xsd
branches/REL_2/shibsp/handler/AssertionConsumerService.h
branches/REL_2/shibsp/handler/impl/AssertionConsumerService.cpp
Modified: branches/REL_2/schemas/shibboleth-2.0-native-sp-config.xsd
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/schemas/shibboleth-2.0-native-sp-config.xsd?rev=3573&r1=3572&r2=3573&view=diff
==============================================================================
--- branches/REL_2/schemas/shibboleth-2.0-native-sp-config.xsd (original)
+++ branches/REL_2/schemas/shibboleth-2.0-native-sp-config.xsd Wed Feb 8 16:49:18 2012
@@ -459,6 +459,7 @@
<attribute name="requireConfidentiality" type="boolean"/>
<attribute name="requireTransportAuth" type="boolean"/>
<attribute name="requireSignedAssertions" type="boolean"/>
+ <attribute name="sessionHook" type="anyURI"/>
</attributeGroup>
<complexType name="SessionsType">
Modified: branches/REL_2/shibsp/handler/AssertionConsumerService.h
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/handler/AssertionConsumerService.h?rev=3573&r1=3572&r2=3573&view=diff
==============================================================================
--- branches/REL_2/shibsp/handler/AssertionConsumerService.h (original)
+++ branches/REL_2/shibsp/handler/AssertionConsumerService.h Wed Feb 8 16:49:18 2012
@@ -98,7 +98,23 @@
* @param issuedTo address for which security assertion was issued
*/
void checkAddress(const Application& application, const xmltooling::HTTPRequest& httpRequest, const char* issuedTo) const;
-
+
+
+ /**
+ * Complete the client's transition back to the expected resource.
+ *
+ * @param application reference to application receiving message
+ * @param httpRequest client request that included message
+ * @param httpResponse response to client
+ * @param relayState relay state token
+ */
+ virtual std::pair<bool,long> finalizeResponse(
+ const Application& application,
+ const xmltooling::HTTPRequest& httpRequest,
+ xmltooling::HTTPResponse& httpResponse,
+ std::string& relayState
+ ) const;
+
#ifndef SHIBSP_LITE
void generateMetadata(opensaml::saml2md::SPSSODescriptor& role, const char* handlerURL) const;
Modified: branches/REL_2/shibsp/handler/impl/AssertionConsumerService.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/handler/impl/AssertionConsumerService.cpp?rev=3573&r1=3572&r2=3573&view=diff
==============================================================================
--- branches/REL_2/shibsp/handler/impl/AssertionConsumerService.cpp (original)
+++ branches/REL_2/shibsp/handler/impl/AssertionConsumerService.cpp Wed Feb 8 16:49:18 2012
@@ -30,6 +30,7 @@
#include "ServiceProvider.h"
#include "SPRequest.h"
#include "handler/AssertionConsumerService.h"
+#include "util/CGIParser.h"
#include "util/SPConstants.h"
# include <ctime>
@@ -61,6 +62,9 @@
# include "lite/CommonDomainCookie.h"
#endif
+#include <xmltooling/XMLToolingConfig.h>
+#include <xmltooling/util/URLEncoder.h>
+
using namespace shibspconstants;
using namespace shibsp;
using namespace opensaml;
@@ -95,10 +99,21 @@
pair<bool,long> AssertionConsumerService::run(SPRequest& request, bool isHandler) const
{
- string relayState;
- SPConfig& conf = SPConfig::getConfig();
-
- if (conf.isEnabled(SPConfig::OutOfProcess)) {
+ // Check for a message back to the ACS from a post-session hook.
+ if (request.getQueryString() && strstr(request.getQueryString(), "hook=1")) {
+ // Parse the query string only to preserve any POST data.
+ CGIParser cgi(request, true);
+ pair<CGIParser::walker,CGIParser::walker> param = cgi.getParameters("hook");
+ if (param.first != param.second && param.first->second && !strcmp(param.first->second, "1")) {
+ string target;
+ param = cgi.getParameters("target");
+ if (param.first != param.second && param.first->second)
+ target = param.first->second;
+ return finalizeResponse(request.getApplication(), request, request, target);
+ }
+ }
+
+ if (SPConfig::getConfig().isEnabled(SPConfig::OutOfProcess)) {
// When out of process, we run natively and directly process the message.
return processMessage(request.getApplication(), request, request);
}
@@ -109,7 +124,7 @@
headers.push_back("Accept-Language");
DDF out,in = wrap(request, &headers);
DDFJanitor jin(in), jout(out);
- out=request.getServiceProvider().getListenerService()->send(in);
+ out = request.getServiceProvider().getListenerService()->send(in);
return unwrap(request, out);
}
}
[... 145 lines stripped ...]
More information about the commits
mailing list