X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-opensaml.git;a=blobdiff_plain;f=saml%2Fbinding%2Fimpl%2FSimpleSigningRule.cpp;h=c27f7c22a82b09f60b2994a786bfe545bd5482e8;hp=c7fd46a24083caa4b4cc3a41031c84f5f716a893;hb=0e738d39ba71958fe55692498c91fc6e6d402604;hpb=0beb48ce00d0b6a3f177f7d9b48af1870ee92190 diff --git a/saml/binding/impl/SimpleSigningRule.cpp b/saml/binding/impl/SimpleSigningRule.cpp index c7fd46a..c27f7c2 100644 --- a/saml/binding/impl/SimpleSigningRule.cpp +++ b/saml/binding/impl/SimpleSigningRule.cpp @@ -23,7 +23,7 @@ #include "internal.h" #include "exceptions.h" #include "binding/HTTPRequest.h" -#include "binding/SimpleSigningRule.h" +#include "binding/SecurityPolicyRule.h" #include "saml2/core/Assertions.h" #include "saml2/metadata/Metadata.h" #include "saml2/metadata/MetadataProvider.h" @@ -41,30 +41,44 @@ using xmlsignature::KeyInfo; using xmlsignature::SignatureException; namespace opensaml { - SecurityPolicyRule* SAML_DLLLOCAL SimpleSigningRuleFactory(const DOMElement* const & e) + class SAML_DLLLOCAL SimpleSigningRule : public SecurityPolicyRule { - return new SimpleSigningRule(e); - } + public: + SimpleSigningRule(const DOMElement* e); + virtual ~SimpleSigningRule() {} + + void evaluate(const xmltooling::XMLObject& message, const GenericRequest* request, SecurityPolicy& policy) const; + + private: + // Appends a raw parameter=value pair to the string. + static bool appendParameter(string& s, const char* data, const char* name); + + bool m_errorsFatal; + }; - // Appends a raw parameter=value pair to the string. - static bool appendParameter(string& s, const char* data, const char* name) + SecurityPolicyRule* SAML_DLLLOCAL SimpleSigningRuleFactory(const DOMElement* const & e) { - const char* start = strstr(data,name); - if (!start) - return false; - if (!s.empty()) - s += '&'; - const char* end = strchr(start,'&'); - if (end) - s.append(start, end-start); - else - s.append(start); - return true; + return new SimpleSigningRule(e); } static const XMLCh errorsFatal[] = UNICODE_LITERAL_11(e,r,r,o,r,s,F,a,t,a,l); }; +bool SimpleSigningRule::appendParameter(string& s, const char* data, const char* name) +{ + const char* start = strstr(data,name); + if (!start) + return false; + if (!s.empty()) + s += '&'; + const char* end = strchr(start,'&'); + if (end) + s.append(start, end-start); + else + s.append(start); + return true; +} + SimpleSigningRule::SimpleSigningRule(const DOMElement* e) : m_errorsFatal(false) { if (e) {