Settable digest algorithm, enhanced prefix handling in signatures, pending xmlsec...
[shibboleth/cpp-opensaml.git] / saml / saml1 / core / impl / AssertionsImpl.cpp
index a8127ab..fa14c35 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2006 Internet2
+ *  Copyright 2001-2007 Internet2
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,7 +25,6 @@
 #include "saml1/core/Assertions.h"
 
 #include <xmltooling/AbstractComplexElement.h>
-#include <xmltooling/AbstractElementProxy.h>
 #include <xmltooling/AbstractSimpleElement.h>
 #include <xmltooling/impl/AnyElement.h>
 #include <xmltooling/io/AbstractXMLObjectMarshaller.h>
@@ -37,7 +36,6 @@
 #include <xercesc/util/XMLUniDefs.hpp>
 
 using namespace opensaml::saml1;
-using namespace opensaml;
 using namespace xmlsignature;
 using namespace xmltooling;
 using namespace std;
@@ -879,7 +877,7 @@ namespace opensaml {
                             continue;
                         }
     
-                        getOthers().push_back((*i)->clone());
+                        getUnknownXMLObjects().push_back((*i)->clone());
                     }
                 }
             }
@@ -887,7 +885,7 @@ namespace opensaml {
             IMPL_XMLOBJECT_CLONE(Advice);
             IMPL_TYPED_CHILDREN(AssertionIDReference,m_children.end());
             IMPL_TYPED_CHILDREN(Assertion,m_children.end());
-            IMPL_XMLOBJECT_CHILDREN(Other,m_children.end());
+            IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
     
         protected:
             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
@@ -897,7 +895,7 @@ namespace opensaml {
                 // Unknown child.
                 const XMLCh* nsURI=root->getNamespaceURI();
                 if (!XMLString::equals(nsURI,SAML1_NS) && nsURI && *nsURI) {
-                    getOthers().push_back(childXMLObject);
+                    getUnknownXMLObjects().push_back(childXMLObject);
                     return;
                 }
                 
@@ -1036,7 +1034,9 @@ namespace opensaml {
                 MARSHALL_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
                 if (!m_AssertionID)
                     const_cast<AssertionImpl*>(this)->m_AssertionID=SAMLConfig::getConfig().generateIdentifier();
-                MARSHALL_ID_ATTRIB(AssertionID,ASSERTIONID,NULL);
+                domElement->setAttributeNS(NULL, ASSERTIONID_ATTRIB_NAME, m_AssertionID);
+                if (*m_MinorVersion!=chDigit_0)
+                    domElement->setIdAttributeNS(NULL, ASSERTIONID_ATTRIB_NAME);
                 MARSHALL_STRING_ATTRIB(Issuer,ISSUER,NULL);
                 if (!m_IssueInstant) {
                     const_cast<AssertionImpl*>(this)->m_IssueInstantEpoch=time(NULL);
@@ -1057,6 +1057,13 @@ namespace opensaml {
                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
             }
     
+            void unmarshallAttributes(const DOMElement* domElement) {
+                // Standard processing, but then we check IDness.
+                AbstractXMLObjectUnmarshaller::unmarshallAttributes(domElement);
+                if (m_AssertionID && (!m_MinorVersion || *m_MinorVersion!=chDigit_0))
+                    const_cast<DOMElement*>(domElement)->setIdAttributeNS(NULL, ASSERTIONID_ATTRIB_NAME);
+            }
+
             void processAttribute(const DOMAttr* attribute) {
                 static const XMLCh MAJORVERSION[] = UNICODE_LITERAL_12(M,a,j,o,r,V,e,r,s,i,o,n);
                 if (XMLHelper::isNodeNamed(attribute,NULL,MAJORVERSION)) {
@@ -1064,7 +1071,7 @@ namespace opensaml {
                         throw UnmarshallingException("Assertion has invalid major version.");
                 }
                 PROC_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
-                PROC_ID_ATTRIB(AssertionID,ASSERTIONID,NULL);
+                PROC_STRING_ATTRIB(AssertionID,ASSERTIONID,NULL);
                 PROC_STRING_ATTRIB(Issuer,ISSUER,NULL);
                 PROC_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL);
             }