Reducing header overuse, non-inlining selected methods (CPPOST-35).
[shibboleth/cpp-opensaml.git] / saml / binding / SecurityPolicy.h
index 6a5aac7..cb05450 100644 (file)
 
 #include <ctime>
 #include <vector>
-#include <xmltooling/io/GenericRequest.h>
-#include <xmltooling/security/TrustEngine.h>
 
 #if defined (_MSC_VER)
     #pragma warning( push )
     #pragma warning( disable : 4250 4251 )
 #endif
 
+namespace xmltooling {
+    class XMLTOOL_API GenericRequest;
+    class XMLTOOL_API TrustEngine;
+};
+
 namespace opensaml {
 
     namespace saml2 {
@@ -135,7 +138,7 @@ namespace opensaml {
          *
          * @return audience values of the peer processing the message
          */
-        const std::vector<const XMLCh*>& getAudiences() const {
+        const std::vector<xmltooling::xstring>& getAudiences() const {
             return m_audiences;
         }
 
@@ -144,7 +147,7 @@ namespace opensaml {
          *
          * @return audience values of the peer processing the message
          */
-        std::vector<const XMLCh*>& getAudiences() {
+        std::vector<xmltooling::xstring>& getAudiences() {
             return m_audiences;
         }
 
@@ -166,7 +169,7 @@ namespace opensaml {
          * @return correlated message identifier
          */
         const XMLCh* getCorrelationID() const {
-            return m_correlationID;
+            return m_correlationID.c_str();
         }
 
         /**
@@ -258,7 +261,9 @@ namespace opensaml {
          * @param correlationID correlated message identifier
          */
         void setCorrelationID(const XMLCh* correlationID) {
-            m_correlationID = correlationID;
+            m_correlationID.erase();
+            if (correlationID)
+                m_correlationID = correlationID;
         }
 
         /**
@@ -270,9 +275,7 @@ namespace opensaml {
          *
          * @throws BindingException raised if the message/request is invalid according to the supplied rules
          */
-        void evaluate(
-            const xmltooling::XMLObject& message, const xmltooling::GenericRequest* request=NULL
-            );
+        void evaluate(const xmltooling::XMLObject& message, const xmltooling::GenericRequest* request=NULL);
 
         /**
          * Resets the policy object and/or clears any per-message state.
@@ -300,7 +303,7 @@ namespace opensaml {
          * @return message identifier as determined by the registered policies
          */
         const XMLCh* getMessageID() const {
-            return m_messageID;
+            return m_messageID.c_str();
         }
 
         /**
@@ -345,8 +348,9 @@ namespace opensaml {
          * @param id message identifier
          */
         void setMessageID(const XMLCh* id) {
-            xercesc::XMLString::release(&m_messageID);
-            m_messageID = xercesc::XMLString::replicate(id);
+            m_messageID.erase();
+            if (id)
+                m_messageID = id;
         }
 
         /**
@@ -453,7 +457,7 @@ namespace opensaml {
 
     private:
         // information extracted from message
-        XMLCh* m_messageID;
+        xmltooling::xstring m_messageID;
         time_t m_issueInstant;
         saml2::Issuer* m_issuer;
         const saml2md::RoleDescriptor* m_issuerRole;
@@ -470,8 +474,8 @@ namespace opensaml {
 
         // contextual information
         mutable time_t m_ts;
-        const XMLCh* m_correlationID;
-        std::vector<const XMLCh*> m_audiences;
+        xmltooling::xstring m_correlationID;
+        std::vector<xmltooling::xstring> m_audiences;
     };
 
 };