From: Scott Cantor Date: Mon, 27 Nov 2006 21:26:49 +0000 (+0000) Subject: Refined ElementProxy/ElementExtensible interfaces to match Java. X-Git-Tag: 2.0-alpha1~134 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-opensaml.git;a=commitdiff_plain;h=66136f386ddbdd855e1a078e13e19ddbf64a01e2 Refined ElementProxy/ElementExtensible interfaces to match Java. --- diff --git a/saml/saml1/binding/impl/SAML1SOAPClient.cpp b/saml/saml1/binding/impl/SAML1SOAPClient.cpp index 7808510..eb78774 100644 --- a/saml/saml1/binding/impl/SAML1SOAPClient.cpp +++ b/saml/saml1/binding/impl/SAML1SOAPClient.cpp @@ -42,7 +42,7 @@ void SAML1SOAPClient::sendSAML(Request* request, const RoleDescriptor& peer, con Envelope* env = EnvelopeBuilder::buildEnvelope(); Body* body = BodyBuilder::buildBody(); env->setBody(body); - body->getXMLObjects().push_back(request); + body->getUnknownXMLObjects().push_back(request); try { send(env, peer, endpoint); m_correlate = XMLString::replicate(request->getRequestID()); @@ -64,7 +64,7 @@ Response* SAML1SOAPClient::receiveSAML() Body* body = env->getBody(); if (body && body->hasChildren()) { // Check for SAML Response. - Response* response = dynamic_cast(body->getXMLObjects().front()); + Response* response = dynamic_cast(body->getUnknownXMLObjects().front()); if (response) { // Check InResponseTo. diff --git a/saml/saml1/binding/impl/SAML1SOAPDecoder.cpp b/saml/saml1/binding/impl/SAML1SOAPDecoder.cpp index 10fd72f..7d854a1 100644 --- a/saml/saml1/binding/impl/SAML1SOAPDecoder.cpp +++ b/saml/saml1/binding/impl/SAML1SOAPDecoder.cpp @@ -88,7 +88,7 @@ XMLObject* SAML1SOAPDecoder::decode( Body* body = env->getBody(); if (body && body->hasChildren()) { - Request* request = dynamic_cast(body->getXMLObjects().front()); + Request* request = dynamic_cast(body->getUnknownXMLObjects().front()); if (request) { // Run through the policy at two layers. policy.evaluate(*env, &genericRequest); diff --git a/saml/saml1/binding/impl/SAML1SOAPEncoder.cpp b/saml/saml1/binding/impl/SAML1SOAPEncoder.cpp index 3103651..850a077 100644 --- a/saml/saml1/binding/impl/SAML1SOAPEncoder.cpp +++ b/saml/saml1/binding/impl/SAML1SOAPEncoder.cpp @@ -83,7 +83,7 @@ long SAML1SOAPEncoder::encode( Envelope* env = EnvelopeBuilder::buildEnvelope(); Body* body = BodyBuilder::buildBody(); env->setBody(body); - body->getXMLObjects().push_back(response); + body->getUnknownXMLObjects().push_back(response); if (credResolver ) { if (response->getSignature()) { log.debug("response already signed, skipping signature operation"); @@ -133,7 +133,7 @@ long SAML1SOAPEncoder::encode( Envelope* env = EnvelopeBuilder::buildEnvelope(); Body* body = BodyBuilder::buildBody(); env->setBody(body); - body->getXMLObjects().push_back(fault); + body->getUnknownXMLObjects().push_back(fault); rootElement = env->marshall(); string xmlbuf; @@ -165,7 +165,7 @@ long SAML1SOAPEncoder::encode( bool error = (env->getBody() && env->getBody()->hasChildren() && - dynamic_cast(env->getBody()->getXMLObjects().front())); + dynamic_cast(env->getBody()->getUnknownXMLObjects().front())); string xmlbuf; XMLHelper::serialize(rootElement, xmlbuf); diff --git a/saml/saml1/core/Assertions.h b/saml/saml1/core/Assertions.h index 0da3ecf..56afa7c 100644 --- a/saml/saml1/core/Assertions.h +++ b/saml/saml1/core/Assertions.h @@ -26,7 +26,6 @@ #include #include -#include #include #include #include @@ -91,7 +90,7 @@ namespace opensaml { static const XMLCh WIN_DOMAIN_QUALIFIED[]; END_XMLOBJECT; - BEGIN_XMLOBJECT2(SAML_API,SubjectConfirmationData,xmltooling::ElementProxy,xmltooling::AttributeExtensibleXMLObject,SAML 1.x SubjectConfirmationData element); + BEGIN_XMLOBJECT(SAML_API,SubjectConfirmationData,xmltooling::ElementProxy,SAML 1.x SubjectConfirmationData element); END_XMLOBJECT; BEGIN_XMLOBJECT(SAML_API,SubjectConfirmation,xmltooling::XMLObject,SAML 1.x SubjectConfirmation element); @@ -200,7 +199,7 @@ namespace opensaml { static const XMLCh TYPE_NAME[]; END_XMLOBJECT; - BEGIN_XMLOBJECT2(SAML_API,AttributeValue,xmltooling::ElementProxy,xmltooling::AttributeExtensibleXMLObject,SAML 1.x AttributeValue element); + BEGIN_XMLOBJECT(SAML_API,AttributeValue,xmltooling::ElementProxy,SAML 1.x AttributeValue element); END_XMLOBJECT; BEGIN_XMLOBJECT(SAML_API,AttributeStatement,SubjectStatement,SAML 1.x AttributeStatement element); @@ -209,10 +208,9 @@ namespace opensaml { static const XMLCh TYPE_NAME[]; END_XMLOBJECT; - BEGIN_XMLOBJECT(SAML_API,Advice,xmltooling::XMLObject,SAML 1.x Advice element); + BEGIN_XMLOBJECT(SAML_API,Advice,xmltooling::ElementExtensibleXMLObject,SAML 1.x Advice element); DECL_TYPED_CHILDREN(AssertionIDReference); DECL_TYPED_CHILDREN(Assertion); - DECL_XMLOBJECT_CHILDREN(Other); /** AdviceType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; diff --git a/saml/saml1/core/Protocols.h b/saml/saml1/core/Protocols.h index 2201d09..0d9df87 100644 --- a/saml/saml1/core/Protocols.h +++ b/saml/saml1/core/Protocols.h @@ -26,8 +26,6 @@ #include #include -#include -#include #include #include #include @@ -128,8 +126,7 @@ namespace opensaml { static xmltooling::QName VERSIONMISMATCH; END_XMLOBJECT; - BEGIN_XMLOBJECT(SAML_API,StatusDetail,xmltooling::XMLObject,SAML 1.x StatusDetail element); - DECL_XMLOBJECT_CHILDREN(Detail); + BEGIN_XMLOBJECT(SAML_API,StatusDetail,xmltooling::ElementExtensibleXMLObject,SAML 1.x StatusDetail element); /** StatusDetailType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; diff --git a/saml/saml1/core/impl/AssertionsImpl.cpp b/saml/saml1/core/impl/AssertionsImpl.cpp index a8127ab..8611788 100644 --- a/saml/saml1/core/impl/AssertionsImpl.cpp +++ b/saml/saml1/core/impl/AssertionsImpl.cpp @@ -25,7 +25,6 @@ #include "saml1/core/Assertions.h" #include -#include #include #include #include @@ -879,7 +878,7 @@ namespace opensaml { continue; } - getOthers().push_back((*i)->clone()); + getUnknownXMLObjects().push_back((*i)->clone()); } } } @@ -887,7 +886,7 @@ namespace opensaml { IMPL_XMLOBJECT_CLONE(Advice); IMPL_TYPED_CHILDREN(AssertionIDReference,m_children.end()); IMPL_TYPED_CHILDREN(Assertion,m_children.end()); - IMPL_XMLOBJECT_CHILDREN(Other,m_children.end()); + IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end()); protected: void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { @@ -897,7 +896,7 @@ namespace opensaml { // Unknown child. const XMLCh* nsURI=root->getNamespaceURI(); if (!XMLString::equals(nsURI,SAML1_NS) && nsURI && *nsURI) { - getOthers().push_back(childXMLObject); + getUnknownXMLObjects().push_back(childXMLObject); return; } diff --git a/saml/saml1/core/impl/AssertionsSchemaValidators.cpp b/saml/saml1/core/impl/AssertionsSchemaValidators.cpp index 2c48041..171331e 100644 --- a/saml/saml1/core/impl/AssertionsSchemaValidators.cpp +++ b/saml/saml1/core/impl/AssertionsSchemaValidators.cpp @@ -137,7 +137,7 @@ namespace opensaml { }; BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Advice); - const vector& anys=ptr->getOthers(); + const vector& anys=ptr->getUnknownXMLObjects(); for_each(anys.begin(),anys.end(),checkWildcardNS()); END_XMLOBJECTVALIDATOR; diff --git a/saml/saml1/core/impl/ProtocolsImpl.cpp b/saml/saml1/core/impl/ProtocolsImpl.cpp index 550367c..2e8ec5c 100644 --- a/saml/saml1/core/impl/ProtocolsImpl.cpp +++ b/saml/saml1/core/impl/ProtocolsImpl.cpp @@ -26,7 +26,6 @@ #include "saml1/core/Protocols.h" #include -#include #include #include #include @@ -544,20 +543,17 @@ namespace opensaml { StatusDetailImpl(const StatusDetailImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { - VectorOf(XMLObject) v=getDetails(); - for (vector::const_iterator i=src.m_Details.begin(); i!=src.m_Details.end(); i++) { - if (*i) { - v.push_back((*i)->clone()); - } - } + 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(StatusDetail); - IMPL_XMLOBJECT_CHILDREN(Detail,m_children.end()); + IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end()); protected: void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { - getDetails().push_back(childXMLObject); + getUnknownXMLObjects().push_back(childXMLObject); } }; diff --git a/saml/saml2/binding/impl/SAML2SOAPClient.cpp b/saml/saml2/binding/impl/SAML2SOAPClient.cpp index db6d1f5..e12a7d5 100644 --- a/saml/saml2/binding/impl/SAML2SOAPClient.cpp +++ b/saml/saml2/binding/impl/SAML2SOAPClient.cpp @@ -42,7 +42,7 @@ void SAML2SOAPClient::sendSAML(RequestAbstractType* request, const RoleDescripto Envelope* env = EnvelopeBuilder::buildEnvelope(); Body* body = BodyBuilder::buildBody(); env->setBody(body); - body->getXMLObjects().push_back(request); + body->getUnknownXMLObjects().push_back(request); try { send(env, peer, endpoint); m_correlate = XMLString::replicate(request->getID()); @@ -64,7 +64,7 @@ StatusResponseType* SAML2SOAPClient::receiveSAML() Body* body = env->getBody(); if (body && body->hasChildren()) { // Check for SAML Response. - StatusResponseType* response = dynamic_cast(body->getXMLObjects().front()); + StatusResponseType* response = dynamic_cast(body->getUnknownXMLObjects().front()); if (response) { // Check InResponseTo. diff --git a/saml/saml2/binding/impl/SAML2SOAPDecoder.cpp b/saml/saml2/binding/impl/SAML2SOAPDecoder.cpp index 092e7f4..9c10638 100644 --- a/saml/saml2/binding/impl/SAML2SOAPDecoder.cpp +++ b/saml/saml2/binding/impl/SAML2SOAPDecoder.cpp @@ -88,7 +88,7 @@ XMLObject* SAML2SOAPDecoder::decode( Body* body = env->getBody(); if (body && body->hasChildren()) { - RequestAbstractType* request = dynamic_cast(body->getXMLObjects().front()); + RequestAbstractType* request = dynamic_cast(body->getUnknownXMLObjects().front()); if (request) { // Run through the policy at two layers. policy.evaluate(*env, &genericRequest); diff --git a/saml/saml2/binding/impl/SAML2SOAPEncoder.cpp b/saml/saml2/binding/impl/SAML2SOAPEncoder.cpp index 3285ad7..7c407d9 100644 --- a/saml/saml2/binding/impl/SAML2SOAPEncoder.cpp +++ b/saml/saml2/binding/impl/SAML2SOAPEncoder.cpp @@ -83,7 +83,7 @@ long SAML2SOAPEncoder::encode( Envelope* env = EnvelopeBuilder::buildEnvelope(); Body* body = BodyBuilder::buildBody(); env->setBody(body); - body->getXMLObjects().push_back(response); + body->getUnknownXMLObjects().push_back(response); if (credResolver ) { if (response->getSignature()) { log.debug("response already signed, skipping signature operation"); @@ -133,7 +133,7 @@ long SAML2SOAPEncoder::encode( Envelope* env = EnvelopeBuilder::buildEnvelope(); Body* body = BodyBuilder::buildBody(); env->setBody(body); - body->getXMLObjects().push_back(fault); + body->getUnknownXMLObjects().push_back(fault); rootElement = env->marshall(); string xmlbuf; @@ -165,7 +165,7 @@ long SAML2SOAPEncoder::encode( bool error = (env->getBody() && env->getBody()->hasChildren() && - dynamic_cast(env->getBody()->getXMLObjects().front())); + dynamic_cast(env->getBody()->getUnknownXMLObjects().front())); string xmlbuf; XMLHelper::serialize(rootElement, xmlbuf); diff --git a/saml/saml2/core/Assertions.h b/saml/saml2/core/Assertions.h index 512b89f..c8ec2eb 100644 --- a/saml/saml2/core/Assertions.h +++ b/saml/saml2/core/Assertions.h @@ -26,8 +26,6 @@ #include #include -#include -#include #include #include #include @@ -148,7 +146,7 @@ namespace opensaml { static const XMLCh TYPE_NAME[]; END_XMLOBJECT; - BEGIN_XMLOBJECT2(SAML_API,SubjectConfirmationData,xmltooling::ElementProxy,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 SubjectConfirmationData element); + BEGIN_XMLOBJECT(SAML_API,SubjectConfirmationData,xmltooling::ElementProxy,SAML 2.0 SubjectConfirmationData element); DECL_DATETIME_ATTRIB(NotBefore,NOTBEFORE); DECL_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER); DECL_STRING_ATTRIB(Recipient,RECIPIENT); @@ -265,7 +263,7 @@ namespace opensaml { static const XMLCh DECISION_INDETERMINATE[]; END_XMLOBJECT; - BEGIN_XMLOBJECT2(SAML_API,AttributeValue,xmltooling::ElementProxy,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 AttributeValue element); + BEGIN_XMLOBJECT(SAML_API,AttributeValue,xmltooling::ElementProxy,SAML 2.0 AttributeValue element); END_XMLOBJECT; BEGIN_XMLOBJECT(SAML_API,Attribute,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 Attribute element); @@ -296,12 +294,11 @@ namespace opensaml { BEGIN_XMLOBJECT(SAML_API,EncryptedAssertion,EncryptedElementType,SAML 2.0 EncryptedAssertion element); END_XMLOBJECT; - BEGIN_XMLOBJECT(SAML_API,Advice,xmltooling::XMLObject,SAML 2.0 Advice element); + BEGIN_XMLOBJECT(SAML_API,Advice,xmltooling::ElementExtensibleXMLObject,SAML 2.0 Advice element); DECL_TYPED_CHILDREN(AssertionIDRef); DECL_TYPED_CHILDREN(AssertionURIRef); DECL_TYPED_CHILDREN(Assertion); DECL_TYPED_CHILDREN(EncryptedAssertion); - DECL_XMLOBJECT_CHILDREN(Other); /** AdviceType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; diff --git a/saml/saml2/core/Protocols.h b/saml/saml2/core/Protocols.h index c93c758..fa8360c 100644 --- a/saml/saml2/core/Protocols.h +++ b/saml/saml2/core/Protocols.h @@ -45,7 +45,7 @@ namespace opensaml { DECL_XMLOBJECT_SIMPLE(SAML_API,RespondTo,Name,SAML 2.0 third-party request RespondTo extension element); - BEGIN_XMLOBJECT(SAML_API,Extensions,xmltooling::ElementProxy,SAML 2.0 protocol Extensions element); + BEGIN_XMLOBJECT(SAML_API,Extensions,xmltooling::ElementExtensibleXMLObject,SAML 2.0 protocol Extensions element); /** ExtensionsType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; @@ -126,8 +126,7 @@ namespace opensaml { /*@{*/ END_XMLOBJECT; - BEGIN_XMLOBJECT(SAML_API,StatusDetail,xmltooling::XMLObject,SAML 2.0 StatusDetail element); - DECL_XMLOBJECT_CHILDREN(Detail); + BEGIN_XMLOBJECT(SAML_API,StatusDetail,xmltooling::ElementExtensibleXMLObject,SAML 2.0 StatusDetail element); /** StatusDetailType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; diff --git a/saml/saml2/core/impl/Assertions20Impl.cpp b/saml/saml2/core/impl/Assertions20Impl.cpp index d570aba..7535d78 100644 --- a/saml/saml2/core/impl/Assertions20Impl.cpp +++ b/saml/saml2/core/impl/Assertions20Impl.cpp @@ -26,7 +26,6 @@ #include "saml2/core/Assertions.h" #include -#include #include #include #include @@ -546,11 +545,8 @@ namespace opensaml { setInResponseTo(src.getInResponseTo()); setAddress(src.getAddress()); VectorOf(KeyInfo) v=getKeyInfos(); - for (vector::const_iterator i=src.m_KeyInfos.begin(); i!=src.m_KeyInfos.end(); i++) { - if (*i) { - v.push_back((*i)->cloneKeyInfo()); - } - } + for (vector::const_iterator i=src.m_KeyInfos.begin(); i!=src.m_KeyInfos.end(); ++i) + v.push_back((*i)->cloneKeyInfo()); } IMPL_XMLOBJECT_CLONE(KeyInfoConfirmationDataType); @@ -1301,7 +1297,7 @@ namespace opensaml { continue; } - getOthers().push_back((*i)->clone()); + getUnknownXMLObjects().push_back((*i)->clone()); } } } @@ -1311,7 +1307,7 @@ namespace opensaml { IMPL_TYPED_CHILDREN(AssertionURIRef,m_children.end()); IMPL_TYPED_CHILDREN(Assertion,m_children.end()); IMPL_TYPED_CHILDREN(EncryptedAssertion,m_children.end()); - IMPL_XMLOBJECT_CHILDREN(Other,m_children.end()); + IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end()); protected: void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { @@ -1323,7 +1319,7 @@ namespace opensaml { // Unknown child. const XMLCh* nsURI=root->getNamespaceURI(); if (!XMLString::equals(nsURI,SAML20_NS) && nsURI && *nsURI) { - getOthers().push_back(childXMLObject); + getUnknownXMLObjects().push_back(childXMLObject); return; } diff --git a/saml/saml2/core/impl/Assertions20SchemaValidators.cpp b/saml/saml2/core/impl/Assertions20SchemaValidators.cpp index 2d47a27..d979396 100644 --- a/saml/saml2/core/impl/Assertions20SchemaValidators.cpp +++ b/saml/saml2/core/impl/Assertions20SchemaValidators.cpp @@ -172,7 +172,7 @@ namespace opensaml { }; BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Advice); - const vector& anys=ptr->getOthers(); + const vector& anys=ptr->getUnknownXMLObjects(); for_each(anys.begin(),anys.end(),checkWildcardNS()); END_XMLOBJECTVALIDATOR; diff --git a/saml/saml2/core/impl/Protocols20Impl.cpp b/saml/saml2/core/impl/Protocols20Impl.cpp index fa407d8..4db1cba 100644 --- a/saml/saml2/core/impl/Protocols20Impl.cpp +++ b/saml/saml2/core/impl/Protocols20Impl.cpp @@ -26,7 +26,6 @@ #include "saml2/core/Protocols.h" #include -#include #include #include #include @@ -69,7 +68,7 @@ namespace opensaml { //TODO need unit test for this, using objects from another namespace class SAML_DLLLOCAL ExtensionsImpl : public virtual Extensions, - public AbstractElementProxy, + public AbstractComplexElement, public AbstractDOMCachingXMLObject, public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller @@ -82,22 +81,21 @@ namespace opensaml { } ExtensionsImpl(const ExtensionsImpl& src) - : AbstractXMLObject(src), AbstractElementProxy(src), AbstractDOMCachingXMLObject(src) { - for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { - if (*i) { - getXMLObjects().push_back((*i)->clone()); - } - } + : 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. const XMLCh* nsURI=root->getNamespaceURI(); if (!XMLString::equals(nsURI,SAML20P_NS) && nsURI && *nsURI) { - getXMLObjects().push_back(childXMLObject); + getUnknownXMLObjects().push_back(childXMLObject); return; } @@ -169,21 +167,17 @@ namespace opensaml { StatusDetailImpl(const StatusDetailImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { - VectorOf(XMLObject) v=getDetails(); - for (vector::const_iterator i=src.m_Details.begin(); i!=src.m_Details.end(); i++) { - if (*i) { - v.push_back((*i)->clone()); - } - } + 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(StatusDetail); - IMPL_XMLOBJECT_CHILDREN(Detail,m_children.end()); + IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end()); protected: void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { - getDetails().push_back(childXMLObject); - AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); + getUnknownXMLObjects().push_back(childXMLObject); } }; diff --git a/saml/saml2/core/impl/Protocols20SchemaValidators.cpp b/saml/saml2/core/impl/Protocols20SchemaValidators.cpp index 109f518..42cb5b7 100644 --- a/saml/saml2/core/impl/Protocols20SchemaValidators.cpp +++ b/saml/saml2/core/impl/Protocols20SchemaValidators.cpp @@ -85,7 +85,7 @@ namespace opensaml { BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Extensions); if (!ptr->hasChildren()) throw ValidationException("Extensions must have at least one child element."); - const list& anys=ptr->getXMLObjects(); + const vector& anys=ptr->getUnknownXMLObjects(); for_each(anys.begin(),anys.end(),checkWildcardNS()); END_XMLOBJECTVALIDATOR; diff --git a/saml/saml2/metadata/Metadata.h b/saml/saml2/metadata/Metadata.h index 7b995a0..7f5f97f 100644 --- a/saml/saml2/metadata/Metadata.h +++ b/saml/saml2/metadata/Metadata.h @@ -103,7 +103,7 @@ namespace opensaml { DECL_SIMPLE_CONTENT(URL); END_XMLOBJECT; - BEGIN_XMLOBJECT(SAML_API,Extensions,xmltooling::ElementProxy,SAML 2.0 Extensions element); + BEGIN_XMLOBJECT(SAML_API,Extensions,xmltooling::ElementExtensibleXMLObject,SAML 2.0 Extensions element); /** ExtensionsType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; @@ -173,7 +173,7 @@ namespace opensaml { DECL_TYPED_CHILDREN(ContactPerson); END_XMLOBJECT; - BEGIN_XMLOBJECT2(SAML_API,EndpointType,xmltooling::ElementProxy,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 EndpointType type); + BEGIN_XMLOBJECT(SAML_API,EndpointType,xmltooling::ElementProxy,SAML 2.0 EndpointType type); DECL_STRING_ATTRIB(Binding,BINDING); DECL_STRING_ATTRIB(Location,LOCATION); DECL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION); diff --git a/saml/saml2/metadata/impl/AbstractMetadataProvider.cpp b/saml/saml2/metadata/impl/AbstractMetadataProvider.cpp index e113094..46e4297 100644 --- a/saml/saml2/metadata/impl/AbstractMetadataProvider.cpp +++ b/saml/saml2/metadata/impl/AbstractMetadataProvider.cpp @@ -83,9 +83,9 @@ void AbstractMetadataProvider::index(EntityDescriptor* site, time_t validUntil) if ((*i)->hasSupport(samlconstants::SAML10_PROTOCOL_ENUM) || (*i)->hasSupport(samlconstants::SAML11_PROTOCOL_ENUM)) { // Check for SourceID extension element. const Extensions* exts=(*i)->getExtensions(); - if (exts) { - const list& children=exts->getXMLObjects(); - for (list::const_iterator ext=children.begin(); ext!=children.end(); ext++) { + if (exts && exts->hasChildren()) { + const vector& children=exts->getUnknownXMLObjects(); + for (vector::const_iterator ext=children.begin(); ext!=children.end(); ++ext) { SourceID* sid=dynamic_cast(*ext); if (sid) { auto_ptr_char sourceid(sid->getID()); diff --git a/saml/saml2/metadata/impl/MetadataImpl.cpp b/saml/saml2/metadata/impl/MetadataImpl.cpp index d2fea81..525a93e 100644 --- a/saml/saml2/metadata/impl/MetadataImpl.cpp +++ b/saml/saml2/metadata/impl/MetadataImpl.cpp @@ -26,7 +26,6 @@ #include "saml2/metadata/MetadataKeyInfoIterator.h" #include -#include #include #include #include @@ -239,7 +238,7 @@ namespace opensaml { }; class SAML_DLLLOCAL ExtensionsImpl : public virtual Extensions, - public AbstractElementProxy, + public AbstractComplexElement, public AbstractDOMCachingXMLObject, public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller @@ -252,22 +251,21 @@ namespace opensaml { } ExtensionsImpl(const ExtensionsImpl& src) - : AbstractXMLObject(src), AbstractElementProxy(src), AbstractDOMCachingXMLObject(src) { - for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { - if (*i) { - getXMLObjects().push_back((*i)->clone()); - } - } + : 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. const XMLCh* nsURI=root->getNamespaceURI(); if (!XMLString::equals(nsURI,SAML20MD_NS) && nsURI && *nsURI) { - getXMLObjects().push_back(childXMLObject); + getUnknownXMLObjects().push_back(childXMLObject); return; } @@ -557,8 +555,8 @@ namespace opensaml { }; class SAML_DLLLOCAL EndpointTypeImpl : public virtual EndpointType, - public AbstractElementProxy, public AbstractAttributeExtensibleXMLObject, + public AbstractComplexElement, public AbstractDOMCachingXMLObject, public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller @@ -584,22 +582,23 @@ namespace opensaml { } EndpointTypeImpl(const EndpointTypeImpl& src) - : AbstractXMLObject(src), AbstractElementProxy(src), - AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { + : AbstractXMLObject(src), + AbstractAttributeExtensibleXMLObject(src), + AbstractComplexElement(src), + AbstractDOMCachingXMLObject(src) { setBinding(src.getBinding()); setLocation(src.getLocation()); setResponseLocation(src.getResponseLocation()); - for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { - if (*i) { - getXMLObjects().push_back((*i)->clone()); - } - } + 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(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) { if (!qualifiedName.hasNamespaceURI()) { @@ -630,7 +629,7 @@ namespace opensaml { // Unknown child. const XMLCh* nsURI=root->getNamespaceURI(); if (!XMLString::equals(nsURI,SAML20MD_NS) && nsURI && *nsURI) { - getXMLObjects().push_back(childXMLObject); + getUnknownXMLObjects().push_back(childXMLObject); return; } AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); diff --git a/saml/saml2/metadata/impl/MetadataSchemaValidators.cpp b/saml/saml2/metadata/impl/MetadataSchemaValidators.cpp index 179dd76..e954d21 100644 --- a/saml/saml2/metadata/impl/MetadataSchemaValidators.cpp +++ b/saml/saml2/metadata/impl/MetadataSchemaValidators.cpp @@ -86,7 +86,7 @@ namespace opensaml { BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Extensions); if (!ptr->hasChildren()) throw ValidationException("Extensions must have at least one child element."); - const list& anys=ptr->getXMLObjects(); + const vector& anys=ptr->getUnknownXMLObjects(); for_each(anys.begin(),anys.end(),checkWildcardNS()); END_XMLOBJECTVALIDATOR; @@ -127,7 +127,7 @@ namespace opensaml { BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,EndpointType); XMLOBJECTVALIDATOR_REQUIRE(EndpointType,Binding); XMLOBJECTVALIDATOR_REQUIRE(EndpointType,Location); - const list& anys=ptr->getXMLObjects(); + const vector& anys=ptr->getUnknownXMLObjects(); for_each(anys.begin(),anys.end(),checkWildcardNS()); END_XMLOBJECTVALIDATOR; diff --git a/samltest/saml2/core/impl/Advice20Test.h b/samltest/saml2/core/impl/Advice20Test.h index 8aed1a2..af33835 100644 --- a/samltest/saml2/core/impl/Advice20Test.h +++ b/samltest/saml2/core/impl/Advice20Test.h @@ -44,7 +44,7 @@ public: TSM_ASSERT_EQUALS("# of AssertionURIRef child elements", 0, advice->getAssertionURIRefs().size()); TSM_ASSERT_EQUALS("# of Assertion child elements", 0, advice->getAssertions().size()); TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 0, advice->getEncryptedAssertions().size()); - TSM_ASSERT_EQUALS("# of Other child elements", 0, advice->getOthers().size()); + TSM_ASSERT_EQUALS("# of Other child elements", 0, advice->getUnknownXMLObjects().size()); } void testChildElementsUnmarshall() { @@ -56,7 +56,7 @@ public: TSM_ASSERT_EQUALS("# of AssertionURIRef child elements", 2, advice->getAssertionURIRefs().size()); TSM_ASSERT_EQUALS("# of Assertion child elements", 2, advice->getAssertions().size()); TSM_ASSERT_EQUALS("# of EncryptedAssertion child elements", 1, advice->getEncryptedAssertions().size()); - TSM_ASSERT_EQUALS("# of Other child elements", 0, advice->getOthers().size()); + TSM_ASSERT_EQUALS("# of Other child elements", 0, advice->getUnknownXMLObjects().size()); } void testSingleElementMarshall() { diff --git a/samltest/saml2/core/impl/StatusDetail20Test.h b/samltest/saml2/core/impl/StatusDetail20Test.h index f31544c..df9805d 100644 --- a/samltest/saml2/core/impl/StatusDetail20Test.h +++ b/samltest/saml2/core/impl/StatusDetail20Test.h @@ -36,7 +36,7 @@ public: auto_ptr xo(unmarshallElement(singleElementFile)); StatusDetail* sd= dynamic_cast(xo.get()); TS_ASSERT(sd!=NULL); - TSM_ASSERT_EQUALS("StatusDetail child elements", sd->getDetails().size(), 0); + TSM_ASSERT_EQUALS("StatusDetail child elements", sd->getUnknownXMLObjects().size(), 0); } //TODO test with some XMLObject child elements from another namespace @@ -44,7 +44,7 @@ public: auto_ptr xo(unmarshallElement(childElementsFile)); StatusDetail* sd= dynamic_cast(xo.get()); TS_ASSERT(sd!=NULL); - TSM_ASSERT_EQUALS("StatusDetail child elements", sd->getDetails().size(), 3); + TSM_ASSERT_EQUALS("StatusDetail child elements", sd->getUnknownXMLObjects().size(), 3); } void testSingleElementMarshall() {