X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=samltest%2Fbinding.h;h=33551445b74205cc625fcdee853ab6d60daf0738;hb=197bcbae7339bc779bc5780882d11fdeb45f8223;hp=4e7117ef23ba39d2760dc1372a15f24c1c5935e1;hpb=ceba6432d156e82a9016190c06ae4640c651a257;p=shibboleth%2Fcpp-opensaml.git diff --git a/samltest/binding.h b/samltest/binding.h index 4e7117e..3355144 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. @@ -21,11 +21,14 @@ #include #include #include -#include +#include +#include #include -#include +#include +#include -using namespace saml2md; +using namespace opensaml::saml2md; +using namespace opensaml; using namespace xmlsignature; class SAMLBindingBaseTestCase : public HTTPRequest, public HTTPResponse @@ -33,12 +36,13 @@ class SAMLBindingBaseTestCase : public HTTPRequest, public HTTPResponse protected: CredentialResolver* m_creds; MetadataProvider* m_metadata; - opensaml::TrustEngine* m_trust; + TrustEngine* m_trust; map m_fields; map m_headers; string m_method,m_url,m_query; vector m_clientCerts; - vector m_rules; + vector m_rules1; + vector m_rules2; public: void setUp() { @@ -63,7 +67,7 @@ public: doc->getDocumentElement()->setAttributeNS(NULL,path.get(),file.get()); m_metadata = SAMLConfig::getConfig().MetadataProviderManager.newPlugin( - FILESYSTEM_METADATA_PROVIDER,doc->getDocumentElement() + XML_METADATA_PROVIDER,doc->getDocumentElement() ); m_metadata->init(); @@ -75,12 +79,17 @@ public: FILESYSTEM_CREDENTIAL_RESOLVER,doc2->getDocumentElement() ); - m_trust = SAMLConfig::getConfig().TrustEngineManager.newPlugin(EXPLICIT_KEY_SAMLTRUSTENGINE, NULL); + m_trust = XMLToolingConfig::getConfig().TrustEngineManager.newPlugin(EXPLICIT_KEY_TRUSTENGINE, NULL); - m_rules.push_back(SAMLConfig::getConfig().SecurityPolicyRuleManager.newPlugin(MESSAGEFLOW_POLICY_RULE,NULL)); - m_rules.push_back(SAMLConfig::getConfig().SecurityPolicyRuleManager.newPlugin(MESSAGEROUTING_POLICY_RULE,NULL)); - m_rules.push_back(SAMLConfig::getConfig().SecurityPolicyRuleManager.newPlugin(MESSAGESIGNING_POLICY_RULE,NULL)); - m_rules.push_back(SAMLConfig::getConfig().SecurityPolicyRuleManager.newPlugin(SIMPLESIGNING_POLICY_RULE,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)); } catch (XMLToolingException& ex) { TS_TRACE(ex.what()); @@ -91,7 +100,10 @@ public: } void tearDown() { - for_each(m_rules.begin(), m_rules.end(), xmltooling::cleanup()); + 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(); delete m_creds; delete m_metadata; delete m_trust; @@ -115,8 +127,12 @@ public: return "https"; } - bool isSecure() const { - return true; + const char* getHostname() const { + return "localhost"; + } + + int getPort() const { + return 443; } string getContentType() const { @@ -127,6 +143,10 @@ public: return -1; } + const char* getRequestURI() const { + return "/"; + } + const char* getRequestURL() const { return m_url.c_str(); } @@ -171,18 +191,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. @@ -201,7 +213,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; }