X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=samltest%2Fbinding.h;h=3564bb1d752d9a3d20a3b7d8d2eca9cd60193074;hb=3a32a5a263b304bce0014f0dbfa7ab476065cd19;hp=fdbe99060ba8bc9b78e75628aa45b62e771871a8;hpb=0a8bf8e0bdad5f92ec90f3f5d9bd73c82fb41fe8;p=shibboleth%2Fcpp-opensaml.git diff --git a/samltest/binding.h b/samltest/binding.h index fdbe990..3564bb1 100644 --- a/samltest/binding.h +++ b/samltest/binding.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006 Internet2 + * Copyright 2001-2007 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,17 +17,18 @@ #include "internal.h" #include -#include -#include #include #include #include -#include #include #include +#include +#include #include +#include using namespace opensaml::saml2md; +using namespace opensaml; using namespace xmlsignature; class SAMLBindingBaseTestCase : public HTTPRequest, public HTTPResponse @@ -40,8 +41,7 @@ protected: map m_headers; string m_method,m_url,m_query; vector m_clientCerts; - vector m_rules1; - vector m_rules2; + vector m_rules; public: void setUp() { @@ -80,15 +80,9 @@ public: m_trust = XMLToolingConfig::getConfig().TrustEngineManager.newPlugin(EXPLICIT_KEY_TRUSTENGINE, NULL); - m_rules1.push_back(SAMLConfig::getConfig().SecurityPolicyRuleManager.newPlugin(SAML1MESSAGE_POLICY_RULE,NULL)); - m_rules1.push_back(SAMLConfig::getConfig().SecurityPolicyRuleManager.newPlugin(MESSAGEFLOW_POLICY_RULE,NULL)); - m_rules1.push_back(SAMLConfig::getConfig().SecurityPolicyRuleManager.newPlugin(SIMPLESIGNING_POLICY_RULE,NULL)); - m_rules1.push_back(SAMLConfig::getConfig().SecurityPolicyRuleManager.newPlugin(XMLSIGNING_POLICY_RULE,NULL)); - - m_rules2.push_back(SAMLConfig::getConfig().SecurityPolicyRuleManager.newPlugin(SAML2MESSAGE_POLICY_RULE,NULL)); - m_rules2.push_back(SAMLConfig::getConfig().SecurityPolicyRuleManager.newPlugin(MESSAGEFLOW_POLICY_RULE,NULL)); - m_rules2.push_back(SAMLConfig::getConfig().SecurityPolicyRuleManager.newPlugin(SIMPLESIGNING_POLICY_RULE,NULL)); - m_rules2.push_back(SAMLConfig::getConfig().SecurityPolicyRuleManager.newPlugin(XMLSIGNING_POLICY_RULE,NULL)); + m_rules.push_back(SAMLConfig::getConfig().SecurityPolicyRuleManager.newPlugin(MESSAGEFLOW_POLICY_RULE,NULL)); + m_rules.push_back(SAMLConfig::getConfig().SecurityPolicyRuleManager.newPlugin(SIMPLESIGNING_POLICY_RULE,NULL)); + m_rules.push_back(SAMLConfig::getConfig().SecurityPolicyRuleManager.newPlugin(XMLSIGNING_POLICY_RULE,NULL)); } catch (XMLToolingException& ex) { TS_TRACE(ex.what()); @@ -99,10 +93,8 @@ public: } void tearDown() { - for_each(m_rules1.begin(), m_rules1.end(), xmltooling::cleanup()); - m_rules1.clear(); - for_each(m_rules2.begin(), m_rules2.end(), xmltooling::cleanup()); - m_rules2.clear(); + for_each(m_rules.begin(), m_rules.end(), xmltooling::cleanup()); + m_rules.clear(); delete m_creds; delete m_metadata; delete m_trust; @@ -126,10 +118,6 @@ public: return "https"; } - bool isSecure() const { - return true; - } - const char* getHostname() const { return "localhost"; } @@ -194,18 +182,10 @@ public: // HTTPResponse methods - void setHeader(const char* name, const char* value) { + void setResponseHeader(const char* name, const char* value) { m_headers[name] = value ? value : ""; } - void setContentType(const char* type) { - setHeader("Content-Type", type); - } - - void setCookie(const char* name, const char* value) { - m_headers["Set-Cookie"] = string(name) + "=" + (value ? value : ""); - } - // The amount of error checking missing from this is incredible, but as long // as the test data isn't unexpected or malformed, it should work. @@ -224,7 +204,7 @@ public: pch=strchr(pch,'&'); if (pch) *pch++=0; - SAMLConfig::getConfig().getURLEncoder()->decode(value); + XMLToolingConfig::getConfig().getURLEncoder()->decode(value); m_fields[name] = value; name = pch; } @@ -260,13 +240,7 @@ public: return decoded; } - long sendResponse(std::istream& inputStream) { - return sendResponse(inputStream, HTTPResponse::SAML_HTTP_STATUS_OK); - } - - long sendError(std::istream& inputStream) { - return sendResponse(inputStream, HTTPResponse::SAML_HTTP_STATUS_ERROR); - } + using HTTPResponse::sendResponse; long sendResponse(std::istream& inputStream, long status) { m_method="POST";