X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml2%2Fmetadata%2Fimpl%2FMetadataImpl.cpp;h=1c83f01abaa47c238187a442a0e0eff6dd5b2a36;hb=1d326093b9787328ea03b211bab6357f9b9448fd;hp=ab2851914b87631d91fafde9eeab83dafd53a2b3;hpb=bf2b5d5ecfa3f2e377305c18c731a2b8274a6591;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/saml2/metadata/impl/MetadataImpl.cpp b/saml/saml2/metadata/impl/MetadataImpl.cpp index ab28519..1c83f01 100644 --- a/saml/saml2/metadata/impl/MetadataImpl.cpp +++ b/saml/saml2/metadata/impl/MetadataImpl.cpp @@ -1,17 +1,21 @@ -/* - * Copyright 2001-2010 Internet2 +/** + * Licensed to the University Corporation for Advanced Internet + * Development, Inc. (UCAID) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. * - * 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 + * UCAID licenses this file to you 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 * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. */ /** @@ -40,14 +44,14 @@ #include #include +#include +#include +#include #include #include using namespace samlconstants; using namespace opensaml::saml2md; -using namespace opensaml::saml2; -using namespace xmlencryption; -using namespace xmlsignature; using namespace xmltooling; using namespace std; using xmlconstants::XMLSIG_NS; @@ -106,20 +110,23 @@ namespace opensaml { 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); + void _clone(const localizedNameTypeImpl& src) { + IMPL_CLONE_FOREIGN_ATTRIB(Lang); + } + + IMPL_XMLOBJECT_CLONE_EX(localizedNameType); IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh); protected: void marshallAttributes(DOMElement* domElement) const { if (m_Lang && *m_Lang) { - DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS,LANG_ATTRIB_NAME); + DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS, LANG_ATTRIB_NAME); if (m_LangPrefix && *m_LangPrefix) attr->setPrefix(m_LangPrefix); + else + attr->setPrefix(xmlconstants::XML_PREFIX); attr->setNodeValue(m_Lang); domElement->setAttributeNodeNS(attr); } @@ -167,20 +174,23 @@ namespace opensaml { 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); + void _clone(const localizedURITypeImpl& src) { + IMPL_CLONE_FOREIGN_ATTRIB(Lang); + } + + IMPL_XMLOBJECT_CLONE_EX(localizedURIType); IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh); protected: void marshallAttributes(DOMElement* domElement) const { if (m_Lang && *m_Lang) { - DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS,LANG_ATTRIB_NAME); + DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS, LANG_ATTRIB_NAME); if (m_LangPrefix && *m_LangPrefix) attr->setPrefix(m_LangPrefix); + else + attr->setPrefix(xmlconstants::XML_PREFIX); attr->setNodeValue(m_Lang); domElement->setAttributeNodeNS(attr); } @@ -208,10 +218,7 @@ namespace opensaml { OrganizationNameImpl(const OrganizationNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(OrganizationName); - localizedNameType* clonelocalizedNameType() const { - return new OrganizationNameImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(OrganizationName); }; class SAML_DLLLOCAL OrganizationDisplayNameImpl : public virtual OrganizationDisplayName, public localizedNameTypeImpl @@ -224,10 +231,7 @@ namespace opensaml { OrganizationDisplayNameImpl(const OrganizationDisplayNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(OrganizationDisplayName); - localizedNameType* clonelocalizedNameType() const { - return new OrganizationDisplayNameImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(OrganizationDisplayName); }; class SAML_DLLLOCAL OrganizationURLImpl : public virtual OrganizationURL, public localizedURITypeImpl @@ -240,10 +244,7 @@ namespace opensaml { OrganizationURLImpl(const OrganizationURLImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(OrganizationURL); - localizedURIType* clonelocalizedURIType() const { - return new OrganizationURLImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(OrganizationURL); }; class SAML_DLLLOCAL ServiceNameImpl : public virtual ServiceName, public localizedNameTypeImpl @@ -256,10 +257,7 @@ namespace opensaml { ServiceNameImpl(const ServiceNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(ServiceName); - localizedNameType* clonelocalizedNameType() const { - return new ServiceNameImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(ServiceName); }; class SAML_DLLLOCAL ServiceDescriptionImpl : public virtual ServiceDescription, public localizedNameTypeImpl @@ -272,10 +270,7 @@ namespace opensaml { ServiceDescriptionImpl(const ServiceDescriptionImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(ServiceDescription); - localizedNameType* clonelocalizedNameType() const { - return new ServiceDescriptionImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(ServiceDescription); }; class SAML_DLLLOCAL ExtensionsImpl : public virtual Extensions, @@ -293,9 +288,7 @@ namespace opensaml { 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_CLONE_XMLOBJECT_CHILDREN(UnknownXMLObject); } IMPL_XMLOBJECT_CLONE(Extensions); @@ -335,6 +328,7 @@ namespace opensaml { m_pos_OrganizationURL=m_pos_OrganizationDisplayName; ++m_pos_OrganizationURL; } + public: virtual ~OrganizationImpl() {} @@ -347,26 +341,10 @@ namespace opensaml { : AbstractXMLObject(src), AbstractComplexElement(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { init(); - if (src.getExtensions()) - setExtensions(src.getExtensions()->cloneExtensions()); - VectorOf(OrganizationName) v=getOrganizationNames(); - for (vector::const_iterator i=src.m_OrganizationNames.begin(); i!=src.m_OrganizationNames.end(); i++) { - if (*i) { - v.push_back((*i)->cloneOrganizationName()); - } - } - VectorOf(OrganizationDisplayName) w=getOrganizationDisplayNames(); - for (vector::const_iterator j=src.m_OrganizationDisplayNames.begin(); j!=src.m_OrganizationDisplayNames.end(); j++) { - if (*j) { - w.push_back((*j)->cloneOrganizationDisplayName()); - } - } - VectorOf(OrganizationURL) x=getOrganizationURLs(); - for (vector::const_iterator k=src.m_OrganizationURLs.begin(); k!=src.m_OrganizationURLs.end(); k++) { - if (*k) { - x.push_back((*k)->cloneOrganizationURL()); - } - } + IMPL_CLONE_TYPED_CHILD(Extensions); + IMPL_CLONE_TYPED_CHILDREN(OrganizationName); + IMPL_CLONE_TYPED_CHILDREN(OrganizationDisplayName); + IMPL_CLONE_TYPED_CHILDREN(OrganizationURL); } IMPL_XMLOBJECT_CLONE(Organization); @@ -423,6 +401,7 @@ namespace opensaml { m_pos_TelephoneNumber=m_pos_SurName; ++m_pos_TelephoneNumber; } + public: virtual ~ContactPersonImpl() { XMLString::release(&m_ContactType); @@ -437,27 +416,13 @@ namespace opensaml { : AbstractXMLObject(src), AbstractComplexElement(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { init(); - if (src.getExtensions()) - setExtensions(src.getExtensions()->cloneExtensions()); - if (src.getCompany()) - setCompany(src.getCompany()->cloneCompany()); - if (src.getGivenName()) - 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) { - v.push_back((*i)->cloneEmailAddress()); - } - } - VectorOf(TelephoneNumber) w=getTelephoneNumbers(); - for (vector::const_iterator j=src.m_TelephoneNumbers.begin(); j!=src.m_TelephoneNumbers.end(); j++) { - if (*j) { - w.push_back((*j)->cloneTelephoneNumber()); - } - } + IMPL_CLONE_ATTRIB(ContactType); + IMPL_CLONE_TYPED_CHILD(Extensions); + IMPL_CLONE_TYPED_CHILD(Company); + IMPL_CLONE_TYPED_CHILD(GivenName); + IMPL_CLONE_TYPED_CHILD(SurName); + IMPL_CLONE_TYPED_CHILDREN(EmailAddress); + IMPL_CLONE_TYPED_CHILDREN(TelephoneNumber); } IMPL_XMLOBJECT_CLONE(ContactPerson); @@ -523,6 +488,7 @@ namespace opensaml { AdditionalMetadataLocationImpl(const AdditionalMetadataLocationImpl& src) : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { init(); + IMPL_CLONE_ATTRIB(Namespace); } IMPL_XMLOBJECT_CLONE(AdditionalMetadataLocation); @@ -551,6 +517,7 @@ namespace opensaml { m_children.push_back(nullptr); m_pos_KeyInfo=m_children.begin(); } + public: virtual ~KeyDescriptorImpl() { XMLString::release(&m_Use); @@ -564,15 +531,9 @@ namespace opensaml { KeyDescriptorImpl(const KeyDescriptorImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { init(); - setUse(src.getUse()); - if (src.getKeyInfo()) - setKeyInfo(src.getKeyInfo()->cloneKeyInfo()); - VectorOf(EncryptionMethod) v=getEncryptionMethods(); - for (vector::const_iterator i=src.m_EncryptionMethods.begin(); i!=src.m_EncryptionMethods.end(); i++) { - if (*i) { - v.push_back((*i)->cloneEncryptionMethod()); - } - } + IMPL_CLONE_ATTRIB(Use); + IMPL_CLONE_TYPED_CHILD(KeyInfo); + IMPL_CLONE_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption); } IMPL_XMLOBJECT_CLONE(KeyDescriptor); @@ -621,7 +582,8 @@ namespace opensaml { } EndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); } EndpointTypeImpl(const EndpointTypeImpl& src) @@ -629,15 +591,17 @@ namespace opensaml { AbstractAttributeExtensibleXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { - setBinding(src.getBinding()); - setLocation(src.getLocation()); - setResponseLocation(src.getResponseLocation()); - VectorOf(XMLObject) v=getUnknownXMLObjects(); - for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) - v.push_back((*i)->clone()); + init(); } - IMPL_XMLOBJECT_CLONE(EndpointType); + void _clone(const EndpointTypeImpl& src) { + IMPL_CLONE_ATTRIB(Binding); + IMPL_CLONE_ATTRIB(Location); + IMPL_CLONE_ATTRIB(ResponseLocation); + IMPL_CLONE_XMLOBJECT_CHILDREN(UnknownXMLObject); + } + + IMPL_XMLOBJECT_CLONE_EX(EndpointType); IMPL_STRING_ATTRIB(Binding); IMPL_STRING_ATTRIB(Location); IMPL_STRING_ATTRIB(ResponseLocation); @@ -700,18 +664,21 @@ namespace opensaml { } IndexedEndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); + } IndexedEndpointTypeImpl(const IndexedEndpointTypeImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) { - setIndex(src.m_Index); - isDefault(src.m_isDefault); + init(); } - IMPL_XMLOBJECT_CLONE(IndexedEndpointType); - EndpointType* cloneEndpointType() const { - return new IndexedEndpointTypeImpl(*this); + void _clone(const IndexedEndpointTypeImpl& src) { + EndpointTypeImpl::_clone(src); + IMPL_CLONE_INTEGER_ATTRIB(Index); + IMPL_CLONE_BOOLEAN_ATTRIB(isDefault); } + IMPL_XMLOBJECT_CLONE_EX(IndexedEndpointType); IMPL_INTEGER_ATTRIB(Index); IMPL_BOOLEAN_ATTRIB(isDefault); @@ -747,13 +714,7 @@ namespace opensaml { ArtifactResolutionServiceImpl(const ArtifactResolutionServiceImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(ArtifactResolutionService); - IndexedEndpointType* cloneIndexedEndpointType() const { - return new ArtifactResolutionServiceImpl(*this); - } - EndpointType* cloneEndpointType() const { - return new ArtifactResolutionServiceImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(ArtifactResolutionService); }; class SAML_DLLLOCAL SingleLogoutServiceImpl : public virtual SingleLogoutService, public EndpointTypeImpl @@ -766,10 +727,7 @@ namespace opensaml { SingleLogoutServiceImpl(const SingleLogoutServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(SingleLogoutService); - EndpointType* cloneEndpointType() const { - return new SingleLogoutServiceImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(SingleLogoutService); }; class SAML_DLLLOCAL ManageNameIDServiceImpl : public virtual ManageNameIDService, public EndpointTypeImpl @@ -782,10 +740,7 @@ namespace opensaml { ManageNameIDServiceImpl(const ManageNameIDServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(ManageNameIDService); - EndpointType* cloneEndpointType() const { - return new ManageNameIDServiceImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(ManageNameIDService); }; class SAML_DLLLOCAL SingleSignOnServiceImpl : public virtual SingleSignOnService, public EndpointTypeImpl @@ -798,10 +753,7 @@ namespace opensaml { SingleSignOnServiceImpl(const SingleSignOnServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(SingleSignOnService); - EndpointType* cloneEndpointType() const { - return new SingleSignOnServiceImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(SingleSignOnService); }; class SAML_DLLLOCAL NameIDMappingServiceImpl : public virtual NameIDMappingService, public EndpointTypeImpl @@ -814,10 +766,7 @@ namespace opensaml { NameIDMappingServiceImpl(const NameIDMappingServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(NameIDMappingService); - EndpointType* cloneEndpointType() const { - return new NameIDMappingServiceImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(NameIDMappingService); }; class SAML_DLLLOCAL AssertionIDRequestServiceImpl : public virtual AssertionIDRequestService, public EndpointTypeImpl @@ -830,10 +779,7 @@ namespace opensaml { AssertionIDRequestServiceImpl(const AssertionIDRequestServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(AssertionIDRequestService); - EndpointType* cloneEndpointType() const { - return new AssertionIDRequestServiceImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(AssertionIDRequestService); }; class SAML_DLLLOCAL AssertionConsumerServiceImpl : public virtual AssertionConsumerService, public IndexedEndpointTypeImpl @@ -846,13 +792,7 @@ namespace opensaml { AssertionConsumerServiceImpl(const AssertionConsumerServiceImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(AssertionConsumerService); - EndpointType* cloneEndpointType() const { - return new AssertionConsumerServiceImpl(*this); - } - IndexedEndpointType* cloneIndexedEndpointType() const { - return new AssertionConsumerServiceImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(AssertionConsumerService); }; class SAML_DLLLOCAL AuthnQueryServiceImpl : public virtual AuthnQueryService, public EndpointTypeImpl @@ -865,10 +805,7 @@ namespace opensaml { AuthnQueryServiceImpl(const AuthnQueryServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(AuthnQueryService); - EndpointType* cloneEndpointType() const { - return new AuthnQueryServiceImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(AuthnQueryService); }; class SAML_DLLLOCAL AuthzServiceImpl : public virtual AuthzService, public EndpointTypeImpl @@ -881,10 +818,7 @@ namespace opensaml { AuthzServiceImpl(const AuthzServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(AuthzService); - EndpointType* cloneEndpointType() const { - return new AuthzServiceImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(AuthzService); }; class SAML_DLLLOCAL AttributeServiceImpl : public virtual AttributeService, public EndpointTypeImpl @@ -897,10 +831,7 @@ namespace opensaml { AttributeServiceImpl(const AttributeServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(AttributeService); - EndpointType* cloneEndpointType() const { - return new AttributeServiceImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(AttributeService); }; class SAML_DLLLOCAL RoleDescriptorImpl : public virtual RoleDescriptor, @@ -955,43 +886,32 @@ namespace opensaml { : AbstractXMLObject(src), AbstractComplexElement(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { init(); - setID(src.getID()); - setProtocolSupportEnumeration(src.getProtocolSupportEnumeration()); - setErrorURL(src.getErrorURL()); - setValidUntil(src.getValidUntil()); - setCacheDuration(src.getCacheDuration()); - if (src.getSignature()) - setSignature(src.getSignature()->cloneSignature()); - if (src.getExtensions()) - 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) { - v.push_back((*i)->cloneKeyDescriptor()); - } - } - VectorOf(ContactPerson) w=getContactPersons(); - for (vector::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) { - if (*j) { - w.push_back((*j)->cloneContactPerson()); - } - } + } + + void _clone(const RoleDescriptorImpl& src) { + IMPL_CLONE_ATTRIB(ID); + IMPL_CLONE_ATTRIB(ProtocolSupportEnumeration); + IMPL_CLONE_ATTRIB(ErrorURL); + IMPL_CLONE_ATTRIB(ValidUntil); + IMPL_CLONE_ATTRIB(CacheDuration); + IMPL_CLONE_TYPED_CHILD(Signature); + IMPL_CLONE_TYPED_CHILD(Extensions); + IMPL_CLONE_TYPED_CHILD(Organization); + IMPL_CLONE_TYPED_CHILDREN(KeyDescriptor); + IMPL_CLONE_TYPED_CHILDREN(ContactPerson); } //IMPL_TYPED_CHILD(Signature); // Need customized setter. protected: - Signature* m_Signature; + xmlsignature::Signature* m_Signature; list::iterator m_pos_Signature; public: - Signature* getSignature() const { + xmlsignature::Signature* getSignature() const { return m_Signature; } - void setSignature(Signature* sig) { + void setSignature(xmlsignature::Signature* sig) { prepareForAssignment(m_Signature,sig); *m_pos_Signature=m_Signature=sig; // Sync content reference back up. @@ -999,6 +919,10 @@ namespace opensaml { m_Signature->setContentReference(new opensaml::ContentReference(*this)); } + RoleDescriptor* cloneRoleDescriptor() const { + return dynamic_cast(clone()); + } + IMPL_ID_ATTRIB_EX(ID,ID,nullptr); IMPL_STRING_ATTRIB(ProtocolSupportEnumeration); IMPL_STRING_ATTRIB(ErrorURL); @@ -1131,16 +1055,14 @@ namespace opensaml { } 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); + void _clone(const RoleDescriptorTypeImpl& src) { + RoleDescriptorImpl::_clone(src); + IMPL_CLONE_XMLOBJECT_CHILDREN(UnknownXMLObject); } + IMPL_XMLOBJECT_CLONE_EX(RoleDescriptorType); IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end()); protected: @@ -1186,30 +1108,18 @@ namespace opensaml { SSODescriptorTypeImpl(const SSODescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) { init(); - VectorOf(ArtifactResolutionService) v=getArtifactResolutionServices(); - for (vector::const_iterator i=src.m_ArtifactResolutionServices.begin(); i!=src.m_ArtifactResolutionServices.end(); i++) { - if (*i) { - v.push_back((*i)->cloneArtifactResolutionService()); - } - } - VectorOf(SingleLogoutService) w=getSingleLogoutServices(); - for (vector::const_iterator j=src.m_SingleLogoutServices.begin(); j!=src.m_SingleLogoutServices.end(); j++) { - if (*j) { - w.push_back((*j)->cloneSingleLogoutService()); - } - } - VectorOf(ManageNameIDService) x=getManageNameIDServices(); - for (vector::const_iterator k=src.m_ManageNameIDServices.begin(); k!=src.m_ManageNameIDServices.end(); k++) { - if (*k) { - x.push_back((*k)->cloneManageNameIDService()); - } - } - VectorOf(NameIDFormat) y=getNameIDFormats(); - for (vector::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) { - if (*m) { - y.push_back((*m)->cloneNameIDFormat()); - } - } + } + + void _clone(const SSODescriptorTypeImpl& src) { + RoleDescriptorImpl::_clone(src); + IMPL_CLONE_TYPED_CHILDREN(ArtifactResolutionService); + IMPL_CLONE_TYPED_CHILDREN(SingleLogoutService); + IMPL_CLONE_TYPED_CHILDREN(ManageNameIDService); + IMPL_CLONE_TYPED_CHILDREN(NameIDFormat); + } + + SSODescriptorType* cloneSSODescriptorType() const { + return dynamic_cast(clone()); } IMPL_TYPED_CHILDREN(ArtifactResolutionService,m_pos_ArtifactResolutionService); @@ -1260,47 +1170,19 @@ namespace opensaml { IDPSSODescriptorImpl(const IDPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) { init(); - WantAuthnRequestsSigned(src.m_WantAuthnRequestsSigned); - VectorOf(SingleSignOnService) v=getSingleSignOnServices(); - for (vector::const_iterator i=src.m_SingleSignOnServices.begin(); i!=src.m_SingleSignOnServices.end(); i++) { - if (*i) { - v.push_back((*i)->cloneSingleSignOnService()); - } - } - VectorOf(NameIDMappingService) w=getNameIDMappingServices(); - for (vector::const_iterator j=src.m_NameIDMappingServices.begin(); j!=src.m_NameIDMappingServices.end(); j++) { - if (*j) { - w.push_back((*j)->cloneNameIDMappingService()); - } - } - VectorOf(AssertionIDRequestService) x=getAssertionIDRequestServices(); - for (vector::const_iterator k=src.m_AssertionIDRequestServices.begin(); k!=src.m_AssertionIDRequestServices.end(); k++) { - if (*k) { - x.push_back((*k)->cloneAssertionIDRequestService()); - } - } - VectorOf(AttributeProfile) y=getAttributeProfiles(); - for (vector::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) { - if (*m) { - y.push_back((*m)->cloneAttributeProfile()); - } - } - VectorOf(Attribute) z=getAttributes(); - for (vector::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) { - if (*n) { - z.push_back((*n)->cloneAttribute()); - } - } } - IMPL_XMLOBJECT_CLONE(IDPSSODescriptor); - SSODescriptorType* cloneSSODescriptorType() const { - return new IDPSSODescriptorImpl(*this); - } - RoleDescriptor* cloneRoleDescriptor() const { - return new IDPSSODescriptorImpl(*this); + void _clone(const IDPSSODescriptorImpl& src) { + SSODescriptorTypeImpl::_clone(src); + IMPL_CLONE_BOOLEAN_ATTRIB(WantAuthnRequestsSigned); + IMPL_CLONE_TYPED_CHILDREN(SingleSignOnService); + IMPL_CLONE_TYPED_CHILDREN(NameIDMappingService); + IMPL_CLONE_TYPED_CHILDREN(AssertionIDRequestService); + IMPL_CLONE_TYPED_CHILDREN(AttributeProfile); + IMPL_CLONE_TYPED_FOREIGN_CHILDREN(Attribute,saml2); } + IMPL_XMLOBJECT_CLONE_EX(IDPSSODescriptor); IMPL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned); IMPL_TYPED_CHILDREN(SingleSignOnService,m_pos_SingleSignOnService); IMPL_TYPED_CHILDREN(NameIDMappingService,m_pos_NameIDMappingService); @@ -1345,6 +1227,7 @@ namespace opensaml { m_Name=m_NameFormat=m_FriendlyName=nullptr; m_isRequired=XML_BOOL_NULL; } + public: virtual ~RequestedAttributeImpl() { XMLString::release(&m_Name); @@ -1361,23 +1244,14 @@ namespace opensaml { : AbstractXMLObject(src), AbstractComplexElement(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { init(); - setName(src.getName()); - setNameFormat(src.getNameFormat()); - setFriendlyName(src.getFriendlyName()); - isRequired(src.m_isRequired); - VectorOf(XMLObject) v=getAttributeValues(); - for (vector::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) { - if (*i) { - v.push_back((*i)->clone()); - } - } - } - - IMPL_XMLOBJECT_CLONE(RequestedAttribute); - Attribute* cloneAttribute() const { - return new RequestedAttributeImpl(*this); + IMPL_CLONE_ATTRIB(Name); + IMPL_CLONE_ATTRIB(NameFormat); + IMPL_CLONE_ATTRIB(FriendlyName); + IMPL_CLONE_BOOLEAN_ATTRIB(isRequired); + IMPL_CLONE_XMLOBJECT_CHILDREN(AttributeValue); } + IMPL_XMLOBJECT_CLONE2(RequestedAttribute,Attribute); IMPL_STRING_ATTRIB(Name); IMPL_STRING_ATTRIB(NameFormat); IMPL_STRING_ATTRIB(FriendlyName); @@ -1456,26 +1330,11 @@ namespace opensaml { AttributeConsumingServiceImpl(const AttributeConsumingServiceImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { init(); - setIndex(src.m_Index); - isDefault(src.m_isDefault); - VectorOf(ServiceName) v=getServiceNames(); - for (vector::const_iterator i=src.m_ServiceNames.begin(); i!=src.m_ServiceNames.end(); i++) { - if (*i) { - v.push_back((*i)->cloneServiceName()); - } - } - VectorOf(ServiceDescription) w=getServiceDescriptions(); - for (vector::const_iterator j=src.m_ServiceDescriptions.begin(); j!=src.m_ServiceDescriptions.end(); j++) { - if (*j) { - w.push_back((*j)->cloneServiceDescription()); - } - } - VectorOf(RequestedAttribute) x=getRequestedAttributes(); - for (vector::const_iterator k=src.m_RequestedAttributes.begin(); k!=src.m_RequestedAttributes.end(); k++) { - if (*k) { - x.push_back((*k)->cloneRequestedAttribute()); - } - } + IMPL_CLONE_INTEGER_ATTRIB(Index); + IMPL_CLONE_BOOLEAN_ATTRIB(isDefault); + IMPL_CLONE_TYPED_CHILDREN(ServiceName); + IMPL_CLONE_TYPED_CHILDREN(ServiceDescription); + IMPL_CLONE_TYPED_CHILDREN(RequestedAttribute); } IMPL_XMLOBJECT_CLONE(AttributeConsumingService); @@ -1527,30 +1386,17 @@ namespace opensaml { SPSSODescriptorImpl(const SPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) { init(); - AuthnRequestsSigned(src.m_AuthnRequestsSigned); - WantAssertionsSigned(src.m_WantAssertionsSigned); - VectorOf(AssertionConsumerService) v=getAssertionConsumerServices(); - for (vector::const_iterator i=src.m_AssertionConsumerServices.begin(); i!=src.m_AssertionConsumerServices.end(); i++) { - if (*i) { - v.push_back((*i)->cloneAssertionConsumerService()); - } - } - VectorOf(AttributeConsumingService) w=getAttributeConsumingServices(); - for (vector::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) { - if (*j) { - w.push_back((*j)->cloneAttributeConsumingService()); - } - } } - IMPL_XMLOBJECT_CLONE(SPSSODescriptor); - SSODescriptorType* cloneSSODescriptorType() const { - return cloneSPSSODescriptor(); - } - RoleDescriptor* cloneRoleDescriptor() const { - return cloneSPSSODescriptor(); + void _clone(const SPSSODescriptorImpl& src) { + SSODescriptorTypeImpl::_clone(src); + IMPL_CLONE_BOOLEAN_ATTRIB(AuthnRequestsSigned); + IMPL_CLONE_BOOLEAN_ATTRIB(WantAssertionsSigned); + IMPL_CLONE_TYPED_CHILDREN(AssertionConsumerService); + IMPL_CLONE_TYPED_CHILDREN(AttributeConsumingService); } + IMPL_XMLOBJECT_CLONE_EX(SPSSODescriptor); IMPL_BOOLEAN_ATTRIB(AuthnRequestsSigned); IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned); IMPL_TYPED_CHILDREN(AssertionConsumerService,m_pos_AssertionConsumerService); @@ -1602,37 +1448,22 @@ namespace opensaml { virtual ~AuthnAuthorityDescriptorImpl() {} AuthnAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } AuthnAuthorityDescriptorImpl(const AuthnAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) { init(); - VectorOf(AuthnQueryService) v=getAuthnQueryServices(); - for (vector::const_iterator i=src.m_AuthnQueryServices.begin(); i!=src.m_AuthnQueryServices.end(); i++) { - if (*i) { - v.push_back((*i)->cloneAuthnQueryService()); - } - } - VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices(); - for (vector::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) { - if (*j) { - w.push_back((*j)->cloneAssertionIDRequestService()); - } - } - VectorOf(NameIDFormat) x=getNameIDFormats(); - for (vector::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) { - if (*k) { - x.push_back((*k)->cloneNameIDFormat()); - } - } } - IMPL_XMLOBJECT_CLONE(AuthnAuthorityDescriptor); - RoleDescriptor* cloneRoleDescriptor() const { - return cloneAuthnAuthorityDescriptor(); + void _clone(const AuthnAuthorityDescriptorImpl& src) { + RoleDescriptorImpl::_clone(src); + IMPL_CLONE_TYPED_CHILDREN(AuthnQueryService); + IMPL_CLONE_TYPED_CHILDREN(AssertionIDRequestService); + IMPL_CLONE_TYPED_CHILDREN(NameIDFormat); } + IMPL_XMLOBJECT_CLONE_EX(AuthnAuthorityDescriptor); IMPL_TYPED_CHILDREN(AuthnQueryService,m_pos_AuthnQueryService); IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService); IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end()); @@ -1664,37 +1495,22 @@ namespace opensaml { virtual ~PDPDescriptorImpl() {} PDPDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } PDPDescriptorImpl(const PDPDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) { init(); - VectorOf(AuthzService) v=getAuthzServices(); - for (vector::const_iterator i=src.m_AuthzServices.begin(); i!=src.m_AuthzServices.end(); i++) { - if (*i) { - v.push_back((*i)->cloneAuthzService()); - } - } - VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices(); - for (vector::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) { - if (*j) { - w.push_back((*j)->cloneAssertionIDRequestService()); - } - } - VectorOf(NameIDFormat) x=getNameIDFormats(); - for (vector::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) { - if (*k) { - x.push_back((*k)->cloneNameIDFormat()); - } - } } - IMPL_XMLOBJECT_CLONE(PDPDescriptor); - RoleDescriptor* cloneRoleDescriptor() const { - return clonePDPDescriptor(); + void _clone(const PDPDescriptorImpl& src) { + RoleDescriptorImpl::_clone(src); + IMPL_CLONE_TYPED_CHILDREN(AuthzService); + IMPL_CLONE_TYPED_CHILDREN(AssertionIDRequestService); + IMPL_CLONE_TYPED_CHILDREN(NameIDFormat); } + IMPL_XMLOBJECT_CLONE_EX(PDPDescriptor); IMPL_TYPED_CHILDREN(AuthzService,m_pos_AuthzService); IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService); IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end()); @@ -1734,49 +1550,24 @@ namespace opensaml { virtual ~AttributeAuthorityDescriptorImpl() {} AttributeAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } AttributeAuthorityDescriptorImpl(const AttributeAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) { init(); - VectorOf(AttributeService) v=getAttributeServices(); - for (vector::const_iterator i=src.m_AttributeServices.begin(); i!=src.m_AttributeServices.end(); i++) { - if (*i) { - v.push_back((*i)->cloneAttributeService()); - } - } - VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices(); - for (vector::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) { - if (*j) { - w.push_back((*j)->cloneAssertionIDRequestService()); - } - } - VectorOf(NameIDFormat) x=getNameIDFormats(); - for (vector::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) { - if (*k) { - x.push_back((*k)->cloneNameIDFormat()); - } - } - VectorOf(AttributeProfile) y=getAttributeProfiles(); - for (vector::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) { - if (*m) { - y.push_back((*m)->cloneAttributeProfile()); - } - } - VectorOf(Attribute) z=getAttributes(); - for (vector::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) { - if (*n) { - z.push_back((*n)->cloneAttribute()); - } - } } - IMPL_XMLOBJECT_CLONE(AttributeAuthorityDescriptor); - RoleDescriptor* cloneRoleDescriptor() const { - return cloneAttributeAuthorityDescriptor(); + void _clone(const AttributeAuthorityDescriptorImpl& src) { + RoleDescriptorImpl::_clone(src); + IMPL_CLONE_TYPED_CHILDREN(AttributeService); + IMPL_CLONE_TYPED_CHILDREN(AssertionIDRequestService); + IMPL_CLONE_TYPED_CHILDREN(NameIDFormat); + IMPL_CLONE_TYPED_CHILDREN(AttributeProfile); + IMPL_CLONE_TYPED_FOREIGN_CHILDREN(Attribute,saml2); } + IMPL_XMLOBJECT_CLONE_EX(AttributeAuthorityDescriptor); IMPL_TYPED_CHILDREN(AttributeService,m_pos_AttributeService); IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService); IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat); @@ -1814,19 +1605,22 @@ namespace opensaml { virtual ~QueryDescriptorTypeImpl() {} QueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } QueryDescriptorTypeImpl(const QueryDescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) { init(); - WantAssertionsSigned(src.m_WantAssertionsSigned); - VectorOf(NameIDFormat) y=getNameIDFormats(); - for (vector::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) { - if (*m) { - y.push_back((*m)->cloneNameIDFormat()); - } - } + } + + void _clone(const QueryDescriptorTypeImpl& src) { + RoleDescriptorImpl::_clone(src); + IMPL_CLONE_BOOLEAN_ATTRIB(WantAssertionsSigned); + IMPL_CLONE_TYPED_CHILDREN(NameIDFormat); + } + + QueryDescriptorType* cloneQueryDescriptorType() const { + return dynamic_cast(clone()); } IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned); @@ -1864,13 +1658,7 @@ namespace opensaml { AuthnQueryDescriptorTypeImpl(const AuthnQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(AuthnQueryDescriptorType); - QueryDescriptorType* cloneQueryDescriptorType() const { - return new AuthnQueryDescriptorTypeImpl(*this); - } - RoleDescriptor* cloneRoleDescriptor() const { - return new AuthnQueryDescriptorTypeImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(AuthnQueryDescriptorType); }; class SAML_DLLLOCAL AttributeQueryDescriptorTypeImpl : public virtual AttributeQueryDescriptorType, public QueryDescriptorTypeImpl @@ -1881,24 +1669,15 @@ namespace opensaml { 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(); - for (vector::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) { - if (*j) { - w.push_back((*j)->cloneAttributeConsumingService()); - } - } + AttributeQueryDescriptorTypeImpl(const AttributeQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) { } - IMPL_XMLOBJECT_CLONE(AttributeQueryDescriptorType); - QueryDescriptorType* cloneQueryDescriptorType() const { - return new AttributeQueryDescriptorTypeImpl(*this); - } - RoleDescriptor* cloneRoleDescriptor() const { - return new AttributeQueryDescriptorTypeImpl(*this); + void _clone(const AttributeQueryDescriptorTypeImpl& src) { + QueryDescriptorTypeImpl::_clone(src); + IMPL_CLONE_TYPED_CHILDREN(AttributeConsumingService); } + IMPL_XMLOBJECT_CLONE_EX(AttributeQueryDescriptorType); IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end()); protected: @@ -1916,24 +1695,15 @@ namespace opensaml { 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(); - for (vector::const_iterator j=src.m_ActionNamespaces.begin(); j!=src.m_ActionNamespaces.end(); j++) { - if (*j) { - w.push_back((*j)->cloneActionNamespace()); - } - } + AuthzDecisionQueryDescriptorTypeImpl(const AuthzDecisionQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) { } - IMPL_XMLOBJECT_CLONE(AuthzDecisionQueryDescriptorType); - QueryDescriptorType* cloneQueryDescriptorType() const { - return new AuthzDecisionQueryDescriptorTypeImpl(*this); - } - RoleDescriptor* cloneRoleDescriptor() const { - return new AuthzDecisionQueryDescriptorTypeImpl(*this); + void _clone(const AuthzDecisionQueryDescriptorTypeImpl& src) { + QueryDescriptorTypeImpl::_clone(src); + IMPL_CLONE_TYPED_CHILDREN(ActionNamespace); } + IMPL_XMLOBJECT_CLONE_EX(AuthzDecisionQueryDescriptorType); IMPL_TYPED_CHILDREN(ActionNamespace,m_children.end()); protected: @@ -1985,27 +1755,14 @@ namespace opensaml { : AbstractXMLObject(src), AbstractComplexElement(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { init(); - setID(src.getID()); - setAffiliationOwnerID(src.getAffiliationOwnerID()); - setValidUntil(src.getValidUntil()); - setCacheDuration(src.getCacheDuration()); - if (src.getSignature()) - 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) { - v.push_back((*i)->cloneKeyDescriptor()); - } - } - VectorOf(AffiliateMember) w=getAffiliateMembers(); - for (vector::const_iterator j=src.m_AffiliateMembers.begin(); j!=src.m_AffiliateMembers.end(); j++) { - if (*j) { - w.push_back((*j)->cloneAffiliateMember()); - } - } + IMPL_CLONE_ATTRIB(ID); + IMPL_CLONE_ATTRIB(AffiliationOwnerID); + IMPL_CLONE_ATTRIB(ValidUntil); + IMPL_CLONE_ATTRIB(CacheDuration); + IMPL_CLONE_TYPED_CHILD(Signature); + IMPL_CLONE_TYPED_CHILD(Extensions); + IMPL_CLONE_TYPED_CHILDREN(KeyDescriptor); + IMPL_CLONE_TYPED_CHILDREN(AffiliateMember); } IMPL_XMLOBJECT_CLONE(AffiliationDescriptor); @@ -2013,14 +1770,14 @@ namespace opensaml { //IMPL_TYPED_CHILD(Signature); // Need customized setter. protected: - Signature* m_Signature; + xmlsignature::Signature* m_Signature; list::iterator m_pos_Signature; public: - Signature* getSignature() const { + xmlsignature::Signature* getSignature() const { return m_Signature; } - void setSignature(Signature* sig) { + void setSignature(xmlsignature::Signature* sig) { prepareForAssignment(m_Signature,sig); *m_pos_Signature=m_Signature=sig; // Sync content reference back up. @@ -2136,89 +1893,29 @@ namespace opensaml { : AbstractXMLObject(src), AbstractComplexElement(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { init(); - setID(src.getID()); - setEntityID(src.getEntityID()); - setValidUntil(src.getValidUntil()); - setCacheDuration(src.getCacheDuration()); - if (src.getSignature()) - setSignature(src.getSignature()->cloneSignature()); - if (src.getExtensions()) - setExtensions(src.getExtensions()->cloneExtensions()); - if (src.getAffiliationDescriptor()) - 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); - if (idp) { - getIDPSSODescriptors().push_back(idp->cloneIDPSSODescriptor()); - continue; - } - - SPSSODescriptor* sp=dynamic_cast(*i); - if (sp) { - getSPSSODescriptors().push_back(sp->cloneSPSSODescriptor()); - continue; - } - - AuthnAuthorityDescriptor* authn=dynamic_cast(*i); - if (authn) { - getAuthnAuthorityDescriptors().push_back(authn->cloneAuthnAuthorityDescriptor()); - continue; - } - - AttributeAuthorityDescriptor* attr=dynamic_cast(*i); - if (attr) { - getAttributeAuthorityDescriptors().push_back(attr->cloneAttributeAuthorityDescriptor()); - continue; - } - - PDPDescriptor* pdp=dynamic_cast(*i); - if (pdp) { - getPDPDescriptors().push_back(pdp->clonePDPDescriptor()); - continue; - } - - AuthnQueryDescriptorType* authnq=dynamic_cast(*i); - if (authnq) { - getAuthnQueryDescriptorTypes().push_back(authnq->cloneAuthnQueryDescriptorType()); - continue; - } - - AttributeQueryDescriptorType* attrq=dynamic_cast(*i); - if (attrq) { - getAttributeQueryDescriptorTypes().push_back(attrq->cloneAttributeQueryDescriptorType()); - continue; - } - - AuthzDecisionQueryDescriptorType* authzq=dynamic_cast(*i); - if (authzq) { - getAuthzDecisionQueryDescriptorTypes().push_back(authzq->cloneAuthzDecisionQueryDescriptorType()); - continue; - } - - RoleDescriptor* role=dynamic_cast(*i); - if (role) { - getRoleDescriptors().push_back(role->cloneRoleDescriptor()); - continue; - } - } - } - - VectorOf(ContactPerson) v=getContactPersons(); - for (vector::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) { - if (*j) { - v.push_back((*j)->cloneContactPerson()); - } - } - VectorOf(AdditionalMetadataLocation) w=getAdditionalMetadataLocations(); - for (vector::const_iterator k=src.m_AdditionalMetadataLocations.begin(); k!=src.m_AdditionalMetadataLocations.end(); k++) { - if (*k) { - w.push_back((*k)->cloneAdditionalMetadataLocation()); - } - } + IMPL_CLONE_ATTRIB(ID); + IMPL_CLONE_ATTRIB(EntityID); + IMPL_CLONE_ATTRIB(ValidUntil); + IMPL_CLONE_ATTRIB(CacheDuration); + IMPL_CLONE_TYPED_CHILD(Signature); + IMPL_CLONE_TYPED_CHILD(Extensions); + IMPL_CLONE_TYPED_CHILD(AffiliationDescriptor); + IMPL_CLONE_TYPED_CHILD(Organization); + + IMPL_CLONE_CHILDBAG_BEGIN; + IMPL_CLONE_TYPED_CHILD_IN_BAG(IDPSSODescriptor); + IMPL_CLONE_TYPED_CHILD_IN_BAG(SPSSODescriptor); + IMPL_CLONE_TYPED_CHILD_IN_BAG(AuthnAuthorityDescriptor); + IMPL_CLONE_TYPED_CHILD_IN_BAG(AttributeAuthorityDescriptor); + IMPL_CLONE_TYPED_CHILD_IN_BAG(PDPDescriptor); + IMPL_CLONE_TYPED_CHILD_IN_BAG(AuthnQueryDescriptorType); + IMPL_CLONE_TYPED_CHILD_IN_BAG(AttributeQueryDescriptorType); + IMPL_CLONE_TYPED_CHILD_IN_BAG(AuthzDecisionQueryDescriptorType); + IMPL_CLONE_TYPED_CHILD_IN_BAG(RoleDescriptor); + IMPL_CLONE_CHILDBAG_END; + + IMPL_CLONE_TYPED_CHILDREN(ContactPerson); + IMPL_CLONE_TYPED_CHILDREN(AdditionalMetadataLocation); } IMPL_XMLOBJECT_CLONE(EntityDescriptor); @@ -2226,14 +1923,14 @@ namespace opensaml { //IMPL_TYPED_CHILD(Signature); // Need customized setter. protected: - Signature* m_Signature; + xmlsignature::Signature* m_Signature; list::iterator m_pos_Signature; public: - Signature* getSignature() const { + xmlsignature::Signature* getSignature() const { return m_Signature; } - void setSignature(Signature* sig) { + void setSignature(xmlsignature::Signature* sig) { prepareForAssignment(m_Signature,sig); *m_pos_Signature=m_Signature=sig; // Sync content reference back up. @@ -2380,30 +2077,17 @@ namespace opensaml { EntitiesDescriptorImpl(const EntitiesDescriptorImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { init(); - setID(src.getID()); - setName(src.getName()); - setValidUntil(src.getValidUntil()); - setCacheDuration(src.getCacheDuration()); - if (src.getSignature()) - 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); - if (e) { - getEntityDescriptors().push_back(e->cloneEntityDescriptor()); - continue; - } + IMPL_CLONE_ATTRIB(ID); + IMPL_CLONE_ATTRIB(Name); + IMPL_CLONE_ATTRIB(ValidUntil); + IMPL_CLONE_ATTRIB(CacheDuration); + IMPL_CLONE_TYPED_CHILD(Signature); + IMPL_CLONE_TYPED_CHILD(Extensions); - EntitiesDescriptor* es=dynamic_cast(*i); - if (es) { - getEntitiesDescriptors().push_back(es->cloneEntitiesDescriptor()); - continue; - } - } - } + IMPL_CLONE_CHILDBAG_BEGIN; + IMPL_CLONE_TYPED_CHILD_IN_BAG(EntityDescriptor); + IMPL_CLONE_TYPED_CHILD_IN_BAG(EntitiesDescriptor); + IMPL_CLONE_CHILDBAG_END; } IMPL_XMLOBJECT_CLONE(EntitiesDescriptor); @@ -2411,14 +2095,14 @@ namespace opensaml { //IMPL_TYPED_CHILD(Signature); // Need customized setter. protected: - Signature* m_Signature; + xmlsignature::Signature* m_Signature; list::iterator m_pos_Signature; public: - Signature* getSignature() const { + xmlsignature::Signature* getSignature() const { return m_Signature; } - void setSignature(Signature* sig) { + void setSignature(xmlsignature::Signature* sig) { prepareForAssignment(m_Signature,sig); *m_pos_Signature=m_Signature=sig; // Sync content reference back up. @@ -2463,6 +2147,32 @@ namespace opensaml { } }; + class SAML_DLLLOCAL DiscoveryResponseImpl : public virtual DiscoveryResponse, public IndexedEndpointTypeImpl + { + public: + virtual ~DiscoveryResponseImpl() {} + + DiscoveryResponseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} + + DiscoveryResponseImpl(const DiscoveryResponseImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {} + + IMPL_XMLOBJECT_CLONE_EX(DiscoveryResponse); + }; + + class SAML_DLLLOCAL RequestInitiatorImpl : public virtual RequestInitiator, public EndpointTypeImpl + { + public: + virtual ~RequestInitiatorImpl() {} + + RequestInitiatorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} + + RequestInitiatorImpl(const RequestInitiatorImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {} + + IMPL_XMLOBJECT_CLONE_EX(RequestInitiator); + }; + class SAML_DLLLOCAL EntityAttributesImpl : public virtual EntityAttributes, public AbstractComplexElement, public AbstractDOMCachingXMLObject, @@ -2478,25 +2188,13 @@ namespace opensaml { 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_CLONE_CHILDBAG_BEGIN; + IMPL_CLONE_TYPED_FOREIGN_CHILD_IN_BAG(Attribute,saml2); + IMPL_CLONE_TYPED_FOREIGN_CHILD_IN_BAG(Assertion,saml2); + IMPL_CLONE_CHILDBAG_END; } IMPL_XMLOBJECT_CLONE(EntityAttributes); - IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end()); IMPL_TYPED_FOREIGN_CHILDREN(Assertion,saml2,m_children.end()); @@ -2520,21 +2218,17 @@ namespace opensaml { } DigestMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) { - m_Algorithm = nullptr; + : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_Algorithm(nullptr) { } DigestMethodImpl(const DigestMethodImpl& src) - : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { - setAlgorithm(src.getAlgorithm()); - VectorOf(XMLObject) v=getUnknownXMLObjects(); - for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) - v.push_back((*i)->clone()); + : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src), m_Algorithm(nullptr) { + IMPL_CLONE_ATTRIB(Algorithm); + IMPL_CLONE_XMLOBJECT_CHILDREN(UnknownXMLObject); } - IMPL_STRING_ATTRIB(Algorithm); - IMPL_XMLOBJECT_CLONE(DigestMethod); + IMPL_STRING_ATTRIB(Algorithm); IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end()); protected: @@ -2558,6 +2252,10 @@ namespace opensaml { public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller { + void init() { + m_Algorithm = m_MinKeySize = m_MaxKeySize = nullptr; + } + public: virtual ~SigningMethodImpl() { XMLString::release(&m_Algorithm); @@ -2566,28 +2264,24 @@ namespace opensaml { } SigningMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) { - m_Algorithm = nullptr; - m_MinKeySize = nullptr; - m_MaxKeySize = nullptr; + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); } SigningMethodImpl(const SigningMethodImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { - setAlgorithm(src.getAlgorithm()); - setMinKeySize(src.m_MinKeySize); - setMaxKeySize(src.m_MaxKeySize); - VectorOf(XMLObject) v=getUnknownXMLObjects(); - for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) - v.push_back((*i)->clone()); + init(); + IMPL_CLONE_ATTRIB(Algorithm); + IMPL_CLONE_INTEGER_ATTRIB(MinKeySize); + IMPL_CLONE_INTEGER_ATTRIB(MaxKeySize); + IMPL_CLONE_XMLOBJECT_CHILDREN(UnknownXMLObject); } IMPL_XMLOBJECT_CLONE(SigningMethod); - IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end()); - IMPL_STRING_ATTRIB(Algorithm); IMPL_INTEGER_ATTRIB(MinKeySize); IMPL_INTEGER_ATTRIB(MaxKeySize); + IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end()); protected: void marshallAttributes(DOMElement* domElement) const { @@ -2618,10 +2312,7 @@ namespace opensaml { DisplayNameImpl(const DisplayNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(DisplayName); - localizedNameType* clonelocalizedNameType() const { - return new DisplayNameImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(DisplayName); }; class SAML_DLLLOCAL DescriptionImpl : public virtual Description, public localizedNameTypeImpl @@ -2634,10 +2325,7 @@ namespace opensaml { DescriptionImpl(const DescriptionImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(Description); - localizedNameType* clonelocalizedNameType() const { - return new DescriptionImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(Description); }; class SAML_DLLLOCAL InformationURLImpl : public virtual InformationURL, public localizedURITypeImpl @@ -2650,10 +2338,7 @@ namespace opensaml { InformationURLImpl(const InformationURLImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(InformationURL); - localizedURIType* clonelocalizedURIType() const { - return new InformationURLImpl(*this); - } + IMPL_XMLOBJECT_CLONE_EX(InformationURL); }; class SAML_DLLLOCAL PrivacyStatementURLImpl : public virtual PrivacyStatementURL, public localizedURITypeImpl @@ -2666,9 +2351,67 @@ namespace opensaml { PrivacyStatementURLImpl(const PrivacyStatementURLImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {} - IMPL_XMLOBJECT_CLONE(PrivacyStatementURL); - localizedURIType* clonelocalizedURIType() const { - return new PrivacyStatementURLImpl(*this); + IMPL_XMLOBJECT_CLONE_EX(PrivacyStatementURL); + }; + + class SAML_DLLLOCAL KeywordsImpl : public virtual Keywords, + public AbstractSimpleElement, + public AbstractDOMCachingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + void init() { + m_Lang=nullptr; + m_LangPrefix=nullptr; + } + + protected: + KeywordsImpl() { + init(); + } + + public: + virtual ~KeywordsImpl() { + XMLString::release(&m_Lang); + XMLString::release(&m_LangPrefix); + } + + KeywordsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); + } + + KeywordsImpl(const KeywordsImpl& src) + : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { + init(); + IMPL_CLONE_FOREIGN_ATTRIB(Lang); + } + + IMPL_XMLOBJECT_CLONE(Keywords); + IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh); + + protected: + void marshallAttributes(DOMElement* domElement) const { + 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); + else + attr->setPrefix(xmlconstants::XML_PREFIX); + attr->setNodeValue(m_Lang); + domElement->setAttributeNodeNS(attr); + } + } + + void processAttribute(const DOMAttr* attribute) { + 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); } }; @@ -2703,14 +2446,11 @@ namespace opensaml { init(); } - LogoImpl(const LogoImpl& src) - : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { + LogoImpl(const LogoImpl& src) : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { init(); - setLang(src.getLang()); - if (src.m_LangPrefix) - m_LangPrefix = XMLString::replicate(src.m_LangPrefix); - setHeight(src.m_Height); - setWidth(src.m_Width); + IMPL_CLONE_FOREIGN_ATTRIB(Lang); + IMPL_CLONE_INTEGER_ATTRIB(Height); + IMPL_CLONE_INTEGER_ATTRIB(Width); } IMPL_XMLOBJECT_CLONE(Logo); @@ -2721,9 +2461,11 @@ namespace opensaml { protected: void marshallAttributes(DOMElement* domElement) const { if (m_Lang && *m_Lang) { - DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS,LANG_ATTRIB_NAME); + DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS, LANG_ATTRIB_NAME); if (m_LangPrefix && *m_LangPrefix) attr->setPrefix(m_LangPrefix); + else + attr->setPrefix(xmlconstants::XML_PREFIX); attr->setNodeValue(m_Lang); domElement->setAttributeNodeNS(attr); } @@ -2760,46 +2502,21 @@ namespace opensaml { UIInfoImpl(const UIInfoImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { - for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { - if (*i) { - DisplayName* dn=dynamic_cast(*i); - if (dn) { - getDisplayNames().push_back(dn->cloneDisplayName()); - continue; - } - - Description* des=dynamic_cast(*i); - if (des) { - getDescriptions().push_back(des->cloneDescription()); - continue; - } - - Logo* logo=dynamic_cast(*i); - if (logo) { - getLogos().push_back(logo->cloneLogo()); - continue; - } - - InformationURL* inf=dynamic_cast(*i); - if (inf) { - getInformationURLs().push_back(inf->cloneInformationURL()); - continue; - } - - PrivacyStatementURL* priv=dynamic_cast(*i); - if (priv) { - getPrivacyStatementURLs().push_back(priv->clonePrivacyStatementURL()); - continue; - } - - getUnknownXMLObjects().push_back((*i)->clone()); - } - } + IMPL_CLONE_CHILDBAG_BEGIN; + IMPL_CLONE_TYPED_CHILD_IN_BAG(DisplayName); + IMPL_CLONE_TYPED_CHILD_IN_BAG(Description); + IMPL_CLONE_TYPED_CHILD_IN_BAG(Keywords); + IMPL_CLONE_TYPED_CHILD_IN_BAG(Logo); + IMPL_CLONE_TYPED_CHILD_IN_BAG(InformationURL); + IMPL_CLONE_TYPED_CHILD_IN_BAG(PrivacyStatementURL); + IMPL_CLONE_XMLOBJECT_CHILD_IN_BAG(UnknownXMLObject); + IMPL_CLONE_CHILDBAG_END; } IMPL_XMLOBJECT_CLONE(UIInfo); IMPL_TYPED_CHILDREN(DisplayName,m_children.end()); IMPL_TYPED_CHILDREN(Description,m_children.end()); + IMPL_TYPED_CHILDREN(Keywords,m_children.end()); IMPL_TYPED_CHILDREN(Logo,m_children.end()); IMPL_TYPED_CHILDREN(InformationURL,m_children.end()); IMPL_TYPED_CHILDREN(PrivacyStatementURL,m_children.end()); @@ -2809,6 +2526,7 @@ namespace opensaml { void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { PROC_TYPED_CHILDREN(DisplayName,SAML20MD_UI_NS,false); PROC_TYPED_CHILDREN(Description,SAML20MD_UI_NS,false); + PROC_TYPED_CHILDREN(Keywords,SAML20MD_UI_NS,false); PROC_TYPED_CHILDREN(Logo,SAML20MD_UI_NS,false); PROC_TYPED_CHILDREN(InformationURL,SAML20MD_UI_NS,false); PROC_TYPED_CHILDREN(PrivacyStatementURL,SAML20MD_UI_NS,false); @@ -2839,29 +2557,12 @@ namespace opensaml { DiscoHintsImpl(const DiscoHintsImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { - for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { - if (*i) { - IPHint* ip=dynamic_cast(*i); - if (ip) { - getIPHints().push_back(ip->cloneIPHint()); - continue; - } - - DomainHint* dom=dynamic_cast(*i); - if (dom) { - getDomainHints().push_back(dom->cloneDomainHint()); - continue; - } - - GeolocationHint* geo=dynamic_cast(*i); - if (geo) { - getGeolocationHints().push_back(geo->cloneGeolocationHint()); - continue; - } - - getUnknownXMLObjects().push_back((*i)->clone()); - } - } + IMPL_CLONE_CHILDBAG_BEGIN; + IMPL_CLONE_TYPED_CHILD_IN_BAG(IPHint); + IMPL_CLONE_TYPED_CHILD_IN_BAG(DomainHint); + IMPL_CLONE_TYPED_CHILD_IN_BAG(GeolocationHint); + IMPL_CLONE_XMLOBJECT_CHILD_IN_BAG(UnknownXMLObject); + IMPL_CLONE_CHILDBAG_END; } IMPL_XMLOBJECT_CLONE(DiscoHints); @@ -2887,6 +2588,120 @@ namespace opensaml { } }; + class SAML_DLLLOCAL RegistrationInfoImpl : public virtual RegistrationInfo, + public AbstractAttributeExtensibleXMLObject, + public AbstractComplexElement, + public AbstractDOMCachingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + list::iterator m_pos_RegistrationPolicy; + + void init() { + m_RegistrationAuthority = nullptr; + m_RegistrationInstant = nullptr; + m_pos_RegistrationPolicy = m_children.begin(); + } + + protected: + RegistrationInfoImpl() { + init(); + } + + public: + virtual ~RegistrationInfoImpl() { + XMLString::release(&m_RegistrationAuthority); + delete m_RegistrationInstant; + } + + RegistrationInfoImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); + } + + RegistrationInfoImpl(const RegistrationInfoImpl& src) + : AbstractXMLObject(src), + AbstractAttributeExtensibleXMLObject(src), + AbstractComplexElement(src), + AbstractDOMCachingXMLObject(src) { + init(); + } + + void _clone(const RegistrationInfoImpl& src) { + IMPL_CLONE_ATTRIB(RegistrationAuthority); + IMPL_CLONE_ATTRIB(RegistrationInstant); + IMPL_CLONE_TYPED_CHILDREN(RegistrationPolicy); + IMPL_CLONE_XMLOBJECT_CHILDREN(UnknownXMLObject); + } + + IMPL_XMLOBJECT_CLONE_EX(RegistrationInfo); + IMPL_STRING_ATTRIB(RegistrationAuthority); + IMPL_DATETIME_ATTRIB(RegistrationInstant,0); + IMPL_TYPED_CHILDREN(RegistrationPolicy,m_pos_RegistrationPolicy); + IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end()); + + void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) { + if (!qualifiedName.hasNamespaceURI()) { + if (XMLString::equals(qualifiedName.getLocalPart(),REGAUTHORITY_ATTRIB_NAME)) { + setRegistrationAuthority(value); + return; + } + else if (XMLString::equals(qualifiedName.getLocalPart(),REGINSTANT_ATTRIB_NAME)) { + setRegistrationInstant(value); + return; + } + } + AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID); + } + protected: + void marshallAttributes(DOMElement* domElement) const { + MARSHALL_STRING_ATTRIB(RegistrationAuthority,REGAUTHORITY,nullptr); + MARSHALL_DATETIME_ATTRIB(RegistrationInstant,REGINSTANT,nullptr); + marshallExtensionAttributes(domElement); + } + + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { + PROC_TYPED_CHILDREN(RegistrationPolicy,SAML20MD_RPI_NS,false); + // Unknown child. + const XMLCh* nsURI=root->getNamespaceURI(); + if (!XMLString::equals(nsURI,SAML20MD_RPI_NS) && nsURI && *nsURI) { + getUnknownXMLObjects().push_back(childXMLObject); + return; + } + AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); + } + + void processAttribute(const DOMAttr* attribute) { + unmarshallExtensionAttribute(attribute); + } + }; + + class SAML_DLLLOCAL RegistrationPolicyImpl : public virtual RegistrationPolicy, public localizedURITypeImpl + { + public: + virtual ~RegistrationPolicyImpl() {} + + RegistrationPolicyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} + + RegistrationPolicyImpl(const RegistrationPolicyImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {} + + IMPL_XMLOBJECT_CLONE_EX(RegistrationPolicy); + }; + + class SAML_DLLLOCAL UsagePolicyImpl : public virtual UsagePolicy, public localizedURITypeImpl + { + public: + virtual ~UsagePolicyImpl() {} + + UsagePolicyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) {} + + UsagePolicyImpl(const UsagePolicyImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {} + + IMPL_XMLOBJECT_CLONE_EX(UsagePolicy); + }; + }; }; @@ -2953,11 +2768,14 @@ IMPL_XMLOBJECTBUILDER(TelephoneNumber); IMPL_XMLOBJECTBUILDER(ActionNamespace); IMPL_XMLOBJECTBUILDER(SourceID); +IMPL_XMLOBJECTBUILDER(DiscoveryResponse); +IMPL_XMLOBJECTBUILDER(RequestInitiator); IMPL_XMLOBJECTBUILDER(EntityAttributes); IMPL_XMLOBJECTBUILDER(DigestMethod); IMPL_XMLOBJECTBUILDER(SigningMethod); IMPL_XMLOBJECTBUILDER(DisplayName); IMPL_XMLOBJECTBUILDER(Description); +IMPL_XMLOBJECTBUILDER(Keywords); IMPL_XMLOBJECTBUILDER(Logo); IMPL_XMLOBJECTBUILDER(InformationURL); IMPL_XMLOBJECTBUILDER(PrivacyStatementURL); @@ -2966,6 +2784,9 @@ IMPL_XMLOBJECTBUILDER(IPHint); IMPL_XMLOBJECTBUILDER(DomainHint); IMPL_XMLOBJECTBUILDER(GeolocationHint); IMPL_XMLOBJECTBUILDER(DiscoHints); +IMPL_XMLOBJECTBUILDER(RegistrationInfo); +IMPL_XMLOBJECTBUILDER(RegistrationPolicy); +IMPL_XMLOBJECTBUILDER(UsagePolicy); #ifdef HAVE_COVARIANT_RETURNS RoleDescriptor* RoleDescriptorBuilder::buildObject( @@ -3119,6 +2940,7 @@ const XMLCh DigestMethod::TYPE_NAME[] = UNICODE_LITERAL_16(D,i,g const XMLCh DigestMethod::ALGORITHM_ATTRIB_NAME[] = UNICODE_LITERAL_9(A,l,g,o,r,i,t,h,m); const XMLCh DiscoHints::LOCAL_NAME[] = UNICODE_LITERAL_10(D,i,s,c,o,H,i,n,t,s); const XMLCh DiscoHints::TYPE_NAME[] = UNICODE_LITERAL_14(D,i,s,c,o,H,i,n,t,s,T,y,p,e); +const XMLCh DiscoveryResponse::LOCAL_NAME[] = UNICODE_LITERAL_17(D,i,s,c,o,v,e,r,y,R,e,s,p,o,n,s,e); const XMLCh DisplayName::LOCAL_NAME[] = UNICODE_LITERAL_11(D,i,s,p,l,a,y,N,a,m,e); const XMLCh DomainHint::LOCAL_NAME[] = UNICODE_LITERAL_10(D,o,m,a,i,n,H,i,n,t); const XMLCh EmailAddress::LOCAL_NAME[] = UNICODE_LITERAL_12(E,m,a,i,l,A,d,d,r,e,s,s); @@ -3155,6 +2977,9 @@ const XMLCh KeyDescriptor::TYPE_NAME[] = UNICODE_LITERAL_17(K,e,y const XMLCh KeyDescriptor::USE_ATTRIB_NAME[] = UNICODE_LITERAL_3(u,s,e); const XMLCh KeyDescriptor::KEYTYPE_ENCRYPTION[] = UNICODE_LITERAL_10(e,n,c,r,y,p,t,i,o,n); const XMLCh KeyDescriptor::KEYTYPE_SIGNING[] = UNICODE_LITERAL_7(s,i,g,n,i,n,g); +const XMLCh Keywords::LOCAL_NAME[] = UNICODE_LITERAL_8(K,e,y,w,o,r,d,s); +const XMLCh Keywords::TYPE_NAME[] = UNICODE_LITERAL_12(K,e,y,w,o,r,d,s,T,y,p,e); +const XMLCh Keywords::LANG_ATTRIB_NAME[] = UNICODE_LITERAL_4(l,a,n,g); const XMLCh Logo::LOCAL_NAME[] = UNICODE_LITERAL_4(L,o,g,o); const XMLCh Logo::TYPE_NAME[] = UNICODE_LITERAL_8(L,o,g,o,T,y,p,e); const XMLCh Logo::LANG_ATTRIB_NAME[] = UNICODE_LITERAL_4(l,a,n,g); @@ -3177,12 +3002,32 @@ const XMLCh OrganizationURL::LOCAL_NAME[] = UNICODE_LITERAL_15(O,r,g const XMLCh PDPDescriptor::LOCAL_NAME[] = UNICODE_LITERAL_13(P,D,P,D,e,s,c,r,i,p,t,o,r); const XMLCh PDPDescriptor::TYPE_NAME[] = UNICODE_LITERAL_17(P,D,P,D,e,s,c,r,i,p,t,o,r,T,y,p,e); const XMLCh PrivacyStatementURL::LOCAL_NAME[] = UNICODE_LITERAL_19(P,r,i,v,a,c,y,S,t,a,t,e,m,e,n,t,U,R,L); +/* +const XMLCh Publication::LOCAL_NAME[] = UNICODE_LITERAL_11(P,u,b,l,i,c,a,t,i,o,n); +const XMLCh Publication::TYPE_NAME[] = UNICODE_LITERAL_15(P,u,b,l,i,c,a,t,i,o,n,T,y,p,e); +const XMLCh Publication::PUBLISHER_ATTRIB_NAME[] = UNICODE_LITERAL_9(p,u,b,l,i,s,h,e,r); +const XMLCh Publication::CREATIONINSTANT_ATTRIB_NAME[] = UNICODE_LITERAL_15(c,r,e,a,t,i,o,n,I,n,s,t,a,n,t); +const XMLCh Publication::PUBLICATIONID_ATTRIB_NAME[] = UNICODE_LITERAL_13(p,u,b,l,i,c,a,t,i,o,n,I,d); +const XMLCh PublicationInfo::LOCAL_NAME[] = UNICODE_LITERAL_15(P,u,b,l,i,c,a,t,i,o,n,I,n,f,o); +const XMLCh PublicationInfo::TYPE_NAME[] = UNICODE_LITERAL_19(P,u,b,l,i,c,a,t,i,o,n,I,n,f,o,T,y,p,e); +const XMLCh PublicationInfo::PUBLISHER_ATTRIB_NAME[] = UNICODE_LITERAL_9(p,u,b,l,i,s,h,e,r); +const XMLCh PublicationInfo::CREATIONINSTANT_ATTRIB_NAME[] = UNICODE_LITERAL_15(c,r,e,a,t,i,o,n,I,n,s,t,a,n,t); +const XMLCh PublicationInfo::PUBLICATIONID_ATTRIB_NAME[] = UNICODE_LITERAL_13(p,u,b,l,i,c,a,t,i,o,n,I,d); +const XMLCh PublicationPath::LOCAL_NAME[] = UNICODE_LITERAL_15(P,u,b,l,i,c,a,t,i,o,n,P,a,t,h); +const XMLCh PublicationPath::TYPE_NAME[] = UNICODE_LITERAL_19(P,u,b,l,i,c,a,t,i,o,n,P,a,t,h,T,y,p,e); +*/ const XMLCh QueryDescriptorType::LOCAL_NAME[] = {chNull}; const XMLCh QueryDescriptorType::TYPE_NAME[] = UNICODE_LITERAL_19(Q,u,e,r,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e); -const XMLCh QueryDescriptorType::WANTASSERTIONSSIGNED_ATTRIB_NAME[] = UNICODE_LITERAL_20(W,a,n,t,A,s,s,e,r,t,i,o,n,s,S,i,g,n,e,d); +const XMLCh QueryDescriptorType::WANTASSERTIONSSIGNED_ATTRIB_NAME[] = UNICODE_LITERAL_20(W,a,n,t,A,s,s,e,r,t,i,o,n,s,S,i,g,n,e,d); +const XMLCh RegistrationInfo::LOCAL_NAME[] = UNICODE_LITERAL_16(R,e,g,i,s,t,r,a,t,i,o,n,I,n,f,o); +const XMLCh RegistrationInfo::TYPE_NAME[] = UNICODE_LITERAL_20(R,e,g,i,s,t,r,a,t,i,o,n,I,n,f,o,T,y,p,e); +const XMLCh RegistrationInfo::REGAUTHORITY_ATTRIB_NAME[] = UNICODE_LITERAL_21(r,e,g,i,s,t,r,a,t,i,o,n,A,u,t,h,o,r,i,t,y); +const XMLCh RegistrationInfo::REGINSTANT_ATTRIB_NAME[] = UNICODE_LITERAL_19(r,e,g,i,s,t,r,a,t,i,o,n,I,n,s,t,a,n,t); +const XMLCh RegistrationPolicy::LOCAL_NAME[] = UNICODE_LITERAL_18(R,e,g,i,s,t,r,a,t,i,o,n,P,o,l,i,c,y); const XMLCh RequestedAttribute::LOCAL_NAME[] = UNICODE_LITERAL_18(R,e,q,u,e,s,t,e,d,A,t,t,r,i,b,u,t,e); const XMLCh RequestedAttribute::TYPE_NAME[] = UNICODE_LITERAL_22(R,e,q,u,e,s,t,e,d,A,t,t,r,i,b,u,t,e,T,y,p,e); const XMLCh RequestedAttribute::ISREQUIRED_ATTRIB_NAME[] = UNICODE_LITERAL_10(i,s,R,e,q,u,i,r,e,d); +const XMLCh RequestInitiator::LOCAL_NAME[] = UNICODE_LITERAL_16(R,e,q,u,e,s,t,I,n,i,t,i,a,t,o,r); const XMLCh RoleDescriptor::LOCAL_NAME[] = UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r); const XMLCh RoleDescriptor::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,D); const XMLCh RoleDescriptor::PROTOCOLSUPPORTENUMERATION_ATTRIB_NAME[] = UNICODE_LITERAL_26(p,r,o,t,o,c,o,l,S,u,p,p,o,r,t,E,n,u,m,e,r,a,t,i,o,n); @@ -3208,3 +3053,4 @@ const XMLCh TelephoneNumber::LOCAL_NAME[] = UNICODE_LITERAL_15(T,e,l const XMLCh TimeBoundSAMLObject::VALIDUNTIL_ATTRIB_NAME[] = UNICODE_LITERAL_10(v,a,l,i,d,U,n,t,i,l); const XMLCh UIInfo::LOCAL_NAME[] = UNICODE_LITERAL_6(U,I,I,n,f,o); const XMLCh UIInfo::TYPE_NAME[] = UNICODE_LITERAL_10(U,I,I,n,f,o,T,y,p,e); +const XMLCh UsagePolicy::LOCAL_NAME[] = UNICODE_LITERAL_11(U,s,a,g,e,P,o,l,i,c,y);