X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml2%2Fmetadata%2Fimpl%2FMetadataImpl.cpp;h=d6a0cf5e437475a9bb2bdab82539eef3fc314673;hb=e9554c255ad3c91c7c4976e7a1a54905903e66a2;hp=d6f4ce9efcb0ec1f3a9b1bc55eb08bc6194de91c;hpb=93b06f8b77047b399dc173d810d200864abdc4fc;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/saml2/metadata/impl/MetadataImpl.cpp b/saml/saml2/metadata/impl/MetadataImpl.cpp index d6f4ce9..d6a0cf5 100644 --- a/saml/saml2/metadata/impl/MetadataImpl.cpp +++ b/saml/saml2/metadata/impl/MetadataImpl.cpp @@ -1,6 +1,6 @@ /* - * Copyright 2001-2007 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,35 +16,39 @@ /** * MetadataImpl.cpp - * - * Implementation classes for SAML 2.0 Assertions schema + * + * Implementation classes for SAML 2.0 Metadata schema. */ #include "internal.h" #include "exceptions.h" #include "saml2/metadata/Metadata.h" +#include "signature/ContentReference.h" #include #include +#include #include #include #include +#include +#include +#include #include #include #include +#include +using namespace samlconstants; using namespace opensaml::saml2md; using namespace opensaml::saml2; -using namespace opensaml; using namespace xmlencryption; using namespace xmlsignature; using namespace xmltooling; using namespace std; using xmlconstants::XMLSIG_NS; using xmlconstants::XML_BOOL_NULL; -using samlconstants::SAML20_NS; -using samlconstants::SAML20MD_NS; #if defined (_MSC_VER) #pragma warning( push ) @@ -73,40 +77,56 @@ namespace opensaml { public AbstractXMLObjectUnmarshaller { void init() { - m_Lang=NULL; + m_Lang=nullptr; + m_LangPrefix=nullptr; } - + protected: localizedNameTypeImpl() { init(); } - + public: virtual ~localizedNameTypeImpl() { XMLString::release(&m_Lang); + XMLString::release(&m_LangPrefix); } - - localizedNameTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + localizedNameTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + localizedNameTypeImpl(const localizedNameTypeImpl& src) : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { init(); setLang(src.getLang()); + if (src.m_LangPrefix) + m_LangPrefix = XMLString::replicate(src.m_LangPrefix); } - + IMPL_XMLOBJECT_CLONE(localizedNameType); - IMPL_STRING_ATTRIB(Lang); - + IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh); + protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS); + if (m_Lang && *m_Lang) { + DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS,LANG_ATTRIB_NAME); + if (m_LangPrefix && *m_LangPrefix) + attr->setPrefix(m_LangPrefix); + attr->setNodeValue(m_Lang); + domElement->setAttributeNodeNS(attr); + } } void processAttribute(const DOMAttr* attribute) { - PROC_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS); + if (XMLHelper::isNodeNamed(attribute, xmlconstants::XML_NS, LANG_ATTRIB_NAME)) { + setLang(attribute->getValue()); + const XMLCh* temp = attribute->getPrefix(); + if (temp && *temp && !XMLString::equals(temp, xmlconstants::XML_NS)) + m_LangPrefix = XMLString::replicate(temp); + return; + } AbstractXMLObjectUnmarshaller::processAttribute(attribute); } }; @@ -118,40 +138,56 @@ namespace opensaml { public AbstractXMLObjectUnmarshaller { void init() { - m_Lang=NULL; + m_Lang=nullptr; + m_LangPrefix=nullptr; } - + protected: localizedURITypeImpl() { init(); } - + public: virtual ~localizedURITypeImpl() { XMLString::release(&m_Lang); + XMLString::release(&m_LangPrefix); } - - localizedURITypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + localizedURITypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + localizedURITypeImpl(const localizedURITypeImpl& src) : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { init(); setLang(src.getLang()); + if (src.m_LangPrefix) + m_LangPrefix = XMLString::replicate(src.m_LangPrefix); } - + IMPL_XMLOBJECT_CLONE(localizedURIType); - IMPL_STRING_ATTRIB(Lang); - + IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh); + protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS); + if (m_Lang && *m_Lang) { + DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS,LANG_ATTRIB_NAME); + if (m_LangPrefix && *m_LangPrefix) + attr->setPrefix(m_LangPrefix); + attr->setNodeValue(m_Lang); + domElement->setAttributeNodeNS(attr); + } } void processAttribute(const DOMAttr* attribute) { - PROC_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS); + if (XMLHelper::isNodeNamed(attribute, xmlconstants::XML_NS, LANG_ATTRIB_NAME)) { + setLang(attribute->getValue()); + const XMLCh* temp = attribute->getPrefix(); + if (temp && *temp && !XMLString::equals(temp, xmlconstants::XML_NS)) + m_LangPrefix = XMLString::replicate(temp); + return; + } AbstractXMLObjectUnmarshaller::processAttribute(attribute); } }; @@ -160,28 +196,28 @@ namespace opensaml { { public: virtual ~OrganizationNameImpl() {} - - OrganizationNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + OrganizationNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + OrganizationNameImpl(const OrganizationNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(OrganizationName); localizedNameType* clonelocalizedNameType() const { return new OrganizationNameImpl(*this); } }; - + class SAML_DLLLOCAL OrganizationDisplayNameImpl : public virtual OrganizationDisplayName, public localizedNameTypeImpl { public: virtual ~OrganizationDisplayNameImpl() {} - - OrganizationDisplayNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + OrganizationDisplayNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + OrganizationDisplayNameImpl(const OrganizationDisplayNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(OrganizationDisplayName); localizedNameType* clonelocalizedNameType() const { return new OrganizationDisplayNameImpl(*this); @@ -192,12 +228,12 @@ namespace opensaml { { public: virtual ~OrganizationURLImpl() {} - - OrganizationURLImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + OrganizationURLImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + OrganizationURLImpl(const OrganizationURLImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(OrganizationURL); localizedURIType* clonelocalizedURIType() const { return new OrganizationURLImpl(*this); @@ -208,12 +244,12 @@ namespace opensaml { { public: virtual ~ServiceNameImpl() {} - - ServiceNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + ServiceNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + ServiceNameImpl(const ServiceNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(ServiceName); localizedNameType* clonelocalizedNameType() const { return new ServiceNameImpl(*this); @@ -224,12 +260,12 @@ namespace opensaml { { public: virtual ~ServiceDescriptionImpl() {} - - ServiceDescriptionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + ServiceDescriptionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + ServiceDescriptionImpl(const ServiceDescriptionImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(ServiceDescription); localizedNameType* clonelocalizedNameType() const { return new ServiceDescriptionImpl(*this); @@ -244,21 +280,21 @@ namespace opensaml { { public: virtual ~ExtensionsImpl() {} - - ExtensionsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + ExtensionsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { } - + ExtensionsImpl(const ExtensionsImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { VectorOf(XMLObject) v=getUnknownXMLObjects(); for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) v.push_back((*i)->clone()); } - + IMPL_XMLOBJECT_CLONE(Extensions); IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end()); - + protected: void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { // Unknown child. @@ -267,7 +303,7 @@ namespace opensaml { getUnknownXMLObjects().push_back(childXMLObject); return; } - + AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); } }; @@ -281,12 +317,12 @@ namespace opensaml { { list::iterator m_pos_OrganizationDisplayName; list::iterator m_pos_OrganizationURL; - + void init() { - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); - m_Extensions=NULL; + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_Extensions=nullptr; m_pos_Extensions=m_children.begin(); m_pos_OrganizationDisplayName=m_pos_Extensions; ++m_pos_OrganizationDisplayName; @@ -295,12 +331,12 @@ namespace opensaml { } public: virtual ~OrganizationImpl() {} - - OrganizationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + OrganizationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + OrganizationImpl(const OrganizationImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { @@ -326,13 +362,13 @@ namespace opensaml { } } } - + IMPL_XMLOBJECT_CLONE(Organization); IMPL_TYPED_CHILD(Extensions); IMPL_TYPED_CHILDREN(OrganizationName,m_pos_OrganizationDisplayName); IMPL_TYPED_CHILDREN(OrganizationDisplayName,m_pos_OrganizationURL); IMPL_TYPED_CHILDREN(OrganizationURL,m_children.end()); - + protected: void marshallAttributes(DOMElement* domElement) const { marshallExtensionAttributes(domElement); @@ -359,18 +395,18 @@ namespace opensaml { public AbstractXMLObjectUnmarshaller { list::iterator m_pos_TelephoneNumber; - + void init() { - m_ContactType=NULL; - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); - m_Extensions=NULL; - m_Company=NULL; - m_GivenName=NULL; - m_SurName=NULL; + m_ContactType=nullptr; + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_Extensions=nullptr; + m_Company=nullptr; + m_GivenName=nullptr; + m_SurName=nullptr; m_pos_Extensions=m_children.begin(); m_pos_Company=m_pos_Extensions; ++m_pos_Company; @@ -382,13 +418,15 @@ namespace opensaml { ++m_pos_TelephoneNumber; } public: - virtual ~ContactPersonImpl() {} - - ContactPersonImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + virtual ~ContactPersonImpl() { + XMLString::release(&m_ContactType); + } + + ContactPersonImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + ContactPersonImpl(const ContactPersonImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { @@ -401,7 +439,7 @@ namespace opensaml { setGivenName(src.getGivenName()->cloneGivenName()); if (src.getSurName()) setSurName(src.getSurName()->cloneSurName()); - + VectorOf(EmailAddress) v=getEmailAddresss(); for (vector::const_iterator i=src.m_EmailAddresss.begin(); i!=src.m_EmailAddresss.end(); i++) { if (*i) { @@ -415,7 +453,7 @@ namespace opensaml { } } } - + IMPL_XMLOBJECT_CLONE(ContactPerson); IMPL_STRING_ATTRIB(ContactType); IMPL_TYPED_CHILD(Extensions); @@ -424,8 +462,8 @@ namespace opensaml { IMPL_TYPED_CHILD(SurName); IMPL_TYPED_CHILDREN(EmailAddress,m_pos_TelephoneNumber); IMPL_TYPED_CHILDREN(TelephoneNumber,m_children.end()); - - void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) { + + void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) { if (!qualifiedName.hasNamespaceURI()) { if (XMLString::equals(qualifiedName.getLocalPart(),CONTACTTYPE_ATTRIB_NAME)) { setContactType(value); @@ -437,7 +475,7 @@ namespace opensaml { protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_STRING_ATTRIB(ContactType,CONTACTTYPE,NULL); + MARSHALL_STRING_ATTRIB(ContactType,CONTACTTYPE,nullptr); marshallExtensionAttributes(domElement); } @@ -463,34 +501,34 @@ namespace opensaml { public AbstractXMLObjectUnmarshaller { void init() { - m_Namespace=NULL; + m_Namespace=nullptr; } - + public: virtual ~AdditionalMetadataLocationImpl() { XMLString::release(&m_Namespace); } - - AdditionalMetadataLocationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AdditionalMetadataLocationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + AdditionalMetadataLocationImpl(const AdditionalMetadataLocationImpl& src) : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { init(); } - + IMPL_XMLOBJECT_CLONE(AdditionalMetadataLocation); IMPL_STRING_ATTRIB(Namespace); - + 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); AbstractXMLObjectUnmarshaller::processAttribute(attribute); } }; @@ -502,21 +540,21 @@ namespace opensaml { public AbstractXMLObjectUnmarshaller { void init() { - m_Use=NULL; - m_KeyInfo=NULL; - m_children.push_back(NULL); + m_Use=nullptr; + m_KeyInfo=nullptr; + m_children.push_back(nullptr); m_pos_KeyInfo=m_children.begin(); } public: virtual ~KeyDescriptorImpl() { XMLString::release(&m_Use); } - - KeyDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + KeyDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + KeyDescriptorImpl(const KeyDescriptorImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { init(); @@ -530,15 +568,15 @@ namespace opensaml { } } } - + IMPL_XMLOBJECT_CLONE(KeyDescriptor); IMPL_STRING_ATTRIB(Use); IMPL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature); IMPL_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption,m_children.end()); - + protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_STRING_ATTRIB(Use,USE,NULL); + MARSHALL_STRING_ATTRIB(Use,USE,nullptr); } void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { @@ -548,7 +586,7 @@ namespace opensaml { } void processAttribute(const DOMAttr* attribute) { - PROC_STRING_ATTRIB(Use,USE,NULL); + PROC_STRING_ATTRIB(Use,USE,nullptr); AbstractXMLObjectUnmarshaller::processAttribute(attribute); } }; @@ -561,25 +599,25 @@ namespace opensaml { public AbstractXMLObjectUnmarshaller { void init() { - m_Binding=m_Location=m_ResponseLocation=NULL; + m_Binding=m_Location=m_ResponseLocation=nullptr; } - + protected: EndpointTypeImpl() { init(); } - + public: virtual ~EndpointTypeImpl() { XMLString::release(&m_Binding); XMLString::release(&m_Location); XMLString::release(&m_ResponseLocation); } - - EndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + EndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { } - + EndpointTypeImpl(const EndpointTypeImpl& src) : AbstractXMLObject(src), AbstractAttributeExtensibleXMLObject(src), @@ -592,14 +630,14 @@ namespace opensaml { for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) v.push_back((*i)->clone()); } - + IMPL_XMLOBJECT_CLONE(EndpointType); IMPL_STRING_ATTRIB(Binding); IMPL_STRING_ATTRIB(Location); IMPL_STRING_ATTRIB(ResponseLocation); IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end()); - - void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) { + + void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) { if (!qualifiedName.hasNamespaceURI()) { if (XMLString::equals(qualifiedName.getLocalPart(),BINDING_ATTRIB_NAME)) { setBinding(value); @@ -618,9 +656,9 @@ namespace opensaml { } protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_STRING_ATTRIB(Binding,BINDING,NULL); - MARSHALL_STRING_ATTRIB(Location,LOCATION,NULL); - MARSHALL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION,NULL); + MARSHALL_STRING_ATTRIB(Binding,BINDING,nullptr); + MARSHALL_STRING_ATTRIB(Location,LOCATION,nullptr); + MARSHALL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION,nullptr); marshallExtensionAttributes(domElement); } @@ -642,10 +680,10 @@ namespace opensaml { class SAML_DLLLOCAL IndexedEndpointTypeImpl : public virtual IndexedEndpointType, public EndpointTypeImpl { void init() { - m_Index=NULL; + m_Index=nullptr; m_isDefault=XML_BOOL_NULL; } - + protected: IndexedEndpointTypeImpl() { init(); @@ -654,24 +692,24 @@ namespace opensaml { virtual ~IndexedEndpointTypeImpl() { XMLString::release(&m_Index); } - - IndexedEndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + IndexedEndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + IndexedEndpointTypeImpl(const IndexedEndpointTypeImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) { setIndex(src.m_Index); isDefault(src.m_isDefault); } - + IMPL_XMLOBJECT_CLONE(IndexedEndpointType); EndpointType* cloneEndpointType() const { return new IndexedEndpointTypeImpl(*this); } - + IMPL_INTEGER_ATTRIB(Index); IMPL_BOOLEAN_ATTRIB(isDefault); - void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) { + void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) { if (!qualifiedName.hasNamespaceURI()) { if (XMLString::equals(qualifiedName.getLocalPart(),INDEX_ATTRIB_NAME)) { setIndex(value); @@ -684,11 +722,11 @@ namespace opensaml { } EndpointTypeImpl::setAttribute(qualifiedName, value, ID); } - + protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_INTEGER_ATTRIB(Index,INDEX,NULL); - MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL); + MARSHALL_INTEGER_ATTRIB(Index,INDEX,nullptr); + MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,nullptr); EndpointTypeImpl::marshallAttributes(domElement); } }; @@ -697,12 +735,12 @@ namespace opensaml { { public: virtual ~ArtifactResolutionServiceImpl() {} - - ArtifactResolutionServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + ArtifactResolutionServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + ArtifactResolutionServiceImpl(const ArtifactResolutionServiceImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(ArtifactResolutionService); IndexedEndpointType* cloneIndexedEndpointType() const { return new ArtifactResolutionServiceImpl(*this); @@ -716,12 +754,12 @@ namespace opensaml { { public: virtual ~SingleLogoutServiceImpl() {} - - SingleLogoutServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + SingleLogoutServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + SingleLogoutServiceImpl(const SingleLogoutServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(SingleLogoutService); EndpointType* cloneEndpointType() const { return new SingleLogoutServiceImpl(*this); @@ -732,12 +770,12 @@ namespace opensaml { { public: virtual ~ManageNameIDServiceImpl() {} - - ManageNameIDServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + ManageNameIDServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + ManageNameIDServiceImpl(const ManageNameIDServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(ManageNameIDService); EndpointType* cloneEndpointType() const { return new ManageNameIDServiceImpl(*this); @@ -748,12 +786,12 @@ namespace opensaml { { public: virtual ~SingleSignOnServiceImpl() {} - - SingleSignOnServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + SingleSignOnServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + SingleSignOnServiceImpl(const SingleSignOnServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(SingleSignOnService); EndpointType* cloneEndpointType() const { return new SingleSignOnServiceImpl(*this); @@ -764,28 +802,28 @@ namespace opensaml { { public: virtual ~NameIDMappingServiceImpl() {} - - NameIDMappingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + NameIDMappingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + NameIDMappingServiceImpl(const NameIDMappingServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(NameIDMappingService); EndpointType* cloneEndpointType() const { return new NameIDMappingServiceImpl(*this); } }; - + class SAML_DLLLOCAL AssertionIDRequestServiceImpl : public virtual AssertionIDRequestService, public EndpointTypeImpl { public: virtual ~AssertionIDRequestServiceImpl() {} - - AssertionIDRequestServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AssertionIDRequestServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + AssertionIDRequestServiceImpl(const AssertionIDRequestServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(AssertionIDRequestService); EndpointType* cloneEndpointType() const { return new AssertionIDRequestServiceImpl(*this); @@ -796,12 +834,12 @@ namespace opensaml { { public: virtual ~AssertionConsumerServiceImpl() {} - - AssertionConsumerServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AssertionConsumerServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + AssertionConsumerServiceImpl(const AssertionConsumerServiceImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(AssertionConsumerService); EndpointType* cloneEndpointType() const { return new AssertionConsumerServiceImpl(*this); @@ -815,12 +853,12 @@ namespace opensaml { { public: virtual ~AuthnQueryServiceImpl() {} - - AuthnQueryServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AuthnQueryServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + AuthnQueryServiceImpl(const AuthnQueryServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(AuthnQueryService); EndpointType* cloneEndpointType() const { return new AuthnQueryServiceImpl(*this); @@ -831,12 +869,12 @@ namespace opensaml { { public: virtual ~AuthzServiceImpl() {} - - AuthzServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AuthzServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + AuthzServiceImpl(const AuthzServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(AuthzService); EndpointType* cloneEndpointType() const { return new AuthzServiceImpl(*this); @@ -847,12 +885,12 @@ namespace opensaml { { public: virtual ~AttributeServiceImpl() {} - - AttributeServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AttributeServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + AttributeServiceImpl(const AttributeServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(AttributeService); EndpointType* cloneEndpointType() const { return new AttributeServiceImpl(*this); @@ -868,15 +906,15 @@ namespace opensaml { public AbstractXMLObjectUnmarshaller { void init() { - m_ID=m_ProtocolSupportEnumeration=m_ErrorURL=NULL; - m_ValidUntil=m_CacheDuration=NULL; - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); - m_Signature=NULL; - m_Extensions=NULL; - m_Organization=NULL; + m_ID=m_ProtocolSupportEnumeration=m_ErrorURL=nullptr; + m_ValidUntil=m_CacheDuration=nullptr; + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_Signature=nullptr; + m_Extensions=nullptr; + m_Organization=nullptr; m_pos_Signature=m_children.begin(); m_pos_Extensions=m_pos_Signature; ++m_pos_Extensions; @@ -885,14 +923,14 @@ namespace opensaml { m_pos_ContactPerson=m_pos_Organization; ++m_pos_ContactPerson; } - + protected: list::iterator m_pos_ContactPerson; RoleDescriptorImpl() { init(); } - + public: virtual ~RoleDescriptorImpl() { XMLString::release(&m_ID); @@ -901,12 +939,12 @@ namespace opensaml { delete m_ValidUntil; delete m_CacheDuration; } - - RoleDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + RoleDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + RoleDescriptorImpl(const RoleDescriptorImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { @@ -922,7 +960,7 @@ namespace opensaml { setExtensions(src.getExtensions()->cloneExtensions()); if (src.getOrganization()) setOrganization(src.getOrganization()->cloneOrganization()); - + VectorOf(KeyDescriptor) v=getKeyDescriptors(); for (vector::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) { if (*i) { @@ -946,7 +984,7 @@ namespace opensaml { Signature* getSignature() const { return m_Signature; } - + void setSignature(Signature* sig) { prepareForAssignment(m_Signature,sig); *m_pos_Signature=m_Signature=sig; @@ -954,22 +992,24 @@ namespace opensaml { if (m_Signature) m_Signature->setContentReference(new opensaml::ContentReference(*this)); } - - IMPL_ID_ATTRIB(ID); + + IMPL_ID_ATTRIB_EX(ID,ID,nullptr); IMPL_STRING_ATTRIB(ProtocolSupportEnumeration); IMPL_STRING_ATTRIB(ErrorURL); IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX); - IMPL_DATETIME_ATTRIB(CacheDuration,0); + IMPL_DURATION_ATTRIB(CacheDuration,0); IMPL_TYPED_CHILD(Extensions); IMPL_TYPED_CHILDREN(KeyDescriptor,m_pos_Organization); IMPL_TYPED_CHILD(Organization); IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson); bool hasSupport(const XMLCh* protocol) const { + if (!protocol || !*protocol) + return true; if (m_ProtocolSupportEnumeration) { // Look for first character. - unsigned int len=XMLString::stringLen(protocol); - unsigned int pos=0; + xsecsize_t len=XMLString::stringLen(protocol); + xsecsize_t pos=0; int index=XMLString::indexOf(m_ProtocolSupportEnumeration,protocol[0],pos); while (index>=0) { // Only possible match is if it's the first character or a space comes before it. @@ -1007,18 +1047,19 @@ namespace opensaml { setProtocolSupportEnumeration(pse.c_str()); #else auto_ptr_char temp(m_ProtocolSupportEnumeration); + auto_ptr_char temp2(protocol); string pse(temp.get()); - pse = pse + ' ' + protocol; - auto_ptr_XMLCh temp2(pse.c_str()); - setProtocolSupportEnumeration(temp2.get()); + pse = pse + ' ' + temp2.get(); + auto_ptr_XMLCh temp3(pse.c_str()); + setProtocolSupportEnumeration(temp3.get()); #endif } else { setProtocolSupportEnumeration(protocol); } } - - void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) { + + void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) { if (!qualifiedName.hasNamespaceURI()) { if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) { setID(value); @@ -1046,11 +1087,11 @@ namespace opensaml { protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_ID_ATTRIB(ID,ID,NULL); - MARSHALL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION,NULL); - MARSHALL_STRING_ATTRIB(ErrorURL,ERRORURL,NULL); - MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL); - MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL); + MARSHALL_ID_ATTRIB(ID,ID,nullptr); + MARSHALL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION,nullptr); + MARSHALL_STRING_ATTRIB(ErrorURL,ERRORURL,nullptr); + MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr); + MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr); marshallExtensionAttributes(domElement); } @@ -1064,18 +1105,46 @@ namespace opensaml { } void processAttribute(const DOMAttr* attribute) { - PROC_ID_ATTRIB(ID,ID,NULL); + PROC_ID_ATTRIB(ID,ID,nullptr); unmarshallExtensionAttribute(attribute); } }; + class SAML_DLLLOCAL RoleDescriptorTypeImpl : public virtual RoleDescriptorType, public RoleDescriptorImpl + { + public: + virtual ~RoleDescriptorTypeImpl() {} + + RoleDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + } + + RoleDescriptorTypeImpl(const RoleDescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) { + VectorOf(XMLObject) v=getUnknownXMLObjects(); + for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) + v.push_back((*i)->clone()); + } + + IMPL_XMLOBJECT_CLONE(RoleDescriptorType); + RoleDescriptor* cloneRoleDescriptor() const { + return new RoleDescriptorTypeImpl(*this); + } + + IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end()); + + protected: + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { + getUnknownXMLObjects().push_back(childXMLObject); + } + }; + class SAML_DLLLOCAL SSODescriptorTypeImpl : public virtual SSODescriptorType, public RoleDescriptorImpl { void init() { - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); m_pos_ArtifactResolutionService=m_pos_ContactPerson; ++m_pos_ArtifactResolutionService; m_pos_SingleLogoutService=m_pos_ArtifactResolutionService; @@ -1085,25 +1154,25 @@ namespace opensaml { m_pos_NameIDFormat=m_pos_ManageNameIDService; ++m_pos_NameIDFormat; } - + protected: list::iterator m_pos_ArtifactResolutionService; list::iterator m_pos_SingleLogoutService; list::iterator m_pos_ManageNameIDService; list::iterator m_pos_NameIDFormat; - + SSODescriptorTypeImpl() { init(); } - + public: virtual ~SSODescriptorTypeImpl() {} - - SSODescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + SSODescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + SSODescriptorTypeImpl(const SSODescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) { init(); VectorOf(ArtifactResolutionService) v=getArtifactResolutionServices(); @@ -1131,7 +1200,7 @@ namespace opensaml { } } } - + IMPL_TYPED_CHILDREN(ArtifactResolutionService,m_pos_ArtifactResolutionService); IMPL_TYPED_CHILDREN(SingleLogoutService,m_pos_SingleLogoutService); IMPL_TYPED_CHILDREN(ManageNameIDService,m_pos_ManageNameIDService); @@ -1153,13 +1222,13 @@ namespace opensaml { list::iterator m_pos_NameIDMappingService; list::iterator m_pos_AssertionIDRequestService; list::iterator m_pos_AttributeProfile; - + void init() { m_WantAuthnRequestsSigned=XML_BOOL_NULL; - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); m_pos_SingleSignOnService=m_pos_NameIDFormat; ++m_pos_SingleSignOnService; m_pos_NameIDMappingService=m_pos_SingleSignOnService; @@ -1169,15 +1238,15 @@ namespace opensaml { m_pos_AttributeProfile=m_pos_AssertionIDRequestService; ++m_pos_AttributeProfile; } - + public: virtual ~IDPSSODescriptorImpl() {} - - IDPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + IDPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + IDPSSODescriptorImpl(const IDPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) { init(); WantAuthnRequestsSigned(src.m_WantAuthnRequestsSigned); @@ -1212,7 +1281,7 @@ namespace opensaml { } } } - + IMPL_XMLOBJECT_CLONE(IDPSSODescriptor); SSODescriptorType* cloneSSODescriptorType() const { return new IDPSSODescriptorImpl(*this); @@ -1220,7 +1289,7 @@ namespace opensaml { RoleDescriptor* cloneRoleDescriptor() const { return new IDPSSODescriptorImpl(*this); } - + IMPL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned); IMPL_TYPED_CHILDREN(SingleSignOnService,m_pos_SingleSignOnService); IMPL_TYPED_CHILDREN(NameIDMappingService,m_pos_NameIDMappingService); @@ -1228,7 +1297,7 @@ namespace opensaml { IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile); IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end()); - void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) { + void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) { if (!qualifiedName.hasNamespaceURI()) { if (XMLString::equals(qualifiedName.getLocalPart(),WANTAUTHNREQUESTSSIGNED_ATTRIB_NAME)) { setWantAuthnRequestsSigned(value); @@ -1240,10 +1309,10 @@ namespace opensaml { protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,NULL); + MARSHALL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,nullptr); RoleDescriptorImpl::marshallAttributes(domElement); } - + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { PROC_TYPED_CHILDREN(SingleSignOnService,SAML20MD_NS,false); PROC_TYPED_CHILDREN(NameIDMappingService,SAML20MD_NS,false); @@ -1262,7 +1331,7 @@ namespace opensaml { public AbstractXMLObjectUnmarshaller { void init() { - m_Name=m_NameFormat=m_FriendlyName=NULL; + m_Name=m_NameFormat=m_FriendlyName=nullptr; m_isRequired=XML_BOOL_NULL; } public: @@ -1271,12 +1340,12 @@ namespace opensaml { XMLString::release(&m_NameFormat); XMLString::release(&m_FriendlyName); } - - RequestedAttributeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + RequestedAttributeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + RequestedAttributeImpl(const RequestedAttributeImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { @@ -1292,19 +1361,19 @@ namespace opensaml { } } } - + IMPL_XMLOBJECT_CLONE(RequestedAttribute); Attribute* cloneAttribute() const { return new RequestedAttributeImpl(*this); } - + IMPL_STRING_ATTRIB(Name); IMPL_STRING_ATTRIB(NameFormat); IMPL_STRING_ATTRIB(FriendlyName); IMPL_BOOLEAN_ATTRIB(isRequired); IMPL_XMLOBJECT_CHILDREN(AttributeValue,m_children.end()); - - void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) { + + void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) { if (!qualifiedName.hasNamespaceURI()) { if (XMLString::equals(qualifiedName.getLocalPart(),NAME_ATTRIB_NAME)) { setName(value); @@ -1328,10 +1397,10 @@ namespace opensaml { protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_STRING_ATTRIB(Name,NAME,NULL); - MARSHALL_STRING_ATTRIB(NameFormat,NAMEFORMAT,NULL); - MARSHALL_STRING_ATTRIB(FriendlyName,FRIENDLYNAME,NULL); - MARSHALL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,NULL); + MARSHALL_STRING_ATTRIB(Name,NAME,nullptr); + MARSHALL_STRING_ATTRIB(NameFormat,NAMEFORMAT,nullptr); + MARSHALL_STRING_ATTRIB(FriendlyName,FRIENDLYNAME,nullptr); + MARSHALL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,nullptr); marshallExtensionAttributes(domElement); } @@ -1352,12 +1421,12 @@ namespace opensaml { { list::iterator m_pos_ServiceDescription; list::iterator m_pos_RequestedAttribute; - + void init() { - m_Index=NULL; + m_Index=nullptr; m_isDefault=XML_BOOL_NULL; - m_children.push_back(NULL); - m_children.push_back(NULL); + m_children.push_back(nullptr); + m_children.push_back(nullptr); m_pos_ServiceDescription=m_children.begin(); m_pos_RequestedAttribute=m_pos_ServiceDescription; ++m_pos_RequestedAttribute; @@ -1367,12 +1436,12 @@ namespace opensaml { virtual ~AttributeConsumingServiceImpl() { XMLString::release(&m_Index); } - - AttributeConsumingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AttributeConsumingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + AttributeConsumingServiceImpl(const AttributeConsumingServiceImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { init(); @@ -1397,18 +1466,18 @@ namespace opensaml { } } } - + IMPL_XMLOBJECT_CLONE(AttributeConsumingService); IMPL_INTEGER_ATTRIB(Index); IMPL_BOOLEAN_ATTRIB(isDefault); IMPL_TYPED_CHILDREN(ServiceName,m_pos_ServiceDescription); IMPL_TYPED_CHILDREN(ServiceDescription,m_pos_RequestedAttribute); IMPL_TYPED_CHILDREN(RequestedAttribute,m_children.end()); - + protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_INTEGER_ATTRIB(Index,INDEX,NULL); - MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL); + MARSHALL_INTEGER_ATTRIB(Index,INDEX,nullptr); + MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,nullptr); } void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { @@ -1419,8 +1488,8 @@ namespace opensaml { } void processAttribute(const DOMAttr* attribute) { - PROC_INTEGER_ATTRIB(Index,INDEX,NULL); - PROC_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,NULL); + PROC_INTEGER_ATTRIB(Index,INDEX,nullptr); + PROC_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,nullptr); AbstractXMLObjectUnmarshaller::processAttribute(attribute); } }; @@ -1428,23 +1497,23 @@ namespace opensaml { class SAML_DLLLOCAL SPSSODescriptorImpl : public virtual SPSSODescriptor, public SSODescriptorTypeImpl { list::iterator m_pos_AssertionConsumerService; - + void init() { m_AuthnRequestsSigned=XML_BOOL_NULL; m_WantAssertionsSigned=XML_BOOL_NULL; - m_children.push_back(NULL); + m_children.push_back(nullptr); m_pos_AssertionConsumerService=m_pos_NameIDFormat; ++m_pos_AssertionConsumerService; } - + public: virtual ~SPSSODescriptorImpl() {} - - SPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + SPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + SPSSODescriptorImpl(const SPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) { init(); AuthnRequestsSigned(src.m_AuthnRequestsSigned); @@ -1462,7 +1531,7 @@ namespace opensaml { } } } - + IMPL_XMLOBJECT_CLONE(SPSSODescriptor); SSODescriptorType* cloneSSODescriptorType() const { return cloneSPSSODescriptor(); @@ -1470,13 +1539,13 @@ namespace opensaml { RoleDescriptor* cloneRoleDescriptor() const { return cloneSPSSODescriptor(); } - + IMPL_BOOLEAN_ATTRIB(AuthnRequestsSigned); IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned); IMPL_TYPED_CHILDREN(AssertionConsumerService,m_pos_AssertionConsumerService); IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end()); - void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) { + void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) { if (!qualifiedName.hasNamespaceURI()) { if (XMLString::equals(qualifiedName.getLocalPart(),AUTHNREQUESTSSIGNED_ATTRIB_NAME)) { setAuthnRequestsSigned(value); @@ -1492,11 +1561,11 @@ namespace opensaml { protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,NULL); - MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,NULL); + MARSHALL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,nullptr); + MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,nullptr); RoleDescriptorImpl::marshallAttributes(domElement); } - + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { PROC_TYPED_CHILDREN(AssertionConsumerService,SAML20MD_NS,false); PROC_TYPED_CHILDREN(AttributeConsumingService,SAML20MD_NS,false); @@ -1508,24 +1577,24 @@ namespace opensaml { { list::iterator m_pos_AuthnQueryService; list::iterator m_pos_AssertionIDRequestService; - + void init() { - m_children.push_back(NULL); - m_children.push_back(NULL); + m_children.push_back(nullptr); + m_children.push_back(nullptr); m_pos_AuthnQueryService=m_pos_ContactPerson; ++m_pos_AuthnQueryService; m_pos_AssertionIDRequestService=m_pos_AuthnQueryService; ++m_pos_AssertionIDRequestService; } - + public: virtual ~AuthnAuthorityDescriptorImpl() {} - - AuthnAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AuthnAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + AuthnAuthorityDescriptorImpl(const AuthnAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) { init(); VectorOf(AuthnQueryService) v=getAuthnQueryServices(); @@ -1547,12 +1616,12 @@ namespace opensaml { } } } - + IMPL_XMLOBJECT_CLONE(AuthnAuthorityDescriptor); RoleDescriptor* cloneRoleDescriptor() const { return cloneAuthnAuthorityDescriptor(); } - + IMPL_TYPED_CHILDREN(AuthnQueryService,m_pos_AuthnQueryService); IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService); IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end()); @@ -1570,24 +1639,24 @@ namespace opensaml { { list::iterator m_pos_AuthzService; list::iterator m_pos_AssertionIDRequestService; - + void init() { - m_children.push_back(NULL); - m_children.push_back(NULL); + m_children.push_back(nullptr); + m_children.push_back(nullptr); m_pos_AuthzService=m_pos_ContactPerson; ++m_pos_AuthzService; m_pos_AssertionIDRequestService=m_pos_AuthzService; ++m_pos_AssertionIDRequestService; } - + public: virtual ~PDPDescriptorImpl() {} - - PDPDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + PDPDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + PDPDescriptorImpl(const PDPDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) { init(); VectorOf(AuthzService) v=getAuthzServices(); @@ -1609,12 +1678,12 @@ namespace opensaml { } } } - + IMPL_XMLOBJECT_CLONE(PDPDescriptor); RoleDescriptor* cloneRoleDescriptor() const { return clonePDPDescriptor(); } - + IMPL_TYPED_CHILDREN(AuthzService,m_pos_AuthzService); IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService); IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end()); @@ -1634,12 +1703,12 @@ namespace opensaml { list::iterator m_pos_AssertionIDRequestService; list::iterator m_pos_NameIDFormat; list::iterator m_pos_AttributeProfile; - + void init() { - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); m_pos_AttributeService=m_pos_ContactPerson; ++m_pos_AttributeService; m_pos_AssertionIDRequestService=m_pos_AttributeService; @@ -1649,15 +1718,15 @@ namespace opensaml { m_pos_AttributeProfile=m_pos_NameIDFormat; ++m_pos_AttributeProfile; } - + public: virtual ~AttributeAuthorityDescriptorImpl() {} - - AttributeAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AttributeAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + AttributeAuthorityDescriptorImpl(const AttributeAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) { init(); VectorOf(AttributeService) v=getAttributeServices(); @@ -1696,7 +1765,7 @@ namespace opensaml { RoleDescriptor* cloneRoleDescriptor() const { return cloneAttributeAuthorityDescriptor(); } - + IMPL_TYPED_CHILDREN(AttributeService,m_pos_AttributeService); IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService); IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat); @@ -1718,26 +1787,26 @@ namespace opensaml { { void init() { m_WantAssertionsSigned=XML_BOOL_NULL; - m_children.push_back(NULL); + m_children.push_back(nullptr); m_pos_NameIDFormat=m_pos_ContactPerson; ++m_pos_NameIDFormat; } - + protected: list::iterator m_pos_NameIDFormat; - + QueryDescriptorTypeImpl() { init(); } - + public: virtual ~QueryDescriptorTypeImpl() {} - - QueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + QueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + QueryDescriptorTypeImpl(const QueryDescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) { init(); WantAssertionsSigned(src.m_WantAssertionsSigned); @@ -1748,11 +1817,11 @@ namespace opensaml { } } } - + IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned); IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat); - void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) { + void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) { if (!qualifiedName.hasNamespaceURI()) { if (XMLString::equals(qualifiedName.getLocalPart(),WANTASSERTIONSSIGNED_ATTRIB_NAME)) { setWantAssertionsSigned(value); @@ -1764,7 +1833,7 @@ namespace opensaml { protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,NULL); + MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,nullptr); RoleDescriptorImpl::marshallAttributes(domElement); } @@ -1778,12 +1847,12 @@ namespace opensaml { { public: virtual ~AuthnQueryDescriptorTypeImpl() {} - - AuthnQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AuthnQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + AuthnQueryDescriptorTypeImpl(const AuthnQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {} - + IMPL_XMLOBJECT_CLONE(AuthnQueryDescriptorType); QueryDescriptorType* cloneQueryDescriptorType() const { return new AuthnQueryDescriptorTypeImpl(*this); @@ -1797,10 +1866,10 @@ namespace opensaml { { public: virtual ~AttributeQueryDescriptorTypeImpl() {} - - AttributeQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AttributeQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + AttributeQueryDescriptorTypeImpl(const AttributeQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) { VectorOf(AttributeConsumingService) w=getAttributeConsumingServices(); @@ -1810,7 +1879,7 @@ namespace opensaml { } } } - + IMPL_XMLOBJECT_CLONE(AttributeQueryDescriptorType); QueryDescriptorType* cloneQueryDescriptorType() const { return new AttributeQueryDescriptorTypeImpl(*this); @@ -1818,7 +1887,7 @@ namespace opensaml { RoleDescriptor* cloneRoleDescriptor() const { return new AttributeQueryDescriptorTypeImpl(*this); } - + IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end()); protected: @@ -1832,10 +1901,10 @@ namespace opensaml { { public: virtual ~AuthzDecisionQueryDescriptorTypeImpl() {} - - AuthzDecisionQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AuthzDecisionQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} - + AuthzDecisionQueryDescriptorTypeImpl(const AuthzDecisionQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) { VectorOf(ActionNamespace) w=getActionNamespaces(); @@ -1845,7 +1914,7 @@ namespace opensaml { } } } - + IMPL_XMLOBJECT_CLONE(AuthzDecisionQueryDescriptorType); QueryDescriptorType* cloneQueryDescriptorType() const { return new AuthzDecisionQueryDescriptorTypeImpl(*this); @@ -1853,7 +1922,7 @@ namespace opensaml { RoleDescriptor* cloneRoleDescriptor() const { return new AuthzDecisionQueryDescriptorTypeImpl(*this); } - + IMPL_TYPED_CHILDREN(ActionNamespace,m_children.end()); protected: @@ -1874,20 +1943,20 @@ namespace opensaml { list::iterator m_pos_AffiliateMember; void init() { - m_ID=m_AffiliationOwnerID=NULL; - m_ValidUntil=m_CacheDuration=NULL; - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); - m_Signature=NULL; - m_Extensions=NULL; + m_ID=m_AffiliationOwnerID=nullptr; + m_ValidUntil=m_CacheDuration=nullptr; + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_Signature=nullptr; + m_Extensions=nullptr; m_pos_Signature=m_children.begin(); m_pos_Extensions=m_pos_Signature; ++m_pos_Extensions; m_pos_AffiliateMember=m_pos_Extensions; ++m_pos_AffiliateMember; } - + public: virtual ~AffiliationDescriptorImpl() { XMLString::release(&m_ID); @@ -1895,12 +1964,12 @@ namespace opensaml { delete m_ValidUntil; delete m_CacheDuration; } - - AffiliationDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + AffiliationDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + AffiliationDescriptorImpl(const AffiliationDescriptorImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { @@ -1913,7 +1982,7 @@ namespace opensaml { setSignature(src.getSignature()->cloneSignature()); if (src.getExtensions()) setExtensions(src.getExtensions()->cloneExtensions()); - + VectorOf(KeyDescriptor) v=getKeyDescriptors(); for (vector::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) { if (*i) { @@ -1939,7 +2008,7 @@ namespace opensaml { Signature* getSignature() const { return m_Signature; } - + void setSignature(Signature* sig) { prepareForAssignment(m_Signature,sig); *m_pos_Signature=m_Signature=sig; @@ -1947,16 +2016,16 @@ namespace opensaml { if (m_Signature) m_Signature->setContentReference(new opensaml::ContentReference(*this)); } - - IMPL_ID_ATTRIB(ID); + + IMPL_ID_ATTRIB_EX(ID,ID,nullptr); IMPL_STRING_ATTRIB(AffiliationOwnerID); IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX); - IMPL_DATETIME_ATTRIB(CacheDuration,0); + IMPL_DURATION_ATTRIB(CacheDuration,0); IMPL_TYPED_CHILD(Extensions); IMPL_TYPED_CHILDREN(AffiliateMember,m_pos_AffiliateMember); IMPL_TYPED_CHILDREN(KeyDescriptor,m_children.end()); - - void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) { + + void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) { if (!qualifiedName.hasNamespaceURI()) { if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) { setID(value); @@ -1980,10 +2049,10 @@ namespace opensaml { protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_ID_ATTRIB(ID,ID,NULL); - MARSHALL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID,NULL); - MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL); - MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL); + MARSHALL_ID_ATTRIB(ID,ID,nullptr); + MARSHALL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID,nullptr); + MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr); + MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr); marshallExtensionAttributes(domElement); } @@ -1996,7 +2065,7 @@ namespace opensaml { } void processAttribute(const DOMAttr* attribute) { - PROC_ID_ATTRIB(ID,ID,NULL); + PROC_ID_ATTRIB(ID,ID,nullptr); unmarshallExtensionAttribute(attribute); } }; @@ -2012,17 +2081,17 @@ namespace opensaml { list::iterator m_pos_ContactPerson; void init() { - m_ID=m_EntityID=NULL; - m_ValidUntil=m_CacheDuration=NULL; - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); - m_children.push_back(NULL); - m_Signature=NULL; - m_Extensions=NULL; - m_AffiliationDescriptor=NULL; - m_Organization=NULL; + m_ID=m_EntityID=nullptr; + m_ValidUntil=m_CacheDuration=nullptr; + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_Signature=nullptr; + m_Extensions=nullptr; + m_AffiliationDescriptor=nullptr; + m_Organization=nullptr; m_pos_Signature=m_children.begin(); m_pos_Extensions=m_pos_Signature; ++m_pos_Extensions; @@ -2033,7 +2102,7 @@ namespace opensaml { m_pos_ContactPerson=m_pos_Organization; ++m_pos_ContactPerson; } - + public: virtual ~EntityDescriptorImpl() { XMLString::release(&m_ID); @@ -2041,12 +2110,12 @@ namespace opensaml { delete m_ValidUntil; delete m_CacheDuration; } - - EntityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + EntityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + EntityDescriptorImpl(const EntityDescriptorImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { @@ -2063,7 +2132,7 @@ namespace opensaml { setAffiliationDescriptor(src.getAffiliationDescriptor()->cloneAffiliationDescriptor()); if (src.getOrganization()) setOrganization(src.getOrganization()->cloneOrganization()); - + for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { if (*i) { IDPSSODescriptor* idp=dynamic_cast(*i); @@ -2071,7 +2140,7 @@ namespace opensaml { getIDPSSODescriptors().push_back(idp->cloneIDPSSODescriptor()); continue; } - + SPSSODescriptor* sp=dynamic_cast(*i); if (sp) { getSPSSODescriptors().push_back(sp->cloneSPSSODescriptor()); @@ -2095,7 +2164,7 @@ namespace opensaml { getPDPDescriptors().push_back(pdp->clonePDPDescriptor()); continue; } - + AuthnQueryDescriptorType* authnq=dynamic_cast(*i); if (authnq) { getAuthnQueryDescriptorTypes().push_back(authnq->cloneAuthnQueryDescriptorType()); @@ -2147,7 +2216,7 @@ namespace opensaml { Signature* getSignature() const { return m_Signature; } - + void setSignature(Signature* sig) { prepareForAssignment(m_Signature,sig); *m_pos_Signature=m_Signature=sig; @@ -2155,11 +2224,11 @@ namespace opensaml { if (m_Signature) m_Signature->setContentReference(new opensaml::ContentReference(*this)); } - - IMPL_ID_ATTRIB(ID); + + IMPL_ID_ATTRIB_EX(ID,ID,nullptr); IMPL_STRING_ATTRIB(EntityID); IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX); - IMPL_DATETIME_ATTRIB(CacheDuration,0); + IMPL_DURATION_ATTRIB(CacheDuration,0); IMPL_TYPED_CHILD(Extensions); IMPL_TYPED_CHILDREN(RoleDescriptor,m_pos_AffiliationDescriptor); IMPL_TYPED_CHILDREN(IDPSSODescriptor,m_pos_AffiliationDescriptor); @@ -2174,8 +2243,8 @@ namespace opensaml { IMPL_TYPED_CHILD(Organization); IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson); IMPL_TYPED_CHILDREN(AdditionalMetadataLocation,m_children.end()); - - void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) { + + void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) { if (!qualifiedName.hasNamespaceURI()) { if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) { setID(value); @@ -2197,113 +2266,36 @@ namespace opensaml { AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID); } - const IDPSSODescriptor* getIDPSSODescriptor(const XMLCh* protocol) const { - for (vector::const_iterator i=m_IDPSSODescriptors.begin(); i!=m_IDPSSODescriptors.end(); i++) { - if ((*i)->hasSupport(protocol) && (*i)->isValid()) - return (*i); - } - return NULL; - } - - const SPSSODescriptor* getSPSSODescriptor(const XMLCh* protocol) const { - for (vector::const_iterator i=m_SPSSODescriptors.begin(); i!=m_SPSSODescriptors.end(); i++) { - if ((*i)->hasSupport(protocol) && (*i)->isValid()) - return (*i); - } - return NULL; - } - - const AuthnAuthorityDescriptor* getAuthnAuthorityDescriptor(const XMLCh* protocol) const { - for (vector::const_iterator i=m_AuthnAuthorityDescriptors.begin(); i!=m_AuthnAuthorityDescriptors.end(); i++) { - if ((*i)->hasSupport(protocol) && (*i)->isValid()) - return (*i); - } - return NULL; - } - - const AttributeAuthorityDescriptor* getAttributeAuthorityDescriptor(const XMLCh* protocol) const { - for (vector::const_iterator i=m_AttributeAuthorityDescriptors.begin(); i!=m_AttributeAuthorityDescriptors.end(); i++) { - if ((*i)->hasSupport(protocol) && (*i)->isValid()) - return (*i); - } - return NULL; - } - - const PDPDescriptor* getPDPDescriptor(const XMLCh* protocol) const { - for (vector::const_iterator i=m_PDPDescriptors.begin(); i!=m_PDPDescriptors.end(); i++) { - if ((*i)->hasSupport(protocol) && (*i)->isValid()) - return (*i); - } - return NULL; - } - - const AuthnQueryDescriptorType* getAuthnQueryDescriptorType(const XMLCh* protocol) const { - for (vector::const_iterator i=m_AuthnQueryDescriptorTypes.begin(); i!=m_AuthnQueryDescriptorTypes.end(); i++) { - if ((*i)->hasSupport(protocol) && (*i)->isValid()) - return (*i); - } - return NULL; - } - - const AttributeQueryDescriptorType* getAttributeQueryDescriptorType(const XMLCh* protocol) const { - for (vector::const_iterator i=m_AttributeQueryDescriptorTypes.begin(); i!=m_AttributeQueryDescriptorTypes.end(); i++) { - if ((*i)->hasSupport(protocol) && (*i)->isValid()) - return (*i); - } - return NULL; - } - - const AuthzDecisionQueryDescriptorType* getAuthzDecisionQueryDescriptorType(const XMLCh* protocol) const { - for (vector::const_iterator i=m_AuthzDecisionQueryDescriptorTypes.begin(); i!=m_AuthzDecisionQueryDescriptorTypes.end(); i++) { - if ((*i)->hasSupport(protocol) && (*i)->isValid()) - return (*i); - } - return NULL; - } - const RoleDescriptor* getRoleDescriptor(const xmltooling::QName& qname, const XMLCh* protocol) const { // Check for "known" elements/types. - QName q; - q.setNamespaceURI(SAML20MD_NS); - q.setLocalPart(IDPSSODescriptor::LOCAL_NAME); - if (q == qname) - return getIDPSSODescriptor(protocol); - q.setLocalPart(SPSSODescriptor::LOCAL_NAME); - if (q == qname) - return getSPSSODescriptor(protocol); - q.setLocalPart(AuthnAuthorityDescriptor::LOCAL_NAME); - if (q == qname) - return getAuthnAuthorityDescriptor(protocol); - q.setLocalPart(AttributeAuthorityDescriptor::LOCAL_NAME); - if (q == qname) - return getAttributeAuthorityDescriptor(protocol); - q.setLocalPart(PDPDescriptor::LOCAL_NAME); - if (q == qname) - return getPDPDescriptor(protocol); - q.setNamespaceURI(samlconstants::SAML20MD_QUERY_EXT_NS); - q.setLocalPart(AuthnQueryDescriptorType::TYPE_NAME); - if (q == qname) - return getAuthnQueryDescriptorType(protocol); - q.setLocalPart(AttributeQueryDescriptorType::TYPE_NAME); - if (q == qname) - return getAttributeQueryDescriptorType(protocol); - q.setLocalPart(AuthzDecisionQueryDescriptorType::TYPE_NAME); - if (q == qname) - return getAuthzDecisionQueryDescriptorType(protocol); - - for (vector::const_iterator i=m_RoleDescriptors.begin(); i!=m_RoleDescriptors.end(); i++) { - if ((*i)->getSchemaType() && qname==(*((*i)->getSchemaType())) && (*i)->hasSupport(protocol) && (*i)->isValid()) - return (*i); - } - return NULL; + if (qname == IDPSSODescriptor::ELEMENT_QNAME) + return find_if(m_IDPSSODescriptors, isValidForProtocol(protocol)); + if (qname == SPSSODescriptor::ELEMENT_QNAME) + return find_if(m_SPSSODescriptors, isValidForProtocol(protocol)); + if (qname == AuthnAuthorityDescriptor::ELEMENT_QNAME) + return find_if(m_AuthnAuthorityDescriptors, isValidForProtocol(protocol)); + if (qname == AttributeAuthorityDescriptor::ELEMENT_QNAME) + return find_if(m_AttributeAuthorityDescriptors, isValidForProtocol(protocol)); + if (qname == PDPDescriptor::ELEMENT_QNAME) + return find_if(m_PDPDescriptors, isValidForProtocol(protocol)); + if (qname == AuthnQueryDescriptorType::TYPE_QNAME) + return find_if(m_AuthnQueryDescriptorTypes, isValidForProtocol(protocol)); + if (qname == AttributeQueryDescriptorType::TYPE_QNAME) + return find_if(m_AttributeQueryDescriptorTypes, isValidForProtocol(protocol)); + if (qname == AuthzDecisionQueryDescriptorType::TYPE_QNAME) + return find_if(m_AuthzDecisionQueryDescriptorTypes, isValidForProtocol(protocol)); + + vector::const_iterator i = + find_if(m_RoleDescriptors.begin(), m_RoleDescriptors.end(), ofTypeValidForProtocol(qname,protocol)); + return (i!=m_RoleDescriptors.end()) ? *i : nullptr; } protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_ID_ATTRIB(ID,ID,NULL); - MARSHALL_STRING_ATTRIB(EntityID,ENTITYID,NULL); - MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL); - MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL); + MARSHALL_ID_ATTRIB(ID,ID,nullptr); + MARSHALL_STRING_ATTRIB(EntityID,ENTITYID,nullptr); + MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr); + MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr); marshallExtensionAttributes(domElement); } @@ -2327,7 +2319,7 @@ namespace opensaml { } void processAttribute(const DOMAttr* attribute) { - PROC_ID_ATTRIB(ID,ID,NULL); + PROC_ID_ATTRIB(ID,ID,nullptr); unmarshallExtensionAttribute(attribute); } }; @@ -2340,17 +2332,17 @@ namespace opensaml { public AbstractXMLObjectUnmarshaller { void init() { - m_ID=m_Name=NULL; - m_ValidUntil=m_CacheDuration=NULL; - m_children.push_back(NULL); - m_children.push_back(NULL); - m_Signature=NULL; - m_Extensions=NULL; + m_ID=m_Name=nullptr; + m_ValidUntil=m_CacheDuration=nullptr; + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_Signature=nullptr; + m_Extensions=nullptr; m_pos_Signature=m_children.begin(); m_pos_Extensions=m_pos_Signature; ++m_pos_Extensions; } - + public: virtual ~EntitiesDescriptorImpl() { XMLString::release(&m_ID); @@ -2358,12 +2350,12 @@ namespace opensaml { delete m_ValidUntil; delete m_CacheDuration; } - - EntitiesDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + + EntitiesDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - + EntitiesDescriptorImpl(const EntitiesDescriptorImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { init(); @@ -2375,7 +2367,7 @@ namespace opensaml { setSignature(src.getSignature()->cloneSignature()); if (src.getExtensions()) setExtensions(src.getExtensions()->cloneExtensions()); - + for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { if (*i) { EntityDescriptor* e=dynamic_cast(*i); @@ -2383,7 +2375,7 @@ namespace opensaml { getEntityDescriptors().push_back(e->cloneEntityDescriptor()); continue; } - + EntitiesDescriptor* es=dynamic_cast(*i); if (es) { getEntitiesDescriptors().push_back(es->cloneEntitiesDescriptor()); @@ -2404,7 +2396,7 @@ namespace opensaml { Signature* getSignature() const { return m_Signature; } - + void setSignature(Signature* sig) { prepareForAssignment(m_Signature,sig); *m_pos_Signature=m_Signature=sig; @@ -2412,21 +2404,21 @@ namespace opensaml { if (m_Signature) m_Signature->setContentReference(new opensaml::ContentReference(*this)); } - - IMPL_ID_ATTRIB(ID); + + IMPL_ID_ATTRIB_EX(ID,ID,nullptr); IMPL_STRING_ATTRIB(Name); IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX); - IMPL_DATETIME_ATTRIB(CacheDuration,0); + IMPL_DURATION_ATTRIB(CacheDuration,0); IMPL_TYPED_CHILD(Extensions); IMPL_TYPED_CHILDREN(EntityDescriptor,m_children.end()); IMPL_TYPED_CHILDREN(EntitiesDescriptor,m_children.end()); - + protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_ID_ATTRIB(ID,ID,NULL); - MARSHALL_STRING_ATTRIB(Name,NAME,NULL); - MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL); - MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL); + MARSHALL_ID_ATTRIB(ID,ID,nullptr); + MARSHALL_STRING_ATTRIB(Name,NAME,nullptr); + MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr); + MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr); } void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { @@ -2438,13 +2430,57 @@ namespace opensaml { } void processAttribute(const DOMAttr* attribute) { - PROC_ID_ATTRIB(ID,ID,NULL); - PROC_STRING_ATTRIB(Name,NAME,NULL); - PROC_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL); - PROC_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL); + PROC_ID_ATTRIB(ID,ID,nullptr); + PROC_STRING_ATTRIB(Name,NAME,nullptr); + PROC_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr); + PROC_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr); } }; + class SAML_DLLLOCAL EntityAttributesImpl : public virtual EntityAttributes, + public AbstractComplexElement, + public AbstractDOMCachingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + public: + virtual ~EntityAttributesImpl() {} + + EntityAttributesImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + } + + EntityAttributesImpl(const EntityAttributesImpl& src) + : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { + for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { + if (*i) { + Attribute* a=dynamic_cast(*i); + if (a) { + getAttributes().push_back(a->cloneAttribute()); + continue; + } + + saml2::Assertion* as=dynamic_cast(*i); + if (as) { + getAssertions().push_back(as->cloneAssertion()); + continue; + } + } + } + } + + IMPL_XMLOBJECT_CLONE(EntityAttributes); + + IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end()); + IMPL_TYPED_FOREIGN_CHILDREN(Assertion,saml2,m_children.end()); + + protected: + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { + PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false); + PROC_TYPED_FOREIGN_CHILDREN(Assertion,saml2,SAML20_NS,false); + AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); + } + }; }; }; @@ -2452,6 +2488,15 @@ namespace opensaml { #pragma warning( pop ) #endif +IMPL_ELEMENT_QNAME(IDPSSODescriptor, SAML20MD_NS, SAML20MD_PREFIX); +IMPL_ELEMENT_QNAME(SPSSODescriptor, SAML20MD_NS, SAML20MD_PREFIX); +IMPL_ELEMENT_QNAME(AuthnAuthorityDescriptor, SAML20MD_NS, SAML20MD_PREFIX); +IMPL_ELEMENT_QNAME(AttributeAuthorityDescriptor, SAML20MD_NS, SAML20MD_PREFIX); +IMPL_ELEMENT_QNAME(PDPDescriptor, SAML20MD_NS, SAML20MD_PREFIX); +IMPL_TYPE_QNAME(AuthnQueryDescriptorType, SAML20MD_QUERY_EXT_NS, SAML20MD_QUERY_EXT_PREFIX); +IMPL_TYPE_QNAME(AttributeQueryDescriptorType, SAML20MD_QUERY_EXT_NS, SAML20MD_QUERY_EXT_PREFIX); +IMPL_TYPE_QNAME(AuthzDecisionQueryDescriptorType, SAML20MD_QUERY_EXT_NS, SAML20MD_QUERY_EXT_PREFIX); + // Builder Implementations IMPL_XMLOBJECTBUILDER(AdditionalMetadataLocation); @@ -2502,6 +2547,18 @@ IMPL_XMLOBJECTBUILDER(TelephoneNumber); IMPL_XMLOBJECTBUILDER(ActionNamespace); IMPL_XMLOBJECTBUILDER(SourceID); +IMPL_XMLOBJECTBUILDER(EntityAttributes); + +#ifdef HAVE_COVARIANT_RETURNS +RoleDescriptor* RoleDescriptorBuilder::buildObject( +#else +xmltooling::XMLObject* RoleDescriptorBuilder::buildObject( +#endif + const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType + ) const +{ + return new RoleDescriptorTypeImpl(nsURI,localName,prefix,schemaType); +} const XMLCh ActionNamespace::LOCAL_NAME[] = UNICODE_LITERAL_15(A,c,t,i,o,n,N,a,m,e,s,p,a,c,e); const XMLCh AdditionalMetadataLocation::LOCAL_NAME[] = UNICODE_LITERAL_26(A,d,d,i,t,i,o,n,a,l,M,e,t,a,d,a,t,a,L,o,c,a,t,i,o,n); @@ -2557,6 +2614,8 @@ const XMLCh EntityDescriptor::LOCAL_NAME[] = UNICODE_LITERAL_16(E,n,t const XMLCh EntityDescriptor::TYPE_NAME[] = UNICODE_LITERAL_20(E,n,t,i,t,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e); const XMLCh EntityDescriptor::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,D); const XMLCh EntityDescriptor::ENTITYID_ATTRIB_NAME[] = UNICODE_LITERAL_8(e,n,t,i,t,y,I,D); +const XMLCh EntityAttributes::LOCAL_NAME[] = UNICODE_LITERAL_16(E,n,t,i,t,y,A,t,t,r,i,b,u,t,e,s); +const XMLCh EntityAttributes::TYPE_NAME[] = UNICODE_LITERAL_20(E,n,t,i,t,y,A,t,t,r,i,b,u,t,e,s,T,y,p,e); const XMLCh Extensions::LOCAL_NAME[] = UNICODE_LITERAL_10(E,x,t,e,n,s,i,o,n,s); const XMLCh Extensions::TYPE_NAME[] = UNICODE_LITERAL_14(E,x,t,e,n,s,i,o,n,s,T,y,p,e); const XMLCh GivenName::LOCAL_NAME[] = UNICODE_LITERAL_9(G,i,v,e,n,N,a,m,e);