Expose a "user agent present" property.
[shibboleth/cpp-opensaml.git] / saml / saml2 / binding / impl / SAML2SOAPDecoder.cpp
index 2ac83b9..3757039 100644 (file)
@@ -22,7 +22,8 @@
 
 #include "internal.h"
 #include "exceptions.h"
-#include "saml2/binding/SAML2SOAPDecoder.h"
+#include "binding/MessageDecoder.h"
+#include "saml2/core/Protocols.h"
 
 #include <log4cpp/Category.hh>
 #include <xmltooling/soap/SOAP.h>
@@ -38,6 +39,23 @@ using namespace std;
 
 namespace opensaml {
     namespace saml2p {              
+        class SAML_DLLLOCAL SAML2SOAPDecoder : public MessageDecoder
+        {
+        public:
+            SAML2SOAPDecoder(const DOMElement* e);
+            virtual ~SAML2SOAPDecoder() {}
+
+            bool isUserAgentPresent() const {
+                return false;
+            }
+
+            xmltooling::XMLObject* decode(
+                std::string& relayState,
+                const GenericRequest& genericRequest,
+                SecurityPolicy& policy
+                ) const;
+        };                
+
         MessageDecoder* SAML_DLLLOCAL SAML2SOAPDecoderFactory(const DOMElement* const & e)
         {
             return new SAML2SOAPDecoder(e);
@@ -73,7 +91,7 @@ XMLObject* SAML2SOAPDecoder::decode(
     istringstream is(data);
     
     // Parse and bind the document into an XMLObject.
-    DOMDocument* doc = (m_validate ? XMLToolingConfig::getConfig().getValidatingParser()
+    DOMDocument* doc = (policy.getValidating() ? XMLToolingConfig::getConfig().getValidatingParser()
         : XMLToolingConfig::getConfig().getParser()).parse(is); 
     XercesJanitor<DOMDocument> janitor(doc);
     auto_ptr<XMLObject> xmlObject(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(), true));
@@ -83,7 +101,7 @@ XMLObject* SAML2SOAPDecoder::decode(
     if (!env)
         throw BindingException("Decoded message was not a SOAP 1.1 Envelope.");
 
-    if (!m_validate)
+    if (!policy.getValidating())
         SchemaValidators.validate(env);
     
     Body* body = env->getBody();