Switch pointers to Unicode string objects.
[shibboleth/cpp-opensaml.git] / saml / binding / SecurityPolicy.h
index b655d01..35bc4cf 100644 (file)
@@ -131,12 +131,21 @@ namespace opensaml {
         }
 
         /**
-         * Returns the entityID of the receiving entity.
+         * Returns the SAML audiences that represent the receiving peer.
          *
-         * @return entityID of the peer processing the message
+         * @return audience values of the peer processing the message
          */
-        const XMLCh* getRecipient() {
-            return m_recipient;
+        const std::vector<xmltooling::xstring>& getAudiences() const {
+            return m_audiences;
+        }
+
+        /**
+         * Returns the SAML audiences that represent the receiving peer.
+         *
+         * @return audience values of the peer processing the message
+         */
+        std::vector<xmltooling::xstring>& getAudiences() {
+            return m_audiences;
         }
 
         /**
@@ -144,13 +153,23 @@ namespace opensaml {
          *
          * @return  the time at which the message is being processed
          */
-        time_t getTime() {
+        time_t getTime() const {
             if (m_ts == 0)
                 return m_ts = time(NULL);
             return m_ts;
         }
 
         /**
+         * Returns the message identifier to which the message being evaluated
+         * is a response.
+         *
+         * @return correlated message identifier
+         */
+        const XMLCh* getCorrelationID() const {
+            return m_correlationID.c_str();
+        }
+
+        /**
          * Gets a mutable array of installed policy rules.
          *
          * <p>If adding rules, their lifetime must be at least as long as the policy object.
@@ -221,15 +240,6 @@ namespace opensaml {
         }
 
         /**
-         * Sets entityID of receiving entity.
-         *
-         * @param recipient the entityID of the peer processing the message
-         */
-        void setRecipient(const XMLCh* recipient) {
-            m_recipient = recipient;
-        }
-
-        /**
          * Sets effective time of message processing.
          *
          * <p>Assumed to be the time of policy instantiation, can be adjusted to pre- or post-date
@@ -242,6 +252,18 @@ namespace opensaml {
         }
 
         /**
+         * Sets the message identifier to which the message being evaluated
+         * is a response.
+         *
+         * @param correlationID correlated message identifier
+         */
+        void setCorrelationID(const XMLCh* correlationID) {
+            m_correlationID.erase();
+            if (correlationID)
+                m_correlationID = correlationID;
+        }
+
+        /**
          * Evaluates the policy against the given request and message,
          * possibly populating message information in the policy object.
          *
@@ -250,9 +272,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.
@@ -280,7 +300,7 @@ namespace opensaml {
          * @return message identifier as determined by the registered policies
          */
         const XMLCh* getMessageID() const {
-            return m_messageID;
+            return m_messageID.c_str();
         }
 
         /**
@@ -325,8 +345,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;
         }
 
         /**
@@ -433,7 +454,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;
@@ -449,8 +470,9 @@ namespace opensaml {
         bool m_entityOnly;
 
         // contextual information
-        const XMLCh* m_recipient;
-        time_t m_ts;
+        mutable time_t m_ts;
+        xmltooling::xstring m_correlationID;
+        std::vector<xmltooling::xstring> m_audiences;
     };
 
 };