Initial decryption and schema support for encrypted SAML.
[shibboleth/opensaml2.git] / saml / saml1 / core / impl / AssertionsImpl.cpp
index 8ada823..07ce6e1 100644 (file)
@@ -55,7 +55,7 @@ namespace opensaml {
         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,Audience);
         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,ConfirmationMethod);
         
-        class XMLTOOL_DLLLOCAL AudienceRestrictionConditionImpl : public virtual AudienceRestrictionCondition,
+        class SAML_DLLLOCAL AudienceRestrictionConditionImpl : public virtual AudienceRestrictionCondition,
             public AbstractComplexElement,
             public AbstractDOMCachingXMLObject,
             public AbstractValidatingXMLObject,
@@ -92,7 +92,7 @@ namespace opensaml {
             }
         };
 
-        class XMLTOOL_DLLLOCAL DoNotCacheConditionImpl : public virtual DoNotCacheCondition,
+        class SAML_DLLLOCAL DoNotCacheConditionImpl : public virtual DoNotCacheCondition,
             public AbstractChildlessElement,
             public AbstractDOMCachingXMLObject,
             public AbstractValidatingXMLObject,
@@ -537,7 +537,7 @@ namespace opensaml {
                 m_SubjectLocality=NULL;
                 m_children.push_back(NULL);
                 m_pos_SubjectLocality=m_pos_Subject;
-                m_pos_SubjectLocality++;
+                ++m_pos_SubjectLocality;
             }
             
             IMPL_XMLOBJECT_CLONE(AuthenticationStatement);
@@ -692,7 +692,7 @@ namespace opensaml {
                 m_Evidence=NULL;
                 m_children.push_back(NULL);
                 m_pos_Evidence=m_pos_Subject;
-                m_pos_Evidence++;
+                ++m_pos_Evidence;
             }
             
             IMPL_XMLOBJECT_CLONE(AuthorizationDecisionStatement);
@@ -931,8 +931,10 @@ namespace opensaml {
                 
                 // Unknown child.
                 const XMLCh* nsURI=root->getNamespaceURI();
-                if (!XMLString::equals(nsURI,SAMLConstants::SAML1_NS) && nsURI && *nsURI)
+                if (!XMLString::equals(nsURI,SAMLConstants::SAML1_NS) && nsURI && *nsURI) {
                     getOthers().push_back(childXMLObject);
+                    return;
+                }
                 
                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
             }
@@ -945,6 +947,23 @@ namespace opensaml {
             public AbstractXMLObjectMarshaller,
             public AbstractXMLObjectUnmarshaller
         {
+            void init() {
+                m_MinorVersion=1;
+                m_AssertionID=NULL;
+                m_Issuer=NULL;
+                m_IssueInstant=NULL;
+                m_children.push_back(NULL);
+                m_children.push_back(NULL);
+                m_children.push_back(NULL);
+                m_Conditions=NULL;
+                m_Advice=NULL;
+                m_Signature=NULL;
+                m_pos_Conditions=m_children.begin();
+                m_pos_Advice=m_pos_Conditions;
+                ++m_pos_Advice;
+                m_pos_Signature=m_pos_Advice;
+                ++m_pos_Signature;
+            }
         public:
             virtual ~AssertionImpl() {
                 XMLString::release(&m_AssertionID);
@@ -1007,22 +1026,26 @@ namespace opensaml {
                 }
             }
             
-            void init() {
-                m_MinorVersion=1;
-                m_AssertionID=NULL;
-                m_Issuer=NULL;
-                m_IssueInstant=NULL;
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_children.push_back(NULL);
-                m_Conditions=NULL;
-                m_Advice=NULL;
-                m_Signature=NULL;
-                m_pos_Conditions=m_children.begin();
-                m_pos_Advice=m_pos_Conditions;
-                m_pos_Advice++;
-                m_pos_Signature=m_pos_Advice;
-                m_pos_Signature++;
+            const XMLCh* getId() const {
+                return getAssertionID();
+            }
+
+            //IMPL_TYPED_CHILD(Signature);
+            // Need customized setter.
+        protected:
+            Signature* m_Signature;
+            list<XMLObject*>::iterator m_pos_Signature;
+        public:
+            Signature* getSignature() const {
+                return m_Signature;
+            }
+            
+            void setSignature(Signature* sig) {
+                prepareForAssignment(m_Signature,sig);
+                *m_pos_Signature=m_Signature=sig;
+                // Sync content reference back up.
+                if (m_Signature)
+                    m_Signature->setContentReference(new opensaml::ContentReference(*this));
             }
             
             IMPL_XMLOBJECT_CLONE(Assertion);
@@ -1032,7 +1055,6 @@ namespace opensaml {
             IMPL_DATETIME_ATTRIB(IssueInstant);
             IMPL_TYPED_CHILD(Conditions);
             IMPL_TYPED_CHILD(Advice);
-            IMPL_TYPED_CHILD(Signature);
             IMPL_TYPED_CHILDREN(Statement, m_pos_Signature);
             IMPL_TYPED_CHILDREN(SubjectStatement, m_pos_Signature);
             IMPL_TYPED_CHILDREN(AuthenticationStatement, m_pos_Signature);