X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml1%2Fcore%2Fimpl%2FAssertionsImpl.cpp;h=bf1101e457d856b42a1d45abf6aab5b023f6ff1f;hb=e9554c255ad3c91c7c4976e7a1a54905903e66a2;hp=2299d13957d8681cd5bf53201626e25f93c18d17;hpb=2fbc97e0dd6b51eed1e9b07c90e4317bd74e2e34;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/saml1/core/impl/AssertionsImpl.cpp b/saml/saml1/core/impl/AssertionsImpl.cpp index 2299d13..bf1101e 100644 --- a/saml/saml1/core/impl/AssertionsImpl.cpp +++ b/saml/saml1/core/impl/AssertionsImpl.cpp @@ -1,6 +1,6 @@ /* - * Copyright 2001-2006 Internet2 - * + * Copyright 2001-2010 Internet2 + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,31 +16,36 @@ /** * AssertionsImpl.cpp - * - * Implementation classes for SAML 1.x Assertions schema + * + * Implementation classes for SAML 1.x Assertions schema. */ #include "internal.h" #include "exceptions.h" #include "saml1/core/Assertions.h" +#include "signature/ContentReference.h" -#include #include -#include #include #include #include #include +#include +#include +#include #include #include +#include #include using namespace opensaml::saml1; -using namespace opensaml; using namespace xmlsignature; using namespace xmltooling; using namespace std; +using xmlconstants::XMLSIG_NS; +using xmlconstants::XML_ONE; +using samlconstants::SAML1_NS; #if defined (_MSC_VER) #pragma warning( push ) @@ -49,11 +54,25 @@ using namespace std; namespace opensaml { namespace saml1 { - + DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AssertionIDReference); DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,Audience); DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,ConfirmationMethod); - + + class SAML_DLLLOCAL ConditionImpl : public virtual Condition, public AnyElementImpl + { + public: + virtual ~ConditionImpl() {} + + ConditionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + } + + ConditionImpl(const ConditionImpl& src) : AbstractXMLObject(src), AnyElementImpl(src) {} + + IMPL_XMLOBJECT_CLONE(Condition); + }; + class SAML_DLLLOCAL AudienceRestrictionConditionImpl : public virtual AudienceRestrictionCondition, public AbstractComplexElement, public AbstractDOMCachingXMLObject, @@ -62,13 +81,13 @@ namespace opensaml { { public: virtual ~AudienceRestrictionConditionImpl() {} - - AudienceRestrictionConditionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AudienceRestrictionConditionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { } - + AudienceRestrictionConditionImpl(const AudienceRestrictionConditionImpl& src) - : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) { + : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { VectorOf(Audience) v=getAudiences(); for (vector::const_iterator i=src.m_Audiences.begin(); i!=src.m_Audiences.end(); i++) { if (*i) { @@ -76,36 +95,37 @@ namespace opensaml { } } } - + IMPL_XMLOBJECT_CLONE(AudienceRestrictionCondition); Condition* cloneCondition() const { return cloneAudienceRestrictionCondition(); } IMPL_TYPED_CHILDREN(Audience,m_children.end()); - + protected: void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { - PROC_TYPED_CHILDREN(Audience,SAMLConstants::SAML1_NS,false); + PROC_TYPED_CHILDREN(Audience,SAML1_NS,false); AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); } }; class SAML_DLLLOCAL DoNotCacheConditionImpl : public virtual DoNotCacheCondition, - public AbstractChildlessElement, + public AbstractSimpleElement, public AbstractDOMCachingXMLObject, public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller { public: virtual ~DoNotCacheConditionImpl() {} - - DoNotCacheConditionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + DoNotCacheConditionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { } - - DoNotCacheConditionImpl(const DoNotCacheConditionImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) { + + DoNotCacheConditionImpl(const DoNotCacheConditionImpl& src) + : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { } - + IMPL_XMLOBJECT_CLONE(DoNotCacheCondition); Condition* cloneCondition() const { return cloneDoNotCacheCondition(); @@ -123,13 +143,14 @@ namespace opensaml { delete m_NotBefore; delete m_NotOnOrAfter; } - - ConditionsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + ConditionsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - - ConditionsImpl(const ConditionsImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) { + + ConditionsImpl(const ConditionsImpl& src) + : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { init(); setNotBefore(src.getNotBefore()); setNotOnOrAfter(src.getNotOnOrAfter()); @@ -141,13 +162,13 @@ namespace opensaml { getAudienceRestrictionConditions().push_back(arc->cloneAudienceRestrictionCondition()); continue; } - + DoNotCacheCondition* dncc=dynamic_cast(*i); if (dncc) { getDoNotCacheConditions().push_back(dncc->cloneDoNotCacheCondition()); continue; } - + Condition* c=dynamic_cast(*i); if (c) { getConditions().push_back(c->cloneCondition()); @@ -156,40 +177,39 @@ namespace opensaml { } } } - + void init() { - m_NotBefore=m_NotOnOrAfter=NULL; + m_NotBefore=m_NotOnOrAfter=nullptr; } - + IMPL_XMLOBJECT_CLONE(Conditions); IMPL_DATETIME_ATTRIB(NotBefore,0); - IMPL_DATETIME_ATTRIB(NotOnOrAfter,LLONG_MAX); + IMPL_DATETIME_ATTRIB(NotOnOrAfter,SAMLTIME_MAX); IMPL_TYPED_CHILDREN(AudienceRestrictionCondition, m_children.end()); IMPL_TYPED_CHILDREN(DoNotCacheCondition,m_children.end()); IMPL_TYPED_CHILDREN(Condition,m_children.end()); - + protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_DATETIME_ATTRIB(NotBefore,NOTBEFORE,NULL); - MARSHALL_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,NULL); + MARSHALL_DATETIME_ATTRIB(NotBefore,NOTBEFORE,nullptr); + MARSHALL_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,nullptr); } - + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { - PROC_TYPED_CHILDREN(AudienceRestrictionCondition,SAMLConstants::SAML1_NS,true); - PROC_TYPED_CHILDREN(DoNotCacheCondition,SAMLConstants::SAML1_NS,true); - PROC_TYPED_CHILDREN(Condition,SAMLConstants::SAML1_NS,true); + PROC_TYPED_CHILDREN(AudienceRestrictionCondition,SAML1_NS,true); + PROC_TYPED_CHILDREN(DoNotCacheCondition,SAML1_NS,true); + PROC_TYPED_CHILDREN(Condition,SAML1_NS,true); AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); } - + void processAttribute(const DOMAttr* attribute) { - PROC_DATETIME_ATTRIB(NotBefore,NOTBEFORE,NULL); - PROC_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,NULL); + PROC_DATETIME_ATTRIB(NotBefore,NOTBEFORE,nullptr); + PROC_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,nullptr); } }; class SAML_DLLLOCAL NameIdentifierImpl : public virtual NameIdentifier, public AbstractSimpleElement, - public AbstractChildlessElement, public AbstractDOMCachingXMLObject, public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller @@ -199,37 +219,36 @@ namespace opensaml { XMLString::release(&m_Format); XMLString::release(&m_NameQualifier); } - - NameIdentifierImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + NameIdentifierImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + NameIdentifierImpl(const NameIdentifierImpl& src) : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { init(); setFormat(src.getFormat()); setNameQualifier(src.getNameQualifier()); } - + void init() { - m_Format=m_NameQualifier=NULL; + m_Format=m_NameQualifier=nullptr; } - + IMPL_XMLOBJECT_CLONE(NameIdentifier); IMPL_STRING_ATTRIB(Format); IMPL_STRING_ATTRIB(NameQualifier); - IMPL_XMLOBJECT_CONTENT; - + protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_STRING_ATTRIB(Format,FORMAT,NULL); - MARSHALL_STRING_ATTRIB(NameQualifier,NAMEQUALIFIER,NULL); + MARSHALL_STRING_ATTRIB(Format,FORMAT,nullptr); + MARSHALL_STRING_ATTRIB(NameQualifier,NAMEQUALIFIER,nullptr); } void processAttribute(const DOMAttr* attribute) { - PROC_STRING_ATTRIB(Format,FORMAT,NULL); - PROC_STRING_ATTRIB(NameQualifier,NAMEQUALIFIER,NULL); + PROC_STRING_ATTRIB(Format,FORMAT,nullptr); + PROC_STRING_ATTRIB(NameQualifier,NAMEQUALIFIER,nullptr); } }; @@ -237,15 +256,14 @@ namespace opensaml { { public: virtual ~SubjectConfirmationDataImpl() {} - - SubjectConfirmationDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + SubjectConfirmationDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { } - - SubjectConfirmationDataImpl(const SubjectConfirmationDataImpl& src) - : AnyElementImpl(src) { + + SubjectConfirmationDataImpl(const SubjectConfirmationDataImpl& src) : AbstractXMLObject(src), AnyElementImpl(src) { } - + IMPL_XMLOBJECT_CLONE(SubjectConfirmationData); }; @@ -257,13 +275,14 @@ namespace opensaml { { public: virtual ~SubjectConfirmationImpl() {} - - SubjectConfirmationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + SubjectConfirmationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - - SubjectConfirmationImpl(const SubjectConfirmationImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) { + + SubjectConfirmationImpl(const SubjectConfirmationImpl& src) + : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { init(); if (src.getSubjectConfirmationData()) setSubjectConfirmationData(src.getSubjectConfirmationData()->clone()); @@ -276,12 +295,12 @@ namespace opensaml { } } } - + void init() { - m_SubjectConfirmationData=NULL; - m_KeyInfo=NULL; - m_children.push_back(NULL); - m_children.push_back(NULL); + m_SubjectConfirmationData=nullptr; + m_KeyInfo=nullptr; + m_children.push_back(nullptr); + m_children.push_back(nullptr); m_pos_SubjectConfirmationData=m_children.begin(); m_pos_KeyInfo=m_pos_SubjectConfirmationData; ++m_pos_KeyInfo; @@ -291,12 +310,12 @@ namespace opensaml { IMPL_TYPED_CHILDREN(ConfirmationMethod,m_pos_SubjectConfirmationData); IMPL_XMLOBJECT_CHILD(SubjectConfirmationData); IMPL_TYPED_CHILD(KeyInfo); - + protected: void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { - PROC_TYPED_CHILDREN(ConfirmationMethod,SAMLConstants::SAML1_NS,false); - PROC_TYPED_CHILD(KeyInfo,XMLConstants::XMLSIG_NS,false); - + PROC_TYPED_CHILDREN(ConfirmationMethod,SAML1_NS,false); + PROC_TYPED_CHILD(KeyInfo,XMLSIG_NS,false); + // Anything else we'll assume is the data. if (getSubjectConfirmationData()) throw UnmarshallingException("Invalid child element: $1",params(1,childXMLObject->getElementQName().toString().c_str())); @@ -312,25 +331,26 @@ namespace opensaml { { public: virtual ~SubjectImpl() {} - - SubjectImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + SubjectImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - - SubjectImpl(const SubjectImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) { + + SubjectImpl(const SubjectImpl& src) + : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { init(); if (src.getNameIdentifier()) setNameIdentifier(src.getNameIdentifier()->cloneNameIdentifier()); if (src.getSubjectConfirmation()) setSubjectConfirmation(src.getSubjectConfirmation()->cloneSubjectConfirmation()); } - + void init() { - m_NameIdentifier=NULL; - m_SubjectConfirmation=NULL; - m_children.push_back(NULL); - m_children.push_back(NULL); + m_NameIdentifier=nullptr; + m_SubjectConfirmation=nullptr; + m_children.push_back(nullptr); + m_children.push_back(nullptr); m_pos_NameIdentifier=m_children.begin(); m_pos_SubjectConfirmation=m_pos_NameIdentifier; ++m_pos_SubjectConfirmation; @@ -339,15 +359,29 @@ namespace opensaml { IMPL_XMLOBJECT_CLONE(Subject); IMPL_TYPED_CHILD(NameIdentifier); IMPL_TYPED_CHILD(SubjectConfirmation); - + protected: void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { - PROC_TYPED_CHILD(NameIdentifier,SAMLConstants::SAML1_NS,true); - PROC_TYPED_CHILD(SubjectConfirmation,SAMLConstants::SAML1_NS,true); + PROC_TYPED_CHILD(NameIdentifier,SAML1_NS,true); + PROC_TYPED_CHILD(SubjectConfirmation,SAML1_NS,true); AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); } }; + class SAML_DLLLOCAL StatementImpl : public virtual Statement, public AnyElementImpl + { + public: + virtual ~StatementImpl() {} + + StatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + } + + StatementImpl(const StatementImpl& src) : AbstractXMLObject(src), AnyElementImpl(src) {} + + IMPL_XMLOBJECT_CLONE(Statement); + }; + class SAML_DLLLOCAL SubjectStatementImpl : public virtual SubjectStatement, public AbstractComplexElement, public AbstractDOMCachingXMLObject, @@ -355,8 +389,8 @@ namespace opensaml { public AbstractXMLObjectUnmarshaller { void init() { - m_Subject=NULL; - m_children.push_back(NULL); + m_Subject=nullptr; + m_children.push_back(nullptr); m_pos_Subject=m_children.begin(); } protected: @@ -365,29 +399,30 @@ namespace opensaml { } public: virtual ~SubjectStatementImpl() {} - - SubjectStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + SubjectStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - - SubjectStatementImpl(const SubjectStatementImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) { + + SubjectStatementImpl(const SubjectStatementImpl& src) + : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { init(); if (src.getSubject()) setSubject(src.getSubject()->cloneSubject()); } - + IMPL_TYPED_CHILD(Subject); - + protected: void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { - PROC_TYPED_CHILD(Subject,SAMLConstants::SAML1_NS,true); + PROC_TYPED_CHILD(Subject,SAML1_NS,true); AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); } }; class SAML_DLLLOCAL SubjectLocalityImpl : public virtual SubjectLocality, - public AbstractChildlessElement, + public AbstractSimpleElement, public AbstractDOMCachingXMLObject, public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller @@ -397,40 +432,41 @@ namespace opensaml { XMLString::release(&m_IPAddress); XMLString::release(&m_DNSAddress); } - - SubjectLocalityImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + SubjectLocalityImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - - SubjectLocalityImpl(const SubjectLocalityImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) { + + SubjectLocalityImpl(const SubjectLocalityImpl& src) + : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { init(); setIPAddress(src.getIPAddress()); setDNSAddress(src.getDNSAddress()); } - + void init() { - m_IPAddress=m_DNSAddress=NULL; + m_IPAddress=m_DNSAddress=nullptr; } - + IMPL_XMLOBJECT_CLONE(SubjectLocality); IMPL_STRING_ATTRIB(IPAddress); IMPL_STRING_ATTRIB(DNSAddress); - + protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_STRING_ATTRIB(IPAddress,IPADDRESS,NULL); - MARSHALL_STRING_ATTRIB(DNSAddress,DNSADDRESS,NULL); + MARSHALL_STRING_ATTRIB(IPAddress,IPADDRESS,nullptr); + MARSHALL_STRING_ATTRIB(DNSAddress,DNSADDRESS,nullptr); } - + void processAttribute(const DOMAttr* attribute) { - PROC_STRING_ATTRIB(IPAddress,IPADDRESS,NULL); - PROC_STRING_ATTRIB(DNSAddress,DNSADDRESS,NULL); + PROC_STRING_ATTRIB(IPAddress,IPADDRESS,nullptr); + PROC_STRING_ATTRIB(DNSAddress,DNSADDRESS,nullptr); } }; class SAML_DLLLOCAL AuthorityBindingImpl : public virtual AuthorityBinding, - public AbstractChildlessElement, + public AbstractSimpleElement, public AbstractDOMCachingXMLObject, public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller @@ -441,40 +477,41 @@ namespace opensaml { XMLString::release(&m_Location); XMLString::release(&m_Binding); } - - AuthorityBindingImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AuthorityBindingImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - - AuthorityBindingImpl(const AuthorityBindingImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) { + + AuthorityBindingImpl(const AuthorityBindingImpl& src) + : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { init(); setAuthorityKind(src.getAuthorityKind()); setLocation(src.getLocation()); setBinding(src.getBinding()); } - + void init() { - m_AuthorityKind=NULL; - m_Location=m_Binding=NULL; + m_AuthorityKind=nullptr; + m_Location=m_Binding=nullptr; } - + IMPL_XMLOBJECT_CLONE(AuthorityBinding); - IMPL_XMLOBJECT_ATTRIB(AuthorityKind,QName); + IMPL_XMLOBJECT_ATTRIB(AuthorityKind,xmltooling::QName); IMPL_STRING_ATTRIB(Location); IMPL_STRING_ATTRIB(Binding); - + protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_QNAME_ATTRIB(AuthorityKind,AUTHORITYKIND,NULL); - MARSHALL_STRING_ATTRIB(Location,LOCATION,NULL); - MARSHALL_STRING_ATTRIB(Binding,BINDING,NULL); + MARSHALL_QNAME_ATTRIB(AuthorityKind,AUTHORITYKIND,nullptr); + MARSHALL_STRING_ATTRIB(Location,LOCATION,nullptr); + MARSHALL_STRING_ATTRIB(Binding,BINDING,nullptr); } - + void processAttribute(const DOMAttr* attribute) { - PROC_QNAME_ATTRIB(AuthorityKind,AUTHORITYKIND,NULL); - PROC_STRING_ATTRIB(Location,LOCATION,NULL); - PROC_STRING_ATTRIB(Binding,BINDING,NULL); + PROC_QNAME_ATTRIB(AuthorityKind,AUTHORITYKIND,nullptr); + PROC_STRING_ATTRIB(Location,LOCATION,nullptr); + PROC_STRING_ATTRIB(Binding,BINDING,nullptr); } }; @@ -485,12 +522,12 @@ namespace opensaml { XMLString::release(&m_AuthenticationMethod); delete m_AuthenticationInstant; } - - AuthenticationStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AuthenticationStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + AuthenticationStatementImpl(const AuthenticationStatementImpl& src) : AbstractXMLObject(src), SubjectStatementImpl(src) { init(); setAuthenticationMethod(src.getAuthenticationMethod()); @@ -504,16 +541,16 @@ namespace opensaml { } } } - + void init() { - m_AuthenticationMethod=NULL; - m_AuthenticationInstant=NULL; - m_SubjectLocality=NULL; - m_children.push_back(NULL); + m_AuthenticationMethod=nullptr; + m_AuthenticationInstant=nullptr; + m_SubjectLocality=nullptr; + m_children.push_back(nullptr); m_pos_SubjectLocality=m_pos_Subject; ++m_pos_SubjectLocality; } - + IMPL_XMLOBJECT_CLONE(AuthenticationStatement); SubjectStatement* cloneSubjectStatement() const { return cloneAuthenticationStatement(); @@ -525,30 +562,29 @@ namespace opensaml { IMPL_DATETIME_ATTRIB(AuthenticationInstant,0); IMPL_TYPED_CHILD(SubjectLocality); IMPL_TYPED_CHILDREN(AuthorityBinding, m_children.end()); - + protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_STRING_ATTRIB(AuthenticationMethod,AUTHENTICATIONMETHOD,NULL); - MARSHALL_DATETIME_ATTRIB(AuthenticationInstant,AUTHENTICATIONINSTANT,NULL); + MARSHALL_STRING_ATTRIB(AuthenticationMethod,AUTHENTICATIONMETHOD,nullptr); + MARSHALL_DATETIME_ATTRIB(AuthenticationInstant,AUTHENTICATIONINSTANT,nullptr); SubjectStatementImpl::marshallAttributes(domElement); } - + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { - PROC_TYPED_CHILD(SubjectLocality,SAMLConstants::SAML1_NS,false); - PROC_TYPED_CHILDREN(AuthorityBinding,SAMLConstants::SAML1_NS,false); + PROC_TYPED_CHILD(SubjectLocality,SAML1_NS,false); + PROC_TYPED_CHILDREN(AuthorityBinding,SAML1_NS,false); SubjectStatementImpl::processChildElement(childXMLObject,root); } - + void processAttribute(const DOMAttr* attribute) { - PROC_STRING_ATTRIB(AuthenticationMethod,AUTHENTICATIONMETHOD,NULL); - PROC_DATETIME_ATTRIB(AuthenticationInstant,AUTHENTICATIONINSTANT,NULL); + PROC_STRING_ATTRIB(AuthenticationMethod,AUTHENTICATIONMETHOD,nullptr); + PROC_DATETIME_ATTRIB(AuthenticationInstant,AUTHENTICATIONINSTANT,nullptr); SubjectStatementImpl::processAttribute(attribute); } }; class SAML_DLLLOCAL ActionImpl : public virtual Action, public AbstractSimpleElement, - public AbstractChildlessElement, public AbstractDOMCachingXMLObject, public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller @@ -557,26 +593,25 @@ namespace opensaml { virtual ~ActionImpl() { XMLString::release(&m_Namespace); } - - ActionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_Namespace(NULL) { + + ActionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_Namespace(nullptr) { } - + ActionImpl(const ActionImpl& src) : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { setNamespace(src.getNamespace()); } - + IMPL_XMLOBJECT_CLONE(Action); IMPL_STRING_ATTRIB(Namespace); - IMPL_XMLOBJECT_CONTENT; - + protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_STRING_ATTRIB(Namespace,NAMESPACE,NULL); + MARSHALL_STRING_ATTRIB(Namespace,NAMESPACE,nullptr); } void processAttribute(const DOMAttr* attribute) { - PROC_STRING_ATTRIB(Namespace,NAMESPACE,NULL); + PROC_STRING_ATTRIB(Namespace,NAMESPACE,nullptr); } }; @@ -588,13 +623,13 @@ namespace opensaml { { public: virtual ~EvidenceImpl() {} - - EvidenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + EvidenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { } - - EvidenceImpl(const EvidenceImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) { - + + EvidenceImpl(const EvidenceImpl& src) + : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { if (*i) { AssertionIDReference* ref=dynamic_cast(*i); @@ -602,7 +637,7 @@ namespace opensaml { getAssertionIDReferences().push_back(ref->cloneAssertionIDReference()); continue; } - + Assertion* assertion=dynamic_cast(*i); if (assertion) { getAssertions().push_back(assertion->cloneAssertion()); @@ -611,15 +646,15 @@ namespace opensaml { } } } - + IMPL_XMLOBJECT_CLONE(Evidence); IMPL_TYPED_CHILDREN(AssertionIDReference,m_children.end()); IMPL_TYPED_CHILDREN(Assertion,m_children.end()); - + protected: void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { - PROC_TYPED_CHILDREN(AssertionIDReference,SAMLConstants::SAML1_NS,false); - PROC_TYPED_CHILDREN(Assertion,SAMLConstants::SAML1_NS,true); + PROC_TYPED_CHILDREN(AssertionIDReference,SAML1_NS,false); + PROC_TYPED_CHILDREN(Assertion,SAML1_NS,true); AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); } }; @@ -632,12 +667,12 @@ namespace opensaml { XMLString::release(&m_Resource); XMLString::release(&m_Decision); } - - AuthorizationDecisionStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AuthorizationDecisionStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + AuthorizationDecisionStatementImpl(const AuthorizationDecisionStatementImpl& src) : AbstractXMLObject(src), SubjectStatementImpl(src) { init(); @@ -652,16 +687,16 @@ namespace opensaml { } } } - + void init() { - m_Resource=NULL; - m_Decision=NULL; - m_Evidence=NULL; - m_children.push_back(NULL); + m_Resource=nullptr; + m_Decision=nullptr; + m_Evidence=nullptr; + m_children.push_back(nullptr); m_pos_Evidence=m_pos_Subject; ++m_pos_Evidence; } - + IMPL_XMLOBJECT_CLONE(AuthorizationDecisionStatement); SubjectStatement* cloneSubjectStatement() const { return cloneAuthorizationDecisionStatement(); @@ -673,29 +708,29 @@ namespace opensaml { IMPL_STRING_ATTRIB(Decision); IMPL_TYPED_CHILD(Evidence); IMPL_TYPED_CHILDREN(Action, m_pos_Evidence); - + protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_STRING_ATTRIB(Resource,RESOURCE,NULL); - MARSHALL_STRING_ATTRIB(Decision,DECISION,NULL); + MARSHALL_STRING_ATTRIB(Resource,RESOURCE,nullptr); + MARSHALL_STRING_ATTRIB(Decision,DECISION,nullptr); SubjectStatementImpl::marshallAttributes(domElement); } - + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { - PROC_TYPED_CHILD(Evidence,SAMLConstants::SAML1_NS,false); - PROC_TYPED_CHILDREN(Action,SAMLConstants::SAML1_NS,false); + PROC_TYPED_CHILD(Evidence,SAML1_NS,false); + PROC_TYPED_CHILDREN(Action,SAML1_NS,false); SubjectStatementImpl::processChildElement(childXMLObject,root); } - + void processAttribute(const DOMAttr* attribute) { - PROC_STRING_ATTRIB(Resource,RESOURCE,NULL); - PROC_STRING_ATTRIB(Decision,DECISION,NULL); + PROC_STRING_ATTRIB(Resource,RESOURCE,nullptr); + PROC_STRING_ATTRIB(Decision,DECISION,nullptr); SubjectStatementImpl::processAttribute(attribute); } }; class SAML_DLLLOCAL AttributeDesignatorImpl : public virtual AttributeDesignator, - public AbstractChildlessElement, + public AbstractSimpleElement, public AbstractDOMCachingXMLObject, public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller @@ -705,35 +740,36 @@ namespace opensaml { XMLString::release(&m_AttributeName); XMLString::release(&m_AttributeNamespace); } - - AttributeDesignatorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AttributeDesignatorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - - AttributeDesignatorImpl(const AttributeDesignatorImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) { + + AttributeDesignatorImpl(const AttributeDesignatorImpl& src) + : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { init(); setAttributeName(src.getAttributeName()); setAttributeNamespace(src.getAttributeNamespace()); } - + void init() { - m_AttributeName=m_AttributeNamespace=NULL; + m_AttributeName=m_AttributeNamespace=nullptr; } - + IMPL_XMLOBJECT_CLONE(AttributeDesignator); IMPL_STRING_ATTRIB(AttributeName); IMPL_STRING_ATTRIB(AttributeNamespace); - + protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,NULL); - MARSHALL_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,NULL); + MARSHALL_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,nullptr); + MARSHALL_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,nullptr); } - + void processAttribute(const DOMAttr* attribute) { - PROC_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,NULL); - PROC_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,NULL); + PROC_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,nullptr); + PROC_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,nullptr); } }; @@ -748,13 +784,14 @@ namespace opensaml { XMLString::release(&m_AttributeName); XMLString::release(&m_AttributeNamespace); } - - AttributeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AttributeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - - AttributeImpl(const AttributeImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) { + + AttributeImpl(const AttributeImpl& src) + : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { init(); setAttributeName(src.getAttributeName()); setAttributeNamespace(src.getAttributeNamespace()); @@ -765,11 +802,11 @@ namespace opensaml { } } } - + void init() { - m_AttributeName=m_AttributeNamespace=NULL; + m_AttributeName=m_AttributeNamespace=nullptr; } - + IMPL_XMLOBJECT_CLONE(Attribute); AttributeDesignator* cloneAttributeDesignator() const { return cloneAttribute(); @@ -777,11 +814,11 @@ namespace opensaml { IMPL_STRING_ATTRIB(AttributeName); IMPL_STRING_ATTRIB(AttributeNamespace); IMPL_XMLOBJECT_CHILDREN(AttributeValue,m_children.end()); - + protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,NULL); - MARSHALL_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,NULL); + MARSHALL_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,nullptr); + MARSHALL_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,nullptr); } void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { @@ -789,8 +826,8 @@ namespace opensaml { } void processAttribute(const DOMAttr* attribute) { - PROC_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,NULL); - PROC_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,NULL); + PROC_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,nullptr); + PROC_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,nullptr); } }; @@ -798,13 +835,13 @@ namespace opensaml { { public: virtual ~AttributeValueImpl() {} - - AttributeValueImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AttributeValueImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { } - - AttributeValueImpl(const AttributeValueImpl& src) : AnyElementImpl(src) {} - + + AttributeValueImpl(const AttributeValueImpl& src) : AbstractXMLObject(src), AnyElementImpl(src) {} + IMPL_XMLOBJECT_CLONE(AttributeValue); }; @@ -812,11 +849,11 @@ namespace opensaml { { public: virtual ~AttributeStatementImpl() {} - - AttributeStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AttributeStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { } - + AttributeStatementImpl(const AttributeStatementImpl& src) : AbstractXMLObject(src), SubjectStatementImpl(src) { VectorOf(Attribute) v=getAttributes(); @@ -826,7 +863,7 @@ namespace opensaml { } } } - + IMPL_XMLOBJECT_CLONE(AttributeStatement); SubjectStatement* cloneSubjectStatement() const { return cloneAttributeStatement(); @@ -835,10 +872,10 @@ namespace opensaml { return cloneAttributeStatement(); } IMPL_TYPED_CHILDREN(Attribute, m_children.end()); - + protected: void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { - PROC_TYPED_CHILDREN(Attribute,SAMLConstants::SAML1_NS,true); + PROC_TYPED_CHILDREN(Attribute,SAML1_NS,true); SubjectStatementImpl::processChildElement(childXMLObject,root); } }; @@ -851,13 +888,13 @@ namespace opensaml { { public: virtual ~AdviceImpl() {} - - AdviceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AdviceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { } - - AdviceImpl(const AdviceImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) { - + + AdviceImpl(const AdviceImpl& src) + : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { if (*i) { AssertionIDReference* ref=dynamic_cast(*i); @@ -865,35 +902,35 @@ namespace opensaml { getAssertionIDReferences().push_back(ref->cloneAssertionIDReference()); continue; } - + Assertion* assertion=dynamic_cast(*i); if (assertion) { getAssertions().push_back(assertion->cloneAssertion()); continue; } - - getOthers().push_back((*i)->clone()); + + getUnknownXMLObjects().push_back((*i)->clone()); } } } - + 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) { - PROC_TYPED_CHILDREN(AssertionIDReference,SAMLConstants::SAML1_NS,false); - PROC_TYPED_CHILDREN(Assertion,SAMLConstants::SAML1_NS,true); - + PROC_TYPED_CHILDREN(AssertionIDReference,SAML1_NS,false); + PROC_TYPED_CHILDREN(Assertion,SAML1_NS,true); + // Unknown child. const XMLCh* nsURI=root->getNamespaceURI(); - if (!XMLString::equals(nsURI,SAMLConstants::SAML1_NS) && nsURI && *nsURI) { - getOthers().push_back(childXMLObject); + if (!XMLString::equals(nsURI,SAML1_NS) && nsURI && *nsURI) { + getUnknownXMLObjects().push_back(childXMLObject); return; } - + AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); } }; @@ -905,16 +942,16 @@ namespace opensaml { public AbstractXMLObjectUnmarshaller { void init() { - m_MinorVersion=NULL; - 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_MinorVersion=nullptr; + m_AssertionID=nullptr; + m_Issuer=nullptr; + m_IssueInstant=nullptr; + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_Conditions=nullptr; + m_Advice=nullptr; + m_Signature=nullptr; m_pos_Conditions=m_children.begin(); m_pos_Advice=m_pos_Conditions; ++m_pos_Advice; @@ -928,13 +965,14 @@ namespace opensaml { XMLString::release(&m_Issuer); delete m_IssueInstant; } - - AssertionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AssertionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - - AssertionImpl(const AssertionImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) { + + AssertionImpl(const AssertionImpl& src) + : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { init(); setMinorVersion(src.m_MinorVersion); setAssertionID(src.getAssertionID()); @@ -965,13 +1003,13 @@ namespace opensaml { getAuthorizationDecisionStatements().push_back(authzst->cloneAuthorizationDecisionStatement()); continue; } - + SubjectStatement* subst=dynamic_cast(*i); if (subst) { getSubjectStatements().push_back(subst->cloneSubjectStatement()); continue; } - + Statement* st=dynamic_cast(*i); if (st) { getStatements().push_back(st->cloneStatement()); @@ -980,10 +1018,6 @@ namespace opensaml { } } } - - const XMLCh* getId() const { - return getAssertionID(); - } //IMPL_TYPED_CHILD(Signature); // Need customized setter. @@ -994,7 +1028,7 @@ namespace opensaml { Signature* getSignature() const { return m_Signature; } - + void setSignature(Signature* sig) { prepareForAssignment(m_Signature,sig); *m_pos_Signature=m_Signature=sig; @@ -1002,10 +1036,22 @@ namespace opensaml { if (m_Signature) m_Signature->setContentReference(new opensaml::ContentReference(*this)); } - + IMPL_XMLOBJECT_CLONE(Assertion); IMPL_INTEGER_ATTRIB(MinorVersion); - IMPL_STRING_ATTRIB(AssertionID); + IMPL_STRING_ATTRIB(AssertionID); // have to special-case getXMLID + const XMLCh* getXMLID() const { + pair v = getMinorVersion(); + return (!v.first || v.second > 0) ? m_AssertionID : nullptr; + } + const XMLCh* getID() const { + return getAssertionID(); + } + void releaseDOM() const { + if (getDOM()) + getDOM()->removeAttributeNS(nullptr, ASSERTIONID_ATTRIB_NAME); + AbstractDOMCachingXMLObject::releaseDOM(); + } IMPL_STRING_ATTRIB(Issuer); IMPL_DATETIME_ATTRIB(IssueInstant,0); IMPL_TYPED_CHILD(Conditions); @@ -1015,50 +1061,69 @@ namespace opensaml { IMPL_TYPED_CHILDREN(AuthenticationStatement, m_pos_Signature); IMPL_TYPED_CHILDREN(AttributeStatement, m_pos_Signature); IMPL_TYPED_CHILDREN(AuthorizationDecisionStatement, m_pos_Signature); - + protected: void marshallAttributes(DOMElement* domElement) const { static const XMLCh MAJORVERSION[] = UNICODE_LITERAL_12(M,a,j,o,r,V,e,r,s,i,o,n); - domElement->setAttributeNS(NULL,MAJORVERSION,XMLConstants::XML_ONE); + domElement->setAttributeNS(nullptr,MAJORVERSION,XML_ONE); if (!m_MinorVersion) - const_cast(this)->m_MinorVersion=XMLString::replicate(XMLConstants::XML_ONE); - MARSHALL_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL); + const_cast(this)->m_MinorVersion=XMLString::replicate(XML_ONE); + MARSHALL_INTEGER_ATTRIB(MinorVersion,MINORVERSION,nullptr); if (!m_AssertionID) const_cast(this)->m_AssertionID=SAMLConfig::getConfig().generateIdentifier(); - MARSHALL_ID_ATTRIB(AssertionID,ASSERTIONID,NULL); - MARSHALL_STRING_ATTRIB(Issuer,ISSUER,NULL); + domElement->setAttributeNS(nullptr, ASSERTIONID_ATTRIB_NAME, m_AssertionID); + if (*m_MinorVersion!=chDigit_0) { +#ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE + domElement->setIdAttributeNS(nullptr, ASSERTIONID_ATTRIB_NAME, true); +#else + domElement->setIdAttributeNS(nullptr, ASSERTIONID_ATTRIB_NAME); +#endif + } + MARSHALL_STRING_ATTRIB(Issuer,ISSUER,nullptr); if (!m_IssueInstant) { - const_cast(this)->m_IssueInstantEpoch=time(NULL); + const_cast(this)->m_IssueInstantEpoch=time(nullptr); const_cast(this)->m_IssueInstant=new DateTime(m_IssueInstantEpoch); } - MARSHALL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL); + MARSHALL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,nullptr); } - + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { - PROC_TYPED_CHILD(Conditions,SAMLConstants::SAML1_NS,false); - PROC_TYPED_CHILD(Advice,SAMLConstants::SAML1_NS,false); - PROC_TYPED_CHILD(Signature,XMLConstants::XMLSIG_NS,false); - PROC_TYPED_CHILDREN(AuthenticationStatement,SAMLConstants::SAML1_NS,false); - PROC_TYPED_CHILDREN(AttributeStatement,SAMLConstants::SAML1_NS,false); - PROC_TYPED_CHILDREN(AuthorizationDecisionStatement,SAMLConstants::SAML1_NS,false); - PROC_TYPED_CHILDREN(SubjectStatement,SAMLConstants::SAML1_NS,true); - PROC_TYPED_CHILDREN(Statement,SAMLConstants::SAML1_NS,true); + PROC_TYPED_CHILD(Conditions,SAML1_NS,false); + PROC_TYPED_CHILD(Advice,SAML1_NS,false); + PROC_TYPED_CHILD(Signature,XMLSIG_NS,false); + PROC_TYPED_CHILDREN(AuthenticationStatement,SAML1_NS,false); + PROC_TYPED_CHILDREN(AttributeStatement,SAML1_NS,false); + PROC_TYPED_CHILDREN(AuthorizationDecisionStatement,SAML1_NS,false); + PROC_TYPED_CHILDREN(SubjectStatement,SAML1_NS,true); + PROC_TYPED_CHILDREN(Statement,SAML1_NS,true); 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)) { +#ifdef XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE + const_cast(domElement)->setIdAttributeNS(nullptr, ASSERTIONID_ATTRIB_NAME, true); +#else + const_cast(domElement)->setIdAttributeNS(nullptr, ASSERTIONID_ATTRIB_NAME); +#endif + } + } + 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)) { - if (!XMLString::equals(attribute->getValue(),XMLConstants::XML_ONE)) + if (XMLHelper::isNodeNamed(attribute,nullptr,MAJORVERSION)) { + if (!XMLString::equals(attribute->getValue(),XML_ONE)) throw UnmarshallingException("Assertion has invalid major version."); } - PROC_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL); - PROC_ID_ATTRIB(AssertionID,ASSERTIONID,NULL); - PROC_STRING_ATTRIB(Issuer,ISSUER,NULL); - PROC_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL); + PROC_INTEGER_ATTRIB(MinorVersion,MINORVERSION,nullptr); + PROC_STRING_ATTRIB(AssertionID,ASSERTIONID,nullptr); + PROC_STRING_ATTRIB(Issuer,ISSUER,nullptr); + PROC_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,nullptr); } }; - + }; }; @@ -1081,11 +1146,13 @@ IMPL_XMLOBJECTBUILDER(AudienceRestrictionCondition); IMPL_XMLOBJECTBUILDER(AuthenticationStatement); IMPL_XMLOBJECTBUILDER(AuthorizationDecisionStatement); IMPL_XMLOBJECTBUILDER(AuthorityBinding); +IMPL_XMLOBJECTBUILDER(Condition); IMPL_XMLOBJECTBUILDER(Conditions); IMPL_XMLOBJECTBUILDER(ConfirmationMethod); IMPL_XMLOBJECTBUILDER(DoNotCacheCondition); IMPL_XMLOBJECTBUILDER(Evidence); IMPL_XMLOBJECTBUILDER(NameIdentifier); +IMPL_XMLOBJECTBUILDER(Statement); IMPL_XMLOBJECTBUILDER(Subject); IMPL_XMLOBJECTBUILDER(SubjectConfirmation); IMPL_XMLOBJECTBUILDER(SubjectConfirmationData); @@ -1158,5 +1225,113 @@ const XMLCh SubjectLocality::IPADDRESS_ATTRIB_NAME[] = UNICODE_LITERAL_9(I, const XMLCh SubjectLocality::DNSADDRESS_ATTRIB_NAME[] = UNICODE_LITERAL_10(D,N,S,A,d,d,r,e,s,s); const XMLCh SubjectStatement::LOCAL_NAME[] = UNICODE_LITERAL_16(S,u,b,j,e,c,t,S,t,a,t,e,m,e,n,t); -#define XCH(ch) chLatin_##ch -#define XNUM(d) chDigit_##d +const XMLCh NameIdentifier::UNSPECIFIED[] = // urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified +{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, + chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_1, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_i, chLatin_d, chDash, + chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chColon, + chLatin_u, chLatin_n, chLatin_s, chLatin_p, chLatin_e, chLatin_c, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_d, chLatin_d, chNull +}; + +const XMLCh NameIdentifier::EMAIL[] = // urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress +{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, + chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_1, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_i, chLatin_d, chDash, + chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chColon, + chLatin_e, chLatin_m, chLatin_a, chLatin_i, chLatin_l, chLatin_A, chLatin_d, chLatin_d, chLatin_r, chLatin_e, chLatin_s, chLatin_s, chNull +}; + +const XMLCh NameIdentifier::X509_SUBJECT[] = // urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName +{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, + chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_1, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_i, chLatin_d, chDash, + chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chColon, + chLatin_X, chDigit_5, chDigit_0, chDigit_9, chLatin_S, chLatin_u, chLatin_b, chLatin_j, chLatin_e, chLatin_c, chLatin_t, + chLatin_N, chLatin_a, chLatin_m, chLatin_e, chNull +}; + +const XMLCh NameIdentifier::WIN_DOMAIN_QUALIFIED[] = // urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName +{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, + chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_1, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_i, chLatin_d, chDash, + chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chColon, + chLatin_W, chLatin_i, chLatin_n, chLatin_d, chLatin_o, chLatin_w, chLatin_s, + chLatin_D, chLatin_o, chLatin_m, chLatin_a, chLatin_i, chLatin_n, + chLatin_Q, chLatin_u, chLatin_a, chLatin_l, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_d, + chLatin_N, chLatin_a, chLatin_m, chLatin_e, chNull +}; + +const XMLCh SubjectConfirmation::ARTIFACT01[] = // urn:oasis:names:tc:SAML:1.0:cm:artifact-01 +{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, + chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon, + chLatin_c, chLatin_m, chColon, chLatin_a, chLatin_r, chLatin_t, chLatin_i, chLatin_f, chLatin_a, chLatin_c, chLatin_t, + chDash, chDigit_0, chDigit_1, chNull +}; + +const XMLCh SubjectConfirmation::ARTIFACT[] = // urn:oasis:names:tc:SAML:1.0:cm:artifact +{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, + chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon, + chLatin_c, chLatin_m, chColon, chLatin_a, chLatin_r, chLatin_t, chLatin_i, chLatin_f, chLatin_a, chLatin_c, chLatin_t, chNull +}; + +const XMLCh SubjectConfirmation::BEARER[] = // urn:oasis:names:tc:SAML:1.0:cm:bearer +{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, + chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon, + chLatin_c, chLatin_m, chColon, chLatin_b, chLatin_e, chLatin_a, chLatin_r, chLatin_e, chLatin_r, chNull +}; + +const XMLCh SubjectConfirmation::HOLDER_KEY[] = // urn:oasis:names:tc:SAML:1.0:cm:holder-of-key +{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, + chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon, + chLatin_c, chLatin_m, chColon, chLatin_h, chLatin_o, chLatin_l, chLatin_d, chLatin_e, chLatin_r, chDash, + chLatin_o, chLatin_f, chDash, chLatin_k, chLatin_e, chLatin_y, chNull +}; + +const XMLCh SubjectConfirmation::SENDER_VOUCHES[] = // urn:oasis:names:tc:SAML:1.0:cm:sender-vouches +{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, + chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon, + chLatin_c, chLatin_m, chColon, chLatin_s, chLatin_e, chLatin_n, chLatin_d, chLatin_e, chLatin_r, chDash, + chLatin_v, chLatin_o, chLatin_u, chLatin_c, chLatin_h, chLatin_e, chLatin_s, chNull +}; + +const XMLCh Action::RWEDC_ACTION_NAMESPACE[] = // urn:oasis:names:tc:SAML:1.0:action:rwedc +{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, + chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon, + chLatin_a, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chColon, + chLatin_r, chLatin_w, chLatin_e, chLatin_d, chLatin_c, chNull +}; + +const XMLCh Action::RWEDC_NEG_ACTION_NAMESPACE[] = // urn:oasis:names:tc:SAML:1.0:action:rwedc-negation +{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, + chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon, + chLatin_a, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chColon, + chLatin_r, chLatin_w, chLatin_e, chLatin_d, chLatin_c, chDash, + chLatin_n, chLatin_e, chLatin_g, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull +}; + +const XMLCh Action::GHPP_ACTION_NAMESPACE[] = // urn:oasis:names:tc:SAML:1.0:action:ghpp +{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, + chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon, + chLatin_a, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chColon, + chLatin_g, chLatin_h, chLatin_p, chLatin_p, chNull +}; + +const XMLCh Action::UNIX_ACTION_NAMESPACE[] = // urn:oasis:names:tc:SAML:1.0:action:unix +{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, + chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, + chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon, + chLatin_a, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chColon, + chLatin_u, chLatin_n, chLatin_i, chLatin_x, chNull +};