Merged issuer/protocol extraction back into rules.
[shibboleth/cpp-opensaml.git] / saml / binding / SecurityPolicy.h
index 81f990e..2074e79 100644 (file)
@@ -67,7 +67,8 @@ namespace opensaml {
         }
 
         /**
-         * Constructor for policy using existing rules.
+         * Constructor for policy using existing rules. The lifetime of the policy rules
+         * must be at least as long as the policy object.
          *
          * @param rules             reference to array of policy rules to use 
          * @param metadataProvider  locked MetadataProvider instance
@@ -113,6 +114,16 @@ namespace opensaml {
         }
 
         /**
+         * Adds a SecurityPolicyRule to the policy. The lifetime of the policy rule
+         * must be at least as long as the policy object.
+         * 
+         * @param rule  SecurityPolicyRule to add
+         */
+        void addRule(const SecurityPolicyRule* rule) {
+            m_rules.push_back(rule);
+        }
+
+        /**
          * Sets a locked MetadataProvider for the policy.
          * 
          * @param metadata a locked MetadataProvider or NULL
@@ -210,8 +221,8 @@ namespace opensaml {
          * 
          * @return the effective IssuerMatchingPolicy
          */
-        const IssuerMatchingPolicy* getIssuerMatchingPolicy() const {
-            return m_matchingPolicy ? m_matchingPolicy : &m_defaultMatching;
+        const IssuerMatchingPolicy& getIssuerMatchingPolicy() const {
+            return m_matchingPolicy ? *m_matchingPolicy : m_defaultMatching;
         }
 
         /**
@@ -222,7 +233,7 @@ namespace opensaml {
          * 
          * @param matchingPolicy the IssuerMatchingPolicy to use
          */
-        void getIssuerMatchingPolicy(IssuerMatchingPolicy* matchingPolicy) {
+        void setIssuerMatchingPolicy(IssuerMatchingPolicy* matchingPolicy) {
             delete m_matchingPolicy;
             m_matchingPolicy = matchingPolicy;
         }