From: Scott Cantor Date: Mon, 12 Feb 2007 05:32:18 +0000 (+0000) Subject: Fixes to SOAP clients X-Git-Tag: 2.0-alpha1~95 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-opensaml.git;a=commitdiff_plain;h=730ef8006d0bdf6a6d111e416b8828c02f58fc32 Fixes to SOAP clients --- diff --git a/saml/binding/SOAPClient.h b/saml/binding/SOAPClient.h index 1c40cdc..2c94bd3 100644 --- a/saml/binding/SOAPClient.h +++ b/saml/binding/SOAPClient.h @@ -31,17 +31,21 @@ namespace opensaml { /** * Specialized SOAPClient for SAML SOAP bindings. */ - class SAML_API SOAPClient : soap11::SOAPClient + class SAML_API SOAPClient : public soap11::SOAPClient { public: /** * Creates a SOAP client instance with a particular SecurityPolicy. * - * @param policy reference to SecurityPolicy to apply + * @param policy reference to SecurityPolicy to apply + * @param validating controls schema validation */ - SOAPClient(SecurityPolicy& policy) : m_policy(policy), m_force(true) {} + SOAPClient(SecurityPolicy& policy, bool validating=false) + : soap11::SOAPClient(validating), m_policy(policy), m_force(true), m_correlate(NULL) {} - virtual ~SOAPClient() {} + virtual ~SOAPClient() { + XMLString::release(&m_correlate); + } /** * Controls whether to force transport/peer authentication via an X509TrustEngine. @@ -70,6 +74,8 @@ namespace opensaml { * @return response envelope after SecurityPolicy has been applied */ soap11::Envelope* receive(); + + void reset(); protected: /** @@ -86,6 +92,9 @@ namespace opensaml { /** Flag controlling whether transport/peer authn is mandatory. */ bool m_force; + /** Message correlation ID. */ + XMLCh* m_correlate; + private: const saml2md::RoleDescriptor* m_peer; }; diff --git a/saml/binding/impl/SOAPClient.cpp b/saml/binding/impl/SOAPClient.cpp index 0653036..2a6261e 100644 --- a/saml/binding/impl/SOAPClient.cpp +++ b/saml/binding/impl/SOAPClient.cpp @@ -40,8 +40,7 @@ using namespace std; void SOAPClient::send(const soap11::Envelope* env, const KeyInfoSource& peer, const char* endpoint) { // Clear policy. - m_policy.setIssuer(NULL); - m_policy.setIssuerMetadata(NULL); + m_policy.reset(); m_peer = dynamic_cast(&peer); @@ -85,3 +84,11 @@ soap11::Envelope* SOAPClient::receive() } return env.release(); } + +void SOAPClient::reset() +{ + soap11::SOAPClient::reset(); + m_policy.reset(); + XMLString::release(&m_correlate); + m_correlate=NULL; +} diff --git a/saml/saml.vcproj b/saml/saml.vcproj index 5e8a06f..b1c0647 100644 --- a/saml/saml.vcproj +++ b/saml/saml.vcproj @@ -45,7 +45,6 @@ MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" - UsePrecompiledHeader="0" BrowseInformation="1" WarningLevel="3" Detect64BitPortabilityProblems="true" @@ -123,7 +122,6 @@ AdditionalIncludeDirectories=""$(SolutionDir)";"$(ProjectDir)";"..\..\cpp-xmltooling"" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="2" - UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="true" DebugInformationFormat="3" diff --git a/saml/saml1/binding/SAML1SOAPClient.h b/saml/saml1/binding/SAML1SOAPClient.h index 9476220..783c7c2 100644 --- a/saml/saml1/binding/SAML1SOAPClient.h +++ b/saml/saml1/binding/SAML1SOAPClient.h @@ -35,19 +35,18 @@ namespace opensaml { /** * Specialized SOAPClient for SAML 1.x SOAP binding. */ - class SAML_API SAML1SOAPClient : opensaml::SOAPClient + class SAML_API SAML1SOAPClient : public opensaml::SOAPClient { public: /** * Creates a SOAP client instance with a particular SecurityPolicy. * - * @param policy reference to SecurityPolicy to apply + * @param policy reference to SecurityPolicy to apply + * @param validating controls schema validation */ - SAML1SOAPClient(SecurityPolicy& policy) : opensaml::SOAPClient(policy), m_correlate(NULL) {} + SAML1SOAPClient(SecurityPolicy& policy, bool validating=false) : opensaml::SOAPClient(policy, validating) {} - virtual ~SAML1SOAPClient() { - XMLString::release(&m_correlate); - } + virtual ~SAML1SOAPClient() {} /** * Specialized method for sending SAML 1.x requests. The SOAP layer will be @@ -79,9 +78,6 @@ namespace opensaml { * @return true iff the error should be treated as a fatal error */ virtual bool handleError(const Status& status); - - private: - XMLCh* m_correlate; }; }; diff --git a/saml/saml2/binding/SAML2SOAPClient.h b/saml/saml2/binding/SAML2SOAPClient.h index ff5e5a1..23b65a8 100644 --- a/saml/saml2/binding/SAML2SOAPClient.h +++ b/saml/saml2/binding/SAML2SOAPClient.h @@ -41,13 +41,12 @@ namespace opensaml { /** * Creates a SOAP client instance with a particular SecurityPolicy. * - * @param policy reference to SecurityPolicy to apply + * @param policy reference to SecurityPolicy to apply + * @param validating controls schema validation */ - SAML2SOAPClient(SecurityPolicy& policy) : opensaml::SOAPClient(policy), m_correlate(NULL) {} + SAML2SOAPClient(SecurityPolicy& policy, bool validating=false) : opensaml::SOAPClient(policy, validating) {} - virtual ~SAML2SOAPClient() { - XMLString::release(&m_correlate); - } + virtual ~SAML2SOAPClient() {} /** * Specialized method for sending SAML 2.0 requests. The SOAP layer will be @@ -79,9 +78,6 @@ namespace opensaml { * @return true iff the error should be treated as a fatal error */ virtual bool handleError(const Status& status); - - private: - XMLCh* m_correlate; }; }; diff --git a/samltest/samltest.vcproj b/samltest/samltest.vcproj index f044fd7..4f580e7 100644 --- a/samltest/samltest.vcproj +++ b/samltest/samltest.vcproj @@ -45,7 +45,6 @@ MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" - UsePrecompiledHeader="0" BrowseInformation="1" WarningLevel="3" Detect64BitPortabilityProblems="true" @@ -121,7 +120,6 @@ AdditionalIncludeDirectories=""$(SolutionDir)";"$(ProjectDir)";"..\..\cpp-xmltooling"" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE=1" RuntimeLibrary="2" - UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="true" DebugInformationFormat="3"