https://issues.shibboleth.net/jira/browse/SSPCPP-304
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / impl / MetadataImpl.cpp
1 /*
2  *  Copyright 2001-2010 Internet2
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * MetadataImpl.cpp
19  *
20  * Implementation classes for SAML 2.0 Metadata schema.
21  */
22
23 #include "internal.h"
24 #include "exceptions.h"
25 #include "saml2/metadata/Metadata.h"
26 #include "signature/ContentReference.h"
27
28 #include <xmltooling/AbstractComplexElement.h>
29 #include <xmltooling/AbstractSimpleElement.h>
30 #include <xmltooling/XMLToolingConfig.h>
31 #include <xmltooling/encryption/Encryption.h>
32 #include <xmltooling/impl/AnyElement.h>
33 #include <xmltooling/io/AbstractXMLObjectMarshaller.h>
34 #include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
35 #include <xmltooling/security/CredentialCriteria.h>
36 #include <xmltooling/security/CredentialResolver.h>
37 #include <xmltooling/signature/KeyInfo.h>
38 #include <xmltooling/signature/Signature.h>
39 #include <xmltooling/util/DateTime.h>
40 #include <xmltooling/util/XMLHelper.h>
41
42 #include <ctime>
43 #include <xercesc/util/XMLUniDefs.hpp>
44 #include <xsec/framework/XSECDefs.hpp>
45
46 using namespace samlconstants;
47 using namespace opensaml::saml2md;
48 using namespace opensaml::saml2;
49 using namespace xmlencryption;
50 using namespace xmlsignature;
51 using namespace xmltooling;
52 using namespace std;
53 using xmlconstants::XMLSIG_NS;
54 using xmlconstants::XML_BOOL_NULL;
55
56 #if defined (_MSC_VER)
57     #pragma warning( push )
58     #pragma warning( disable : 4250 4251 )
59 #endif
60
61 namespace opensaml {
62     namespace saml2md {
63
64         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AffiliateMember);
65         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AttributeProfile);
66         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,Company);
67         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,EmailAddress);
68         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,GivenName);
69         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,NameIDFormat);
70         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,SurName);
71         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,TelephoneNumber);
72
73         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,ActionNamespace);
74         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,SourceID);
75
76         class SAML_DLLLOCAL localizedNameTypeImpl : public virtual localizedNameType,
77             public AbstractSimpleElement,
78             public AbstractDOMCachingXMLObject,
79             public AbstractXMLObjectMarshaller,
80             public AbstractXMLObjectUnmarshaller
81         {
82             void init() {
83                 m_Lang=nullptr;
84                 m_LangPrefix=nullptr;
85             }
86
87         protected:
88             localizedNameTypeImpl() {
89                 init();
90             }
91
92         public:
93             virtual ~localizedNameTypeImpl() {
94                 XMLString::release(&m_Lang);
95                 XMLString::release(&m_LangPrefix);
96             }
97
98             localizedNameTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
99                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
100                 init();
101             }
102
103             localizedNameTypeImpl(const localizedNameTypeImpl& src)
104                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
105                 init();
106                 setLang(src.getLang());
107                 if (src.m_LangPrefix)
108                     m_LangPrefix = XMLString::replicate(src.m_LangPrefix);
109             }
110
111             IMPL_XMLOBJECT_CLONE(localizedNameType);
112             IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh);
113
114         protected:
115             void marshallAttributes(DOMElement* domElement) const {
116                 if (m_Lang && *m_Lang) {
117                     DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS,LANG_ATTRIB_NAME);
118                     if (m_LangPrefix && *m_LangPrefix)
119                         attr->setPrefix(m_LangPrefix);
120                     attr->setNodeValue(m_Lang);
121                     domElement->setAttributeNodeNS(attr);
122                 }
123             }
124
125             void processAttribute(const DOMAttr* attribute) {
126                 if (XMLHelper::isNodeNamed(attribute, xmlconstants::XML_NS, LANG_ATTRIB_NAME)) {
127                     setLang(attribute->getValue());
128                     const XMLCh* temp = attribute->getPrefix();
129                     if (temp && *temp && !XMLString::equals(temp, xmlconstants::XML_NS))
130                         m_LangPrefix = XMLString::replicate(temp);
131                     return;
132                 }
133                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
134             }
135         };
136
137         class SAML_DLLLOCAL localizedURITypeImpl : public virtual localizedURIType,
138             public AbstractSimpleElement,
139             public AbstractDOMCachingXMLObject,
140             public AbstractXMLObjectMarshaller,
141             public AbstractXMLObjectUnmarshaller
142         {
143             void init() {
144                 m_Lang=nullptr;
145                 m_LangPrefix=nullptr;
146             }
147
148         protected:
149             localizedURITypeImpl() {
150                 init();
151             }
152
153         public:
154             virtual ~localizedURITypeImpl() {
155                 XMLString::release(&m_Lang);
156                 XMLString::release(&m_LangPrefix);
157             }
158
159             localizedURITypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
160                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
161                 init();
162             }
163
164             localizedURITypeImpl(const localizedURITypeImpl& src)
165                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
166                 init();
167                 setLang(src.getLang());
168                 if (src.m_LangPrefix)
169                     m_LangPrefix = XMLString::replicate(src.m_LangPrefix);
170             }
171
172             IMPL_XMLOBJECT_CLONE(localizedURIType);
173             IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh);
174
175         protected:
176             void marshallAttributes(DOMElement* domElement) const {
177                 if (m_Lang && *m_Lang) {
178                     DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS,LANG_ATTRIB_NAME);
179                     if (m_LangPrefix && *m_LangPrefix)
180                         attr->setPrefix(m_LangPrefix);
181                     attr->setNodeValue(m_Lang);
182                     domElement->setAttributeNodeNS(attr);
183                 }
184             }
185
186             void processAttribute(const DOMAttr* attribute) {
187                 if (XMLHelper::isNodeNamed(attribute, xmlconstants::XML_NS, LANG_ATTRIB_NAME)) {
188                     setLang(attribute->getValue());
189                     const XMLCh* temp = attribute->getPrefix();
190                     if (temp && *temp && !XMLString::equals(temp, xmlconstants::XML_NS))
191                         m_LangPrefix = XMLString::replicate(temp);
192                     return;
193                 }
194                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
195             }
196         };
197
198         class SAML_DLLLOCAL OrganizationNameImpl : public virtual OrganizationName, public localizedNameTypeImpl
199         {
200         public:
201             virtual ~OrganizationNameImpl() {}
202
203             OrganizationNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
204                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
205
206             OrganizationNameImpl(const OrganizationNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
207
208             IMPL_XMLOBJECT_CLONE(OrganizationName);
209             localizedNameType* clonelocalizedNameType() const {
210                 return new OrganizationNameImpl(*this);
211             }
212         };
213
214         class SAML_DLLLOCAL OrganizationDisplayNameImpl : public virtual OrganizationDisplayName, public localizedNameTypeImpl
215         {
216         public:
217             virtual ~OrganizationDisplayNameImpl() {}
218
219             OrganizationDisplayNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
220                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
221
222             OrganizationDisplayNameImpl(const OrganizationDisplayNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
223
224             IMPL_XMLOBJECT_CLONE(OrganizationDisplayName);
225             localizedNameType* clonelocalizedNameType() const {
226                 return new OrganizationDisplayNameImpl(*this);
227             }
228         };
229
230         class SAML_DLLLOCAL OrganizationURLImpl : public virtual OrganizationURL, public localizedURITypeImpl
231         {
232         public:
233             virtual ~OrganizationURLImpl() {}
234
235             OrganizationURLImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
236                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
237
238             OrganizationURLImpl(const OrganizationURLImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {}
239
240             IMPL_XMLOBJECT_CLONE(OrganizationURL);
241             localizedURIType* clonelocalizedURIType() const {
242                 return new OrganizationURLImpl(*this);
243             }
244         };
245
246         class SAML_DLLLOCAL ServiceNameImpl : public virtual ServiceName, public localizedNameTypeImpl
247         {
248         public:
249             virtual ~ServiceNameImpl() {}
250
251             ServiceNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
252                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
253
254             ServiceNameImpl(const ServiceNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
255
256             IMPL_XMLOBJECT_CLONE(ServiceName);
257             localizedNameType* clonelocalizedNameType() const {
258                 return new ServiceNameImpl(*this);
259             }
260         };
261
262         class SAML_DLLLOCAL ServiceDescriptionImpl : public virtual ServiceDescription, public localizedNameTypeImpl
263         {
264         public:
265             virtual ~ServiceDescriptionImpl() {}
266
267             ServiceDescriptionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
268                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
269
270             ServiceDescriptionImpl(const ServiceDescriptionImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
271
272             IMPL_XMLOBJECT_CLONE(ServiceDescription);
273             localizedNameType* clonelocalizedNameType() const {
274                 return new ServiceDescriptionImpl(*this);
275             }
276         };
277
278         class SAML_DLLLOCAL ExtensionsImpl : public virtual Extensions,
279             public AbstractComplexElement,
280             public AbstractDOMCachingXMLObject,
281             public AbstractXMLObjectMarshaller,
282             public AbstractXMLObjectUnmarshaller
283         {
284         public:
285             virtual ~ExtensionsImpl() {}
286
287             ExtensionsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
288                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
289             }
290
291             ExtensionsImpl(const ExtensionsImpl& src)
292                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
293                 VectorOf(XMLObject) v=getUnknownXMLObjects();
294                 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
295                     v.push_back((*i)->clone());
296             }
297
298             IMPL_XMLOBJECT_CLONE(Extensions);
299             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
300
301         protected:
302             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
303                 // Unknown child.
304                 const XMLCh* nsURI=root->getNamespaceURI();
305                 if (!XMLString::equals(nsURI,SAML20MD_NS) && nsURI && *nsURI) {
306                     getUnknownXMLObjects().push_back(childXMLObject);
307                     return;
308                 }
309
310                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
311             }
312         };
313
314         class SAML_DLLLOCAL OrganizationImpl : public virtual Organization,
315             public AbstractComplexElement,
316             public AbstractAttributeExtensibleXMLObject,
317             public AbstractDOMCachingXMLObject,
318             public AbstractXMLObjectMarshaller,
319             public AbstractXMLObjectUnmarshaller
320         {
321             list<XMLObject*>::iterator m_pos_OrganizationDisplayName;
322             list<XMLObject*>::iterator m_pos_OrganizationURL;
323
324             void init() {
325                 m_children.push_back(nullptr);
326                 m_children.push_back(nullptr);
327                 m_children.push_back(nullptr);
328                 m_Extensions=nullptr;
329                 m_pos_Extensions=m_children.begin();
330                 m_pos_OrganizationDisplayName=m_pos_Extensions;
331                 ++m_pos_OrganizationDisplayName;
332                 m_pos_OrganizationURL=m_pos_OrganizationDisplayName;
333                 ++m_pos_OrganizationURL;
334             }
335         public:
336             virtual ~OrganizationImpl() {}
337
338             OrganizationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
339                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
340                 init();
341             }
342
343             OrganizationImpl(const OrganizationImpl& src)
344                     : AbstractXMLObject(src), AbstractComplexElement(src),
345                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
346                 init();
347                 if (src.getExtensions())
348                     setExtensions(src.getExtensions()->cloneExtensions());
349                 VectorOf(OrganizationName) v=getOrganizationNames();
350                 for (vector<OrganizationName*>::const_iterator i=src.m_OrganizationNames.begin(); i!=src.m_OrganizationNames.end(); i++) {
351                     if (*i) {
352                         v.push_back((*i)->cloneOrganizationName());
353                     }
354                 }
355                 VectorOf(OrganizationDisplayName) w=getOrganizationDisplayNames();
356                 for (vector<OrganizationDisplayName*>::const_iterator j=src.m_OrganizationDisplayNames.begin(); j!=src.m_OrganizationDisplayNames.end(); j++) {
357                     if (*j) {
358                         w.push_back((*j)->cloneOrganizationDisplayName());
359                     }
360                 }
361                 VectorOf(OrganizationURL) x=getOrganizationURLs();
362                 for (vector<OrganizationURL*>::const_iterator k=src.m_OrganizationURLs.begin(); k!=src.m_OrganizationURLs.end(); k++) {
363                     if (*k) {
364                         x.push_back((*k)->cloneOrganizationURL());
365                     }
366                 }
367             }
368
369             IMPL_XMLOBJECT_CLONE(Organization);
370             IMPL_TYPED_CHILD(Extensions);
371             IMPL_TYPED_CHILDREN(OrganizationName,m_pos_OrganizationDisplayName);
372             IMPL_TYPED_CHILDREN(OrganizationDisplayName,m_pos_OrganizationURL);
373             IMPL_TYPED_CHILDREN(OrganizationURL,m_children.end());
374
375         protected:
376             void marshallAttributes(DOMElement* domElement) const {
377                 marshallExtensionAttributes(domElement);
378             }
379
380             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
381                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
382                 PROC_TYPED_CHILDREN(OrganizationName,SAML20MD_NS,false);
383                 PROC_TYPED_CHILDREN(OrganizationDisplayName,SAML20MD_NS,false);
384                 PROC_TYPED_CHILDREN(OrganizationURL,SAML20MD_NS,false);
385                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
386             }
387
388             void processAttribute(const DOMAttr* attribute) {
389                 unmarshallExtensionAttribute(attribute);
390             }
391         };
392
393         class SAML_DLLLOCAL ContactPersonImpl : public virtual ContactPerson,
394             public AbstractComplexElement,
395             public AbstractAttributeExtensibleXMLObject,
396             public AbstractDOMCachingXMLObject,
397             public AbstractXMLObjectMarshaller,
398             public AbstractXMLObjectUnmarshaller
399         {
400             list<XMLObject*>::iterator m_pos_TelephoneNumber;
401
402             void init() {
403                 m_ContactType=nullptr;
404                 m_children.push_back(nullptr);
405                 m_children.push_back(nullptr);
406                 m_children.push_back(nullptr);
407                 m_children.push_back(nullptr);
408                 m_children.push_back(nullptr);
409                 m_Extensions=nullptr;
410                 m_Company=nullptr;
411                 m_GivenName=nullptr;
412                 m_SurName=nullptr;
413                 m_pos_Extensions=m_children.begin();
414                 m_pos_Company=m_pos_Extensions;
415                 ++m_pos_Company;
416                 m_pos_GivenName=m_pos_Company;
417                 ++m_pos_GivenName;
418                 m_pos_SurName=m_pos_GivenName;
419                 ++m_pos_SurName;
420                 m_pos_TelephoneNumber=m_pos_SurName;
421                 ++m_pos_TelephoneNumber;
422             }
423         public:
424             virtual ~ContactPersonImpl() {
425                 XMLString::release(&m_ContactType);
426             }
427
428             ContactPersonImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
429                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
430                 init();
431             }
432
433             ContactPersonImpl(const ContactPersonImpl& src)
434                     : AbstractXMLObject(src), AbstractComplexElement(src),
435                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
436                 init();
437                 if (src.getExtensions())
438                     setExtensions(src.getExtensions()->cloneExtensions());
439                 if (src.getCompany())
440                     setCompany(src.getCompany()->cloneCompany());
441                 if (src.getGivenName())
442                     setGivenName(src.getGivenName()->cloneGivenName());
443                 if (src.getSurName())
444                     setSurName(src.getSurName()->cloneSurName());
445
446                 VectorOf(EmailAddress) v=getEmailAddresss();
447                 for (vector<EmailAddress*>::const_iterator i=src.m_EmailAddresss.begin(); i!=src.m_EmailAddresss.end(); i++) {
448                     if (*i) {
449                         v.push_back((*i)->cloneEmailAddress());
450                     }
451                 }
452                 VectorOf(TelephoneNumber) w=getTelephoneNumbers();
453                 for (vector<TelephoneNumber*>::const_iterator j=src.m_TelephoneNumbers.begin(); j!=src.m_TelephoneNumbers.end(); j++) {
454                     if (*j) {
455                         w.push_back((*j)->cloneTelephoneNumber());
456                     }
457                 }
458             }
459
460             IMPL_XMLOBJECT_CLONE(ContactPerson);
461             IMPL_STRING_ATTRIB(ContactType);
462             IMPL_TYPED_CHILD(Extensions);
463             IMPL_TYPED_CHILD(Company);
464             IMPL_TYPED_CHILD(GivenName);
465             IMPL_TYPED_CHILD(SurName);
466             IMPL_TYPED_CHILDREN(EmailAddress,m_pos_TelephoneNumber);
467             IMPL_TYPED_CHILDREN(TelephoneNumber,m_children.end());
468
469             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
470                 if (!qualifiedName.hasNamespaceURI()) {
471                     if (XMLString::equals(qualifiedName.getLocalPart(),CONTACTTYPE_ATTRIB_NAME)) {
472                         setContactType(value);
473                         return;
474                     }
475                 }
476                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
477             }
478
479         protected:
480             void marshallAttributes(DOMElement* domElement) const {
481                 MARSHALL_STRING_ATTRIB(ContactType,CONTACTTYPE,nullptr);
482                 marshallExtensionAttributes(domElement);
483             }
484
485             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
486                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
487                 PROC_TYPED_CHILD(Company,SAML20MD_NS,false);
488                 PROC_TYPED_CHILD(GivenName,SAML20MD_NS,false);
489                 PROC_TYPED_CHILD(SurName,SAML20MD_NS,false);
490                 PROC_TYPED_CHILDREN(EmailAddress,SAML20MD_NS,false);
491                 PROC_TYPED_CHILDREN(TelephoneNumber,SAML20MD_NS,false);
492                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
493             }
494
495             void processAttribute(const DOMAttr* attribute) {
496                 unmarshallExtensionAttribute(attribute);
497             }
498         };
499
500         class SAML_DLLLOCAL AdditionalMetadataLocationImpl : public virtual AdditionalMetadataLocation,
501             public AbstractSimpleElement,
502             public AbstractDOMCachingXMLObject,
503             public AbstractXMLObjectMarshaller,
504             public AbstractXMLObjectUnmarshaller
505         {
506             void init() {
507                 m_Namespace=nullptr;
508             }
509
510         public:
511             virtual ~AdditionalMetadataLocationImpl() {
512                 XMLString::release(&m_Namespace);
513             }
514
515             AdditionalMetadataLocationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
516                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
517                 init();
518             }
519
520             AdditionalMetadataLocationImpl(const AdditionalMetadataLocationImpl& src)
521                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
522                 init();
523             }
524
525             IMPL_XMLOBJECT_CLONE(AdditionalMetadataLocation);
526             IMPL_STRING_ATTRIB(Namespace);
527
528         protected:
529             void marshallAttributes(DOMElement* domElement) const {
530                 MARSHALL_STRING_ATTRIB(Namespace,NAMESPACE,nullptr);
531             }
532
533             void processAttribute(const DOMAttr* attribute) {
534                 PROC_STRING_ATTRIB(Namespace,NAMESPACE,nullptr);
535                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
536             }
537         };
538
539         class SAML_DLLLOCAL KeyDescriptorImpl : public virtual KeyDescriptor,
540             public AbstractComplexElement,
541             public AbstractDOMCachingXMLObject,
542             public AbstractXMLObjectMarshaller,
543             public AbstractXMLObjectUnmarshaller
544         {
545                 void init() {
546                 m_Use=nullptr;
547                 m_KeyInfo=nullptr;
548                 m_children.push_back(nullptr);
549                 m_pos_KeyInfo=m_children.begin();
550             }
551         public:
552             virtual ~KeyDescriptorImpl() {
553                 XMLString::release(&m_Use);
554             }
555
556             KeyDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
557                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
558                 init();
559             }
560
561             KeyDescriptorImpl(const KeyDescriptorImpl& src)
562                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
563                 init();
564                 setUse(src.getUse());
565                 if (src.getKeyInfo())
566                     setKeyInfo(src.getKeyInfo()->cloneKeyInfo());
567                 VectorOf(EncryptionMethod) v=getEncryptionMethods();
568                 for (vector<EncryptionMethod*>::const_iterator i=src.m_EncryptionMethods.begin(); i!=src.m_EncryptionMethods.end(); i++) {
569                     if (*i) {
570                         v.push_back((*i)->cloneEncryptionMethod());
571                     }
572                 }
573             }
574
575             IMPL_XMLOBJECT_CLONE(KeyDescriptor);
576             IMPL_STRING_ATTRIB(Use);
577             IMPL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
578             IMPL_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption,m_children.end());
579
580         protected:
581             void marshallAttributes(DOMElement* domElement) const {
582                 MARSHALL_STRING_ATTRIB(Use,USE,nullptr);
583             }
584
585             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
586                 PROC_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature,XMLSIG_NS,false);
587                 PROC_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption,SAML20MD_NS,false);
588                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
589             }
590
591             void processAttribute(const DOMAttr* attribute) {
592                 PROC_STRING_ATTRIB(Use,USE,nullptr);
593                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
594             }
595         };
596
597         class SAML_DLLLOCAL EndpointTypeImpl : public virtual EndpointType,
598             public AbstractAttributeExtensibleXMLObject,
599             public AbstractComplexElement,
600             public AbstractDOMCachingXMLObject,
601             public AbstractXMLObjectMarshaller,
602             public AbstractXMLObjectUnmarshaller
603         {
604             void init() {
605                 m_Binding=m_Location=m_ResponseLocation=nullptr;
606             }
607
608         protected:
609             EndpointTypeImpl() {
610                 init();
611             }
612
613         public:
614             virtual ~EndpointTypeImpl() {
615                 XMLString::release(&m_Binding);
616                 XMLString::release(&m_Location);
617                 XMLString::release(&m_ResponseLocation);
618             }
619
620             EndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
621                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
622             }
623
624             EndpointTypeImpl(const EndpointTypeImpl& src)
625                     : AbstractXMLObject(src),
626                         AbstractAttributeExtensibleXMLObject(src),
627                         AbstractComplexElement(src),
628                         AbstractDOMCachingXMLObject(src) {
629                 setBinding(src.getBinding());
630                 setLocation(src.getLocation());
631                 setResponseLocation(src.getResponseLocation());
632                 VectorOf(XMLObject) v=getUnknownXMLObjects();
633                 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
634                     v.push_back((*i)->clone());
635             }
636
637             IMPL_XMLOBJECT_CLONE(EndpointType);
638             IMPL_STRING_ATTRIB(Binding);
639             IMPL_STRING_ATTRIB(Location);
640             IMPL_STRING_ATTRIB(ResponseLocation);
641             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
642
643             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
644                 if (!qualifiedName.hasNamespaceURI()) {
645                     if (XMLString::equals(qualifiedName.getLocalPart(),BINDING_ATTRIB_NAME)) {
646                         setBinding(value);
647                         return;
648                     }
649                     else if (XMLString::equals(qualifiedName.getLocalPart(),LOCATION_ATTRIB_NAME)) {
650                         setLocation(value);
651                         return;
652                     }
653                     else if (XMLString::equals(qualifiedName.getLocalPart(),RESPONSELOCATION_ATTRIB_NAME)) {
654                         setResponseLocation(value);
655                         return;
656                     }
657                 }
658                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
659             }
660         protected:
661             void marshallAttributes(DOMElement* domElement) const {
662                 MARSHALL_STRING_ATTRIB(Binding,BINDING,nullptr);
663                 MARSHALL_STRING_ATTRIB(Location,LOCATION,nullptr);
664                 MARSHALL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION,nullptr);
665                 marshallExtensionAttributes(domElement);
666             }
667
668             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
669                 // Unknown child.
670                 const XMLCh* nsURI=root->getNamespaceURI();
671                 if (!XMLString::equals(nsURI,SAML20MD_NS) && nsURI && *nsURI) {
672                     getUnknownXMLObjects().push_back(childXMLObject);
673                     return;
674                 }
675                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
676             }
677
678             void processAttribute(const DOMAttr* attribute) {
679                 unmarshallExtensionAttribute(attribute);
680             }
681         };
682
683         class SAML_DLLLOCAL IndexedEndpointTypeImpl : public virtual IndexedEndpointType, public EndpointTypeImpl
684         {
685             void init() {
686                 m_Index=nullptr;
687                 m_isDefault=XML_BOOL_NULL;
688             }
689
690         protected:
691             IndexedEndpointTypeImpl() {
692                 init();
693             }
694         public:
695             virtual ~IndexedEndpointTypeImpl() {
696                 XMLString::release(&m_Index);
697             }
698
699             IndexedEndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
700                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
701
702             IndexedEndpointTypeImpl(const IndexedEndpointTypeImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {
703                 setIndex(src.m_Index);
704                 isDefault(src.m_isDefault);
705             }
706
707             IMPL_XMLOBJECT_CLONE(IndexedEndpointType);
708             EndpointType* cloneEndpointType() const {
709                 return new IndexedEndpointTypeImpl(*this);
710             }
711
712             IMPL_INTEGER_ATTRIB(Index);
713             IMPL_BOOLEAN_ATTRIB(isDefault);
714
715             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
716                 if (!qualifiedName.hasNamespaceURI()) {
717                     if (XMLString::equals(qualifiedName.getLocalPart(),INDEX_ATTRIB_NAME)) {
718                         setIndex(value);
719                         return;
720                     }
721                     else if (XMLString::equals(qualifiedName.getLocalPart(),ISDEFAULT_ATTRIB_NAME)) {
722                         setisDefault(value);
723                         return;
724                     }
725                 }
726                 EndpointTypeImpl::setAttribute(qualifiedName, value, ID);
727             }
728
729         protected:
730             void marshallAttributes(DOMElement* domElement) const {
731                 MARSHALL_INTEGER_ATTRIB(Index,INDEX,nullptr);
732                 MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,nullptr);
733                 EndpointTypeImpl::marshallAttributes(domElement);
734             }
735         };
736
737         class SAML_DLLLOCAL ArtifactResolutionServiceImpl : public virtual ArtifactResolutionService, public IndexedEndpointTypeImpl
738         {
739         public:
740             virtual ~ArtifactResolutionServiceImpl() {}
741
742             ArtifactResolutionServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
743                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
744
745             ArtifactResolutionServiceImpl(const ArtifactResolutionServiceImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {}
746
747             IMPL_XMLOBJECT_CLONE(ArtifactResolutionService);
748             IndexedEndpointType* cloneIndexedEndpointType() const {
749                 return new ArtifactResolutionServiceImpl(*this);
750             }
751             EndpointType* cloneEndpointType() const {
752                 return new ArtifactResolutionServiceImpl(*this);
753             }
754         };
755
756         class SAML_DLLLOCAL SingleLogoutServiceImpl : public virtual SingleLogoutService, public EndpointTypeImpl
757         {
758         public:
759             virtual ~SingleLogoutServiceImpl() {}
760
761             SingleLogoutServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
762                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
763
764             SingleLogoutServiceImpl(const SingleLogoutServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
765
766             IMPL_XMLOBJECT_CLONE(SingleLogoutService);
767             EndpointType* cloneEndpointType() const {
768                 return new SingleLogoutServiceImpl(*this);
769             }
770         };
771
772         class SAML_DLLLOCAL ManageNameIDServiceImpl : public virtual ManageNameIDService, public EndpointTypeImpl
773         {
774         public:
775             virtual ~ManageNameIDServiceImpl() {}
776
777             ManageNameIDServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
778                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
779
780             ManageNameIDServiceImpl(const ManageNameIDServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
781
782             IMPL_XMLOBJECT_CLONE(ManageNameIDService);
783             EndpointType* cloneEndpointType() const {
784                 return new ManageNameIDServiceImpl(*this);
785             }
786         };
787
788         class SAML_DLLLOCAL SingleSignOnServiceImpl : public virtual SingleSignOnService, public EndpointTypeImpl
789         {
790         public:
791             virtual ~SingleSignOnServiceImpl() {}
792
793             SingleSignOnServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
794                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
795
796             SingleSignOnServiceImpl(const SingleSignOnServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
797
798             IMPL_XMLOBJECT_CLONE(SingleSignOnService);
799             EndpointType* cloneEndpointType() const {
800                 return new SingleSignOnServiceImpl(*this);
801             }
802         };
803
804         class SAML_DLLLOCAL NameIDMappingServiceImpl : public virtual NameIDMappingService, public EndpointTypeImpl
805         {
806         public:
807             virtual ~NameIDMappingServiceImpl() {}
808
809             NameIDMappingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
810                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
811
812             NameIDMappingServiceImpl(const NameIDMappingServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
813
814             IMPL_XMLOBJECT_CLONE(NameIDMappingService);
815             EndpointType* cloneEndpointType() const {
816                 return new NameIDMappingServiceImpl(*this);
817             }
818         };
819
820         class SAML_DLLLOCAL AssertionIDRequestServiceImpl : public virtual AssertionIDRequestService, public EndpointTypeImpl
821         {
822         public:
823             virtual ~AssertionIDRequestServiceImpl() {}
824
825             AssertionIDRequestServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
826                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
827
828             AssertionIDRequestServiceImpl(const AssertionIDRequestServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
829
830             IMPL_XMLOBJECT_CLONE(AssertionIDRequestService);
831             EndpointType* cloneEndpointType() const {
832                 return new AssertionIDRequestServiceImpl(*this);
833             }
834         };
835
836         class SAML_DLLLOCAL AssertionConsumerServiceImpl : public virtual AssertionConsumerService, public IndexedEndpointTypeImpl
837         {
838         public:
839             virtual ~AssertionConsumerServiceImpl() {}
840
841             AssertionConsumerServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
842                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
843
844             AssertionConsumerServiceImpl(const AssertionConsumerServiceImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {}
845
846             IMPL_XMLOBJECT_CLONE(AssertionConsumerService);
847             EndpointType* cloneEndpointType() const {
848                 return new AssertionConsumerServiceImpl(*this);
849             }
850             IndexedEndpointType* cloneIndexedEndpointType() const {
851                 return new AssertionConsumerServiceImpl(*this);
852             }
853         };
854
855         class SAML_DLLLOCAL AuthnQueryServiceImpl : public virtual AuthnQueryService, public EndpointTypeImpl
856         {
857         public:
858             virtual ~AuthnQueryServiceImpl() {}
859
860             AuthnQueryServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
861                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
862
863             AuthnQueryServiceImpl(const AuthnQueryServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
864
865             IMPL_XMLOBJECT_CLONE(AuthnQueryService);
866             EndpointType* cloneEndpointType() const {
867                 return new AuthnQueryServiceImpl(*this);
868             }
869         };
870
871         class SAML_DLLLOCAL AuthzServiceImpl : public virtual AuthzService, public EndpointTypeImpl
872         {
873         public:
874             virtual ~AuthzServiceImpl() {}
875
876             AuthzServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
877                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
878
879             AuthzServiceImpl(const AuthzServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
880
881             IMPL_XMLOBJECT_CLONE(AuthzService);
882             EndpointType* cloneEndpointType() const {
883                 return new AuthzServiceImpl(*this);
884             }
885         };
886
887         class SAML_DLLLOCAL AttributeServiceImpl : public virtual AttributeService, public EndpointTypeImpl
888         {
889         public:
890             virtual ~AttributeServiceImpl() {}
891
892             AttributeServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
893                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
894
895             AttributeServiceImpl(const AttributeServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
896
897             IMPL_XMLOBJECT_CLONE(AttributeService);
898             EndpointType* cloneEndpointType() const {
899                 return new AttributeServiceImpl(*this);
900             }
901         };
902
903         class SAML_DLLLOCAL RoleDescriptorImpl : public virtual RoleDescriptor,
904             public virtual SignableObject,
905             public AbstractComplexElement,
906             public AbstractAttributeExtensibleXMLObject,
907             public AbstractDOMCachingXMLObject,
908             public AbstractXMLObjectMarshaller,
909             public AbstractXMLObjectUnmarshaller
910         {
911             void init() {
912                 m_ID=m_ProtocolSupportEnumeration=m_ErrorURL=nullptr;
913                 m_ValidUntil=m_CacheDuration=nullptr;
914                 m_children.push_back(nullptr);
915                 m_children.push_back(nullptr);
916                 m_children.push_back(nullptr);
917                 m_children.push_back(nullptr);
918                 m_Signature=nullptr;
919                 m_Extensions=nullptr;
920                 m_Organization=nullptr;
921                 m_pos_Signature=m_children.begin();
922                 m_pos_Extensions=m_pos_Signature;
923                 ++m_pos_Extensions;
924                 m_pos_Organization=m_pos_Extensions;
925                 ++m_pos_Organization;
926                 m_pos_ContactPerson=m_pos_Organization;
927                 ++m_pos_ContactPerson;
928             }
929
930         protected:
931             list<XMLObject*>::iterator m_pos_ContactPerson;
932
933             RoleDescriptorImpl() {
934                 init();
935             }
936
937         public:
938             virtual ~RoleDescriptorImpl() {
939                 XMLString::release(&m_ID);
940                 XMLString::release(&m_ProtocolSupportEnumeration);
941                 XMLString::release(&m_ErrorURL);
942                 delete m_ValidUntil;
943                 delete m_CacheDuration;
944             }
945
946             RoleDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
947                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
948                 init();
949             }
950
951             RoleDescriptorImpl(const RoleDescriptorImpl& src)
952                     : AbstractXMLObject(src), AbstractComplexElement(src),
953                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
954                 init();
955                 setID(src.getID());
956                 setProtocolSupportEnumeration(src.getProtocolSupportEnumeration());
957                 setErrorURL(src.getErrorURL());
958                 setValidUntil(src.getValidUntil());
959                 setCacheDuration(src.getCacheDuration());
960                 if (src.getSignature())
961                     setSignature(src.getSignature()->cloneSignature());
962                 if (src.getExtensions())
963                     setExtensions(src.getExtensions()->cloneExtensions());
964                 if (src.getOrganization())
965                     setOrganization(src.getOrganization()->cloneOrganization());
966
967                 VectorOf(KeyDescriptor) v=getKeyDescriptors();
968                 for (vector<KeyDescriptor*>::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) {
969                     if (*i) {
970                         v.push_back((*i)->cloneKeyDescriptor());
971                     }
972                 }
973                 VectorOf(ContactPerson) w=getContactPersons();
974                 for (vector<ContactPerson*>::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) {
975                     if (*j) {
976                         w.push_back((*j)->cloneContactPerson());
977                     }
978                 }
979             }
980
981             //IMPL_TYPED_CHILD(Signature);
982             // Need customized setter.
983         protected:
984             Signature* m_Signature;
985             list<XMLObject*>::iterator m_pos_Signature;
986         public:
987             Signature* getSignature() const {
988                 return m_Signature;
989             }
990
991             void setSignature(Signature* sig) {
992                 prepareForAssignment(m_Signature,sig);
993                 *m_pos_Signature=m_Signature=sig;
994                 // Sync content reference back up.
995                 if (m_Signature)
996                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
997             }
998
999             IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
1000             IMPL_STRING_ATTRIB(ProtocolSupportEnumeration);
1001             IMPL_STRING_ATTRIB(ErrorURL);
1002             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
1003             IMPL_DURATION_ATTRIB(CacheDuration,0);
1004             IMPL_TYPED_CHILD(Extensions);
1005             IMPL_TYPED_CHILDREN(KeyDescriptor,m_pos_Organization);
1006             IMPL_TYPED_CHILD(Organization);
1007             IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson);
1008
1009             bool hasSupport(const XMLCh* protocol) const {
1010                 if (!protocol || !*protocol)
1011                     return true;
1012                 if (m_ProtocolSupportEnumeration) {
1013                     // Look for first character.
1014                     xsecsize_t len=XMLString::stringLen(protocol);
1015                     xsecsize_t pos=0;
1016                     int index=XMLString::indexOf(m_ProtocolSupportEnumeration,protocol[0],pos);
1017                     while (index>=0) {
1018                         // Only possible match is if it's the first character or a space comes before it.
1019                         if (index==0 || m_ProtocolSupportEnumeration[index-1]==chSpace) {
1020                             // See if rest of protocol string is present.
1021                             if (0==XMLString::compareNString(m_ProtocolSupportEnumeration+index+1,protocol+1,len-1)) {
1022                                 // Only possible match is if it's the last character or a space comes after it.
1023                                 if (m_ProtocolSupportEnumeration[index+len]==chNull || m_ProtocolSupportEnumeration[index+len]==chSpace)
1024                                     return true;
1025                                 else
1026                                     pos=index+len;
1027                             }
1028                             else {
1029                                 // Move past last search and start again.
1030                                 pos=index+1;
1031                             }
1032                         }
1033                         else {
1034                             // Move past last search and start again.
1035                             pos=index+1;
1036                         }
1037                         index=XMLString::indexOf(m_ProtocolSupportEnumeration,protocol[0],pos);
1038                     }
1039                 }
1040                 return false;
1041             }
1042
1043             void addSupport(const XMLCh* protocol) {
1044                 if (hasSupport(protocol))
1045                     return;
1046                 if (m_ProtocolSupportEnumeration && *m_ProtocolSupportEnumeration) {
1047 #ifdef HAVE_GOOD_STL
1048                     xstring pse(m_ProtocolSupportEnumeration);
1049                     pse = pse + chSpace + protocol;
1050                     setProtocolSupportEnumeration(pse.c_str());
1051 #else
1052                     auto_ptr_char temp(m_ProtocolSupportEnumeration);
1053                     auto_ptr_char temp2(protocol);
1054                     string pse(temp.get());
1055                     pse = pse + ' ' + temp2.get();
1056                     auto_ptr_XMLCh temp3(pse.c_str());
1057                     setProtocolSupportEnumeration(temp3.get());
1058 #endif
1059                 }
1060                 else {
1061                     setProtocolSupportEnumeration(protocol);
1062                 }
1063             }
1064
1065             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1066                 if (!qualifiedName.hasNamespaceURI()) {
1067                     if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
1068                         setID(value);
1069                         return;
1070                     }
1071                     else if (XMLString::equals(qualifiedName.getLocalPart(),PROTOCOLSUPPORTENUMERATION_ATTRIB_NAME)) {
1072                         setProtocolSupportEnumeration(value);
1073                         return;
1074                     }
1075                     else if (XMLString::equals(qualifiedName.getLocalPart(),ERRORURL_ATTRIB_NAME)) {
1076                         setErrorURL(value);
1077                         return;
1078                     }
1079                     else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
1080                         setValidUntil(value);
1081                         return;
1082                     }
1083                     else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
1084                         setCacheDuration(value);
1085                         return;
1086                     }
1087                 }
1088                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
1089             }
1090
1091         protected:
1092             void prepareForMarshalling() const {
1093                 if (m_Signature)
1094                     declareNonVisibleNamespaces();
1095             }
1096
1097             void marshallAttributes(DOMElement* domElement) const {
1098                 MARSHALL_ID_ATTRIB(ID,ID,nullptr);
1099                 MARSHALL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION,nullptr);
1100                 MARSHALL_STRING_ATTRIB(ErrorURL,ERRORURL,nullptr);
1101                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
1102                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
1103                 marshallExtensionAttributes(domElement);
1104             }
1105
1106             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1107                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
1108                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
1109                 PROC_TYPED_CHILDREN(KeyDescriptor,SAML20MD_NS,false);
1110                 PROC_TYPED_CHILD(Organization,SAML20MD_NS,false);
1111                 PROC_TYPED_CHILDREN(ContactPerson,SAML20MD_NS,false);
1112                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1113             }
1114
1115             void processAttribute(const DOMAttr* attribute) {
1116                 PROC_ID_ATTRIB(ID,ID,nullptr);
1117                 unmarshallExtensionAttribute(attribute);
1118             }
1119         };
1120
1121         class SAML_DLLLOCAL RoleDescriptorTypeImpl : public virtual RoleDescriptorType, public RoleDescriptorImpl
1122         {
1123         public:
1124             virtual ~RoleDescriptorTypeImpl() {}
1125
1126             RoleDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1127                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1128             }
1129
1130             RoleDescriptorTypeImpl(const RoleDescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1131                 VectorOf(XMLObject) v=getUnknownXMLObjects();
1132                 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
1133                     v.push_back((*i)->clone());
1134             }
1135
1136             IMPL_XMLOBJECT_CLONE(RoleDescriptorType);
1137             RoleDescriptor* cloneRoleDescriptor() const {
1138                 return new RoleDescriptorTypeImpl(*this);
1139             }
1140
1141             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
1142
1143         protected:
1144             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1145                 getUnknownXMLObjects().push_back(childXMLObject);
1146             }
1147         };
1148
1149         class SAML_DLLLOCAL SSODescriptorTypeImpl : public virtual SSODescriptorType, public RoleDescriptorImpl
1150         {
1151             void init() {
1152                 m_children.push_back(nullptr);
1153                 m_children.push_back(nullptr);
1154                 m_children.push_back(nullptr);
1155                 m_children.push_back(nullptr);
1156                 m_pos_ArtifactResolutionService=m_pos_ContactPerson;
1157                 ++m_pos_ArtifactResolutionService;
1158                 m_pos_SingleLogoutService=m_pos_ArtifactResolutionService;
1159                 ++m_pos_SingleLogoutService;
1160                 m_pos_ManageNameIDService=m_pos_SingleLogoutService;
1161                 ++m_pos_ManageNameIDService;
1162                 m_pos_NameIDFormat=m_pos_ManageNameIDService;
1163                 ++m_pos_NameIDFormat;
1164             }
1165
1166         protected:
1167             list<XMLObject*>::iterator m_pos_ArtifactResolutionService;
1168             list<XMLObject*>::iterator m_pos_SingleLogoutService;
1169             list<XMLObject*>::iterator m_pos_ManageNameIDService;
1170             list<XMLObject*>::iterator m_pos_NameIDFormat;
1171
1172             SSODescriptorTypeImpl() {
1173                 init();
1174             }
1175
1176         public:
1177             virtual ~SSODescriptorTypeImpl() {}
1178
1179             SSODescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1180                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1181                 init();
1182             }
1183
1184             SSODescriptorTypeImpl(const SSODescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1185                 init();
1186                 VectorOf(ArtifactResolutionService) v=getArtifactResolutionServices();
1187                 for (vector<ArtifactResolutionService*>::const_iterator i=src.m_ArtifactResolutionServices.begin(); i!=src.m_ArtifactResolutionServices.end(); i++) {
1188                     if (*i) {
1189                         v.push_back((*i)->cloneArtifactResolutionService());
1190                     }
1191                 }
1192                 VectorOf(SingleLogoutService) w=getSingleLogoutServices();
1193                 for (vector<SingleLogoutService*>::const_iterator j=src.m_SingleLogoutServices.begin(); j!=src.m_SingleLogoutServices.end(); j++) {
1194                     if (*j) {
1195                         w.push_back((*j)->cloneSingleLogoutService());
1196                     }
1197                 }
1198                 VectorOf(ManageNameIDService) x=getManageNameIDServices();
1199                 for (vector<ManageNameIDService*>::const_iterator k=src.m_ManageNameIDServices.begin(); k!=src.m_ManageNameIDServices.end(); k++) {
1200                     if (*k) {
1201                         x.push_back((*k)->cloneManageNameIDService());
1202                     }
1203                 }
1204                 VectorOf(NameIDFormat) y=getNameIDFormats();
1205                 for (vector<NameIDFormat*>::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) {
1206                     if (*m) {
1207                         y.push_back((*m)->cloneNameIDFormat());
1208                     }
1209                 }
1210             }
1211
1212             IMPL_TYPED_CHILDREN(ArtifactResolutionService,m_pos_ArtifactResolutionService);
1213             IMPL_TYPED_CHILDREN(SingleLogoutService,m_pos_SingleLogoutService);
1214             IMPL_TYPED_CHILDREN(ManageNameIDService,m_pos_ManageNameIDService);
1215             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1216
1217         protected:
1218             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1219                 PROC_TYPED_CHILDREN(ArtifactResolutionService,SAML20MD_NS,false);
1220                 PROC_TYPED_CHILDREN(SingleLogoutService,SAML20MD_NS,false);
1221                 PROC_TYPED_CHILDREN(ManageNameIDService,SAML20MD_NS,false);
1222                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1223                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1224             }
1225         };
1226
1227         class SAML_DLLLOCAL IDPSSODescriptorImpl : public virtual IDPSSODescriptor, public SSODescriptorTypeImpl
1228         {
1229             list<XMLObject*>::iterator m_pos_SingleSignOnService;
1230             list<XMLObject*>::iterator m_pos_NameIDMappingService;
1231             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1232             list<XMLObject*>::iterator m_pos_AttributeProfile;
1233
1234             void init() {
1235                 m_WantAuthnRequestsSigned=XML_BOOL_NULL;
1236                 m_children.push_back(nullptr);
1237                 m_children.push_back(nullptr);
1238                 m_children.push_back(nullptr);
1239                 m_children.push_back(nullptr);
1240                 m_pos_SingleSignOnService=m_pos_NameIDFormat;
1241                 ++m_pos_SingleSignOnService;
1242                 m_pos_NameIDMappingService=m_pos_SingleSignOnService;
1243                 ++m_pos_NameIDMappingService;
1244                 m_pos_AssertionIDRequestService=m_pos_NameIDMappingService;
1245                 ++m_pos_AssertionIDRequestService;
1246                 m_pos_AttributeProfile=m_pos_AssertionIDRequestService;
1247                 ++m_pos_AttributeProfile;
1248             }
1249
1250         public:
1251             virtual ~IDPSSODescriptorImpl() {}
1252
1253             IDPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1254                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1255                 init();
1256             }
1257
1258             IDPSSODescriptorImpl(const IDPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
1259                 init();
1260                 WantAuthnRequestsSigned(src.m_WantAuthnRequestsSigned);
1261                 VectorOf(SingleSignOnService) v=getSingleSignOnServices();
1262                 for (vector<SingleSignOnService*>::const_iterator i=src.m_SingleSignOnServices.begin(); i!=src.m_SingleSignOnServices.end(); i++) {
1263                     if (*i) {
1264                         v.push_back((*i)->cloneSingleSignOnService());
1265                     }
1266                 }
1267                 VectorOf(NameIDMappingService) w=getNameIDMappingServices();
1268                 for (vector<NameIDMappingService*>::const_iterator j=src.m_NameIDMappingServices.begin(); j!=src.m_NameIDMappingServices.end(); j++) {
1269                     if (*j) {
1270                         w.push_back((*j)->cloneNameIDMappingService());
1271                     }
1272                 }
1273                 VectorOf(AssertionIDRequestService) x=getAssertionIDRequestServices();
1274                 for (vector<AssertionIDRequestService*>::const_iterator k=src.m_AssertionIDRequestServices.begin(); k!=src.m_AssertionIDRequestServices.end(); k++) {
1275                     if (*k) {
1276                         x.push_back((*k)->cloneAssertionIDRequestService());
1277                     }
1278                 }
1279                 VectorOf(AttributeProfile) y=getAttributeProfiles();
1280                 for (vector<AttributeProfile*>::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) {
1281                     if (*m) {
1282                         y.push_back((*m)->cloneAttributeProfile());
1283                     }
1284                 }
1285                 VectorOf(Attribute) z=getAttributes();
1286                 for (vector<Attribute*>::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) {
1287                     if (*n) {
1288                         z.push_back((*n)->cloneAttribute());
1289                     }
1290                 }
1291             }
1292
1293             IMPL_XMLOBJECT_CLONE(IDPSSODescriptor);
1294             SSODescriptorType* cloneSSODescriptorType() const {
1295                 return new IDPSSODescriptorImpl(*this);
1296             }
1297             RoleDescriptor* cloneRoleDescriptor() const {
1298                 return new IDPSSODescriptorImpl(*this);
1299             }
1300
1301             IMPL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned);
1302             IMPL_TYPED_CHILDREN(SingleSignOnService,m_pos_SingleSignOnService);
1303             IMPL_TYPED_CHILDREN(NameIDMappingService,m_pos_NameIDMappingService);
1304             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1305             IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile);
1306             IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
1307
1308             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1309                 if (!qualifiedName.hasNamespaceURI()) {
1310                     if (XMLString::equals(qualifiedName.getLocalPart(),WANTAUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
1311                         setWantAuthnRequestsSigned(value);
1312                         return;
1313                     }
1314                 }
1315                 RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
1316             }
1317
1318         protected:
1319             void marshallAttributes(DOMElement* domElement) const {
1320                 MARSHALL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,nullptr);
1321                 RoleDescriptorImpl::marshallAttributes(domElement);
1322             }
1323
1324             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1325                 PROC_TYPED_CHILDREN(SingleSignOnService,SAML20MD_NS,false);
1326                 PROC_TYPED_CHILDREN(NameIDMappingService,SAML20MD_NS,false);
1327                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1328                 PROC_TYPED_CHILDREN(AttributeProfile,SAML20MD_NS,false);
1329                 PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
1330                 SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
1331             }
1332         };
1333
1334         class SAML_DLLLOCAL RequestedAttributeImpl : public virtual RequestedAttribute,
1335             public AbstractComplexElement,
1336             public AbstractAttributeExtensibleXMLObject,
1337             public AbstractDOMCachingXMLObject,
1338             public AbstractXMLObjectMarshaller,
1339             public AbstractXMLObjectUnmarshaller
1340         {
1341             void init() {
1342                 m_Name=m_NameFormat=m_FriendlyName=nullptr;
1343                 m_isRequired=XML_BOOL_NULL;
1344             }
1345         public:
1346             virtual ~RequestedAttributeImpl() {
1347                 XMLString::release(&m_Name);
1348                 XMLString::release(&m_NameFormat);
1349                 XMLString::release(&m_FriendlyName);
1350             }
1351
1352             RequestedAttributeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1353                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1354                 init();
1355             }
1356
1357             RequestedAttributeImpl(const RequestedAttributeImpl& src)
1358                     : AbstractXMLObject(src), AbstractComplexElement(src),
1359                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
1360                 init();
1361                 setName(src.getName());
1362                 setNameFormat(src.getNameFormat());
1363                 setFriendlyName(src.getFriendlyName());
1364                 isRequired(src.m_isRequired);
1365                 VectorOf(XMLObject) v=getAttributeValues();
1366                 for (vector<XMLObject*>::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) {
1367                     if (*i) {
1368                         v.push_back((*i)->clone());
1369                     }
1370                 }
1371             }
1372
1373             IMPL_XMLOBJECT_CLONE(RequestedAttribute);
1374             Attribute* cloneAttribute() const {
1375                 return new RequestedAttributeImpl(*this);
1376             }
1377
1378             IMPL_STRING_ATTRIB(Name);
1379             IMPL_STRING_ATTRIB(NameFormat);
1380             IMPL_STRING_ATTRIB(FriendlyName);
1381             IMPL_BOOLEAN_ATTRIB(isRequired);
1382             IMPL_XMLOBJECT_CHILDREN(AttributeValue,m_children.end());
1383
1384             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1385                 if (!qualifiedName.hasNamespaceURI()) {
1386                     if (XMLString::equals(qualifiedName.getLocalPart(),NAME_ATTRIB_NAME)) {
1387                         setName(value);
1388                         return;
1389                     }
1390                     else if (XMLString::equals(qualifiedName.getLocalPart(),NAMEFORMAT_ATTRIB_NAME)) {
1391                         setNameFormat(value);
1392                         return;
1393                     }
1394                     else if (XMLString::equals(qualifiedName.getLocalPart(),FRIENDLYNAME_ATTRIB_NAME)) {
1395                         setFriendlyName(value);
1396                         return;
1397                     }
1398                     else if (XMLString::equals(qualifiedName.getLocalPart(),ISREQUIRED_ATTRIB_NAME)) {
1399                         setisRequired(value);
1400                         return;
1401                     }
1402                 }
1403                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
1404             }
1405
1406         protected:
1407             void marshallAttributes(DOMElement* domElement) const {
1408                 MARSHALL_STRING_ATTRIB(Name,NAME,nullptr);
1409                 MARSHALL_STRING_ATTRIB(NameFormat,NAMEFORMAT,nullptr);
1410                 MARSHALL_STRING_ATTRIB(FriendlyName,FRIENDLYNAME,nullptr);
1411                 MARSHALL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,nullptr);
1412                 marshallExtensionAttributes(domElement);
1413             }
1414
1415             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1416                 getAttributeValues().push_back(childXMLObject);
1417             }
1418
1419             void processAttribute(const DOMAttr* attribute) {
1420                 unmarshallExtensionAttribute(attribute);
1421             }
1422         };
1423
1424         class SAML_DLLLOCAL AttributeConsumingServiceImpl : public virtual AttributeConsumingService,
1425             public AbstractComplexElement,
1426             public AbstractDOMCachingXMLObject,
1427             public AbstractXMLObjectMarshaller,
1428             public AbstractXMLObjectUnmarshaller
1429         {
1430             list<XMLObject*>::iterator m_pos_ServiceDescription;
1431             list<XMLObject*>::iterator m_pos_RequestedAttribute;
1432
1433                 void init() {
1434                 m_Index=nullptr;
1435                 m_isDefault=XML_BOOL_NULL;
1436                 m_children.push_back(nullptr);
1437                 m_children.push_back(nullptr);
1438                 m_pos_ServiceDescription=m_children.begin();
1439                 m_pos_RequestedAttribute=m_pos_ServiceDescription;
1440                 ++m_pos_RequestedAttribute;
1441             }
1442
1443         public:
1444             virtual ~AttributeConsumingServiceImpl() {
1445                 XMLString::release(&m_Index);
1446             }
1447
1448             AttributeConsumingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1449                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1450                 init();
1451             }
1452
1453             AttributeConsumingServiceImpl(const AttributeConsumingServiceImpl& src)
1454                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
1455                 init();
1456                 setIndex(src.m_Index);
1457                 isDefault(src.m_isDefault);
1458                 VectorOf(ServiceName) v=getServiceNames();
1459                 for (vector<ServiceName*>::const_iterator i=src.m_ServiceNames.begin(); i!=src.m_ServiceNames.end(); i++) {
1460                     if (*i) {
1461                         v.push_back((*i)->cloneServiceName());
1462                     }
1463                 }
1464                 VectorOf(ServiceDescription) w=getServiceDescriptions();
1465                 for (vector<ServiceDescription*>::const_iterator j=src.m_ServiceDescriptions.begin(); j!=src.m_ServiceDescriptions.end(); j++) {
1466                     if (*j) {
1467                         w.push_back((*j)->cloneServiceDescription());
1468                     }
1469                 }
1470                 VectorOf(RequestedAttribute) x=getRequestedAttributes();
1471                 for (vector<RequestedAttribute*>::const_iterator k=src.m_RequestedAttributes.begin(); k!=src.m_RequestedAttributes.end(); k++) {
1472                     if (*k) {
1473                         x.push_back((*k)->cloneRequestedAttribute());
1474                     }
1475                 }
1476             }
1477
1478             IMPL_XMLOBJECT_CLONE(AttributeConsumingService);
1479             IMPL_INTEGER_ATTRIB(Index);
1480             IMPL_BOOLEAN_ATTRIB(isDefault);
1481             IMPL_TYPED_CHILDREN(ServiceName,m_pos_ServiceDescription);
1482             IMPL_TYPED_CHILDREN(ServiceDescription,m_pos_RequestedAttribute);
1483             IMPL_TYPED_CHILDREN(RequestedAttribute,m_children.end());
1484
1485         protected:
1486             void marshallAttributes(DOMElement* domElement) const {
1487                 MARSHALL_INTEGER_ATTRIB(Index,INDEX,nullptr);
1488                 MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,nullptr);
1489             }
1490
1491             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1492                 PROC_TYPED_CHILDREN(ServiceName,SAML20MD_NS,false);
1493                 PROC_TYPED_CHILDREN(ServiceDescription,SAML20MD_NS,false);
1494                 PROC_TYPED_CHILDREN(RequestedAttribute,SAML20MD_NS,false);
1495                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1496             }
1497
1498             void processAttribute(const DOMAttr* attribute) {
1499                 PROC_INTEGER_ATTRIB(Index,INDEX,nullptr);
1500                 PROC_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,nullptr);
1501                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
1502             }
1503         };
1504
1505         class SAML_DLLLOCAL SPSSODescriptorImpl : public virtual SPSSODescriptor, public SSODescriptorTypeImpl
1506         {
1507             list<XMLObject*>::iterator m_pos_AssertionConsumerService;
1508
1509             void init() {
1510                 m_AuthnRequestsSigned=XML_BOOL_NULL;
1511                 m_WantAssertionsSigned=XML_BOOL_NULL;
1512                 m_children.push_back(nullptr);
1513                 m_pos_AssertionConsumerService=m_pos_NameIDFormat;
1514                 ++m_pos_AssertionConsumerService;
1515             }
1516
1517         public:
1518             virtual ~SPSSODescriptorImpl() {}
1519
1520             SPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1521                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1522                 init();
1523             }
1524
1525             SPSSODescriptorImpl(const SPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
1526                 init();
1527                 AuthnRequestsSigned(src.m_AuthnRequestsSigned);
1528                 WantAssertionsSigned(src.m_WantAssertionsSigned);
1529                 VectorOf(AssertionConsumerService) v=getAssertionConsumerServices();
1530                 for (vector<AssertionConsumerService*>::const_iterator i=src.m_AssertionConsumerServices.begin(); i!=src.m_AssertionConsumerServices.end(); i++) {
1531                     if (*i) {
1532                         v.push_back((*i)->cloneAssertionConsumerService());
1533                     }
1534                 }
1535                 VectorOf(AttributeConsumingService) w=getAttributeConsumingServices();
1536                 for (vector<AttributeConsumingService*>::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) {
1537                     if (*j) {
1538                         w.push_back((*j)->cloneAttributeConsumingService());
1539                     }
1540                 }
1541             }
1542
1543             IMPL_XMLOBJECT_CLONE(SPSSODescriptor);
1544             SSODescriptorType* cloneSSODescriptorType() const {
1545                 return cloneSPSSODescriptor();
1546             }
1547             RoleDescriptor* cloneRoleDescriptor() const {
1548                 return cloneSPSSODescriptor();
1549             }
1550
1551             IMPL_BOOLEAN_ATTRIB(AuthnRequestsSigned);
1552             IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned);
1553             IMPL_TYPED_CHILDREN(AssertionConsumerService,m_pos_AssertionConsumerService);
1554             IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end());
1555
1556             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1557                 if (!qualifiedName.hasNamespaceURI()) {
1558                     if (XMLString::equals(qualifiedName.getLocalPart(),AUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
1559                         setAuthnRequestsSigned(value);
1560                         return;
1561                     }
1562                     else if (XMLString::equals(qualifiedName.getLocalPart(),WANTASSERTIONSSIGNED_ATTRIB_NAME)) {
1563                         setWantAssertionsSigned(value);
1564                         return;
1565                     }
1566                 }
1567                 RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
1568             }
1569
1570         protected:
1571             void marshallAttributes(DOMElement* domElement) const {
1572                 MARSHALL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,nullptr);
1573                 MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,nullptr);
1574                 RoleDescriptorImpl::marshallAttributes(domElement);
1575             }
1576
1577             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1578                 PROC_TYPED_CHILDREN(AssertionConsumerService,SAML20MD_NS,false);
1579                 PROC_TYPED_CHILDREN(AttributeConsumingService,SAML20MD_NS,false);
1580                 SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
1581             }
1582         };
1583
1584         class SAML_DLLLOCAL AuthnAuthorityDescriptorImpl : public virtual AuthnAuthorityDescriptor, public RoleDescriptorImpl
1585         {
1586             list<XMLObject*>::iterator m_pos_AuthnQueryService;
1587             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1588
1589             void init() {
1590                 m_children.push_back(nullptr);
1591                 m_children.push_back(nullptr);
1592                 m_pos_AuthnQueryService=m_pos_ContactPerson;
1593                 ++m_pos_AuthnQueryService;
1594                 m_pos_AssertionIDRequestService=m_pos_AuthnQueryService;
1595                 ++m_pos_AssertionIDRequestService;
1596             }
1597
1598         public:
1599             virtual ~AuthnAuthorityDescriptorImpl() {}
1600
1601             AuthnAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1602                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1603                 init();
1604             }
1605
1606             AuthnAuthorityDescriptorImpl(const AuthnAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1607                 init();
1608                 VectorOf(AuthnQueryService) v=getAuthnQueryServices();
1609                 for (vector<AuthnQueryService*>::const_iterator i=src.m_AuthnQueryServices.begin(); i!=src.m_AuthnQueryServices.end(); i++) {
1610                     if (*i) {
1611                         v.push_back((*i)->cloneAuthnQueryService());
1612                     }
1613                 }
1614                 VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
1615                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1616                     if (*j) {
1617                         w.push_back((*j)->cloneAssertionIDRequestService());
1618                     }
1619                 }
1620                 VectorOf(NameIDFormat) x=getNameIDFormats();
1621                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1622                     if (*k) {
1623                         x.push_back((*k)->cloneNameIDFormat());
1624                     }
1625                 }
1626             }
1627
1628             IMPL_XMLOBJECT_CLONE(AuthnAuthorityDescriptor);
1629             RoleDescriptor* cloneRoleDescriptor() const {
1630                 return cloneAuthnAuthorityDescriptor();
1631             }
1632
1633             IMPL_TYPED_CHILDREN(AuthnQueryService,m_pos_AuthnQueryService);
1634             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1635             IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
1636
1637         protected:
1638             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1639                 PROC_TYPED_CHILDREN(AuthnQueryService,SAML20MD_NS,false);
1640                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1641                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1642                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1643             }
1644         };
1645
1646         class SAML_DLLLOCAL PDPDescriptorImpl : public virtual PDPDescriptor, public RoleDescriptorImpl
1647         {
1648             list<XMLObject*>::iterator m_pos_AuthzService;
1649             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1650
1651             void init() {
1652                 m_children.push_back(nullptr);
1653                 m_children.push_back(nullptr);
1654                 m_pos_AuthzService=m_pos_ContactPerson;
1655                 ++m_pos_AuthzService;
1656                 m_pos_AssertionIDRequestService=m_pos_AuthzService;
1657                 ++m_pos_AssertionIDRequestService;
1658             }
1659
1660         public:
1661             virtual ~PDPDescriptorImpl() {}
1662
1663             PDPDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1664                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1665                 init();
1666             }
1667
1668             PDPDescriptorImpl(const PDPDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1669                 init();
1670                 VectorOf(AuthzService) v=getAuthzServices();
1671                 for (vector<AuthzService*>::const_iterator i=src.m_AuthzServices.begin(); i!=src.m_AuthzServices.end(); i++) {
1672                     if (*i) {
1673                         v.push_back((*i)->cloneAuthzService());
1674                     }
1675                 }
1676                 VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
1677                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1678                     if (*j) {
1679                         w.push_back((*j)->cloneAssertionIDRequestService());
1680                     }
1681                 }
1682                 VectorOf(NameIDFormat) x=getNameIDFormats();
1683                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1684                     if (*k) {
1685                         x.push_back((*k)->cloneNameIDFormat());
1686                     }
1687                 }
1688             }
1689
1690             IMPL_XMLOBJECT_CLONE(PDPDescriptor);
1691             RoleDescriptor* cloneRoleDescriptor() const {
1692                 return clonePDPDescriptor();
1693             }
1694
1695             IMPL_TYPED_CHILDREN(AuthzService,m_pos_AuthzService);
1696             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1697             IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
1698
1699         protected:
1700             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1701                 PROC_TYPED_CHILDREN(AuthzService,SAML20MD_NS,false);
1702                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1703                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1704                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1705             }
1706         };
1707
1708         class SAML_DLLLOCAL AttributeAuthorityDescriptorImpl : public virtual AttributeAuthorityDescriptor, public RoleDescriptorImpl
1709         {
1710             list<XMLObject*>::iterator m_pos_AttributeService;
1711             list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1712             list<XMLObject*>::iterator m_pos_NameIDFormat;
1713             list<XMLObject*>::iterator m_pos_AttributeProfile;
1714
1715             void init() {
1716                 m_children.push_back(nullptr);
1717                 m_children.push_back(nullptr);
1718                 m_children.push_back(nullptr);
1719                 m_children.push_back(nullptr);
1720                 m_pos_AttributeService=m_pos_ContactPerson;
1721                 ++m_pos_AttributeService;
1722                 m_pos_AssertionIDRequestService=m_pos_AttributeService;
1723                 ++m_pos_AssertionIDRequestService;
1724                 m_pos_NameIDFormat=m_pos_AssertionIDRequestService;
1725                 ++m_pos_NameIDFormat;
1726                 m_pos_AttributeProfile=m_pos_NameIDFormat;
1727                 ++m_pos_AttributeProfile;
1728             }
1729
1730         public:
1731             virtual ~AttributeAuthorityDescriptorImpl() {}
1732
1733             AttributeAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1734                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1735                 init();
1736             }
1737
1738             AttributeAuthorityDescriptorImpl(const AttributeAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1739                 init();
1740                 VectorOf(AttributeService) v=getAttributeServices();
1741                 for (vector<AttributeService*>::const_iterator i=src.m_AttributeServices.begin(); i!=src.m_AttributeServices.end(); i++) {
1742                     if (*i) {
1743                         v.push_back((*i)->cloneAttributeService());
1744                     }
1745                 }
1746                 VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
1747                 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1748                     if (*j) {
1749                         w.push_back((*j)->cloneAssertionIDRequestService());
1750                     }
1751                 }
1752                 VectorOf(NameIDFormat) x=getNameIDFormats();
1753                 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1754                     if (*k) {
1755                         x.push_back((*k)->cloneNameIDFormat());
1756                     }
1757                 }
1758                 VectorOf(AttributeProfile) y=getAttributeProfiles();
1759                 for (vector<AttributeProfile*>::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) {
1760                     if (*m) {
1761                         y.push_back((*m)->cloneAttributeProfile());
1762                     }
1763                 }
1764                 VectorOf(Attribute) z=getAttributes();
1765                 for (vector<Attribute*>::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) {
1766                     if (*n) {
1767                         z.push_back((*n)->cloneAttribute());
1768                     }
1769                 }
1770             }
1771
1772             IMPL_XMLOBJECT_CLONE(AttributeAuthorityDescriptor);
1773             RoleDescriptor* cloneRoleDescriptor() const {
1774                 return cloneAttributeAuthorityDescriptor();
1775             }
1776
1777             IMPL_TYPED_CHILDREN(AttributeService,m_pos_AttributeService);
1778             IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1779             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1780             IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile);
1781             IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
1782
1783         protected:
1784             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1785                 PROC_TYPED_CHILDREN(AttributeService,SAML20MD_NS,false);
1786                 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1787                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1788                 PROC_TYPED_CHILDREN(AttributeProfile,SAML20MD_NS,false);
1789                 PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
1790                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1791             }
1792         };
1793
1794         class SAML_DLLLOCAL QueryDescriptorTypeImpl : public virtual QueryDescriptorType, public RoleDescriptorImpl
1795         {
1796             void init() {
1797                 m_WantAssertionsSigned=XML_BOOL_NULL;
1798                 m_children.push_back(nullptr);
1799                 m_pos_NameIDFormat=m_pos_ContactPerson;
1800                 ++m_pos_NameIDFormat;
1801             }
1802
1803         protected:
1804             list<XMLObject*>::iterator m_pos_NameIDFormat;
1805
1806             QueryDescriptorTypeImpl() {
1807                 init();
1808             }
1809
1810         public:
1811             virtual ~QueryDescriptorTypeImpl() {}
1812
1813             QueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1814                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1815                 init();
1816             }
1817
1818             QueryDescriptorTypeImpl(const QueryDescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1819                 init();
1820                 WantAssertionsSigned(src.m_WantAssertionsSigned);
1821                 VectorOf(NameIDFormat) y=getNameIDFormats();
1822                 for (vector<NameIDFormat*>::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) {
1823                     if (*m) {
1824                         y.push_back((*m)->cloneNameIDFormat());
1825                     }
1826                 }
1827             }
1828
1829             IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned);
1830             IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1831
1832             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1833                 if (!qualifiedName.hasNamespaceURI()) {
1834                     if (XMLString::equals(qualifiedName.getLocalPart(),WANTASSERTIONSSIGNED_ATTRIB_NAME)) {
1835                         setWantAssertionsSigned(value);
1836                         return;
1837                     }
1838                 }
1839                 RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
1840             }
1841
1842         protected:
1843             void marshallAttributes(DOMElement* domElement) const {
1844                 MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,nullptr);
1845                 RoleDescriptorImpl::marshallAttributes(domElement);
1846             }
1847
1848             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1849                 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1850                 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1851             }
1852         };
1853
1854         class SAML_DLLLOCAL AuthnQueryDescriptorTypeImpl : public virtual AuthnQueryDescriptorType, public QueryDescriptorTypeImpl
1855         {
1856         public:
1857             virtual ~AuthnQueryDescriptorTypeImpl() {}
1858
1859             AuthnQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1860                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1861
1862             AuthnQueryDescriptorTypeImpl(const AuthnQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {}
1863
1864             IMPL_XMLOBJECT_CLONE(AuthnQueryDescriptorType);
1865             QueryDescriptorType* cloneQueryDescriptorType() const {
1866                 return new AuthnQueryDescriptorTypeImpl(*this);
1867             }
1868             RoleDescriptor* cloneRoleDescriptor() const {
1869                 return new AuthnQueryDescriptorTypeImpl(*this);
1870             }
1871         };
1872
1873         class SAML_DLLLOCAL AttributeQueryDescriptorTypeImpl : public virtual AttributeQueryDescriptorType, public QueryDescriptorTypeImpl
1874         {
1875         public:
1876             virtual ~AttributeQueryDescriptorTypeImpl() {}
1877
1878             AttributeQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1879                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1880
1881             AttributeQueryDescriptorTypeImpl(const AttributeQueryDescriptorTypeImpl& src)
1882                     : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {
1883                 VectorOf(AttributeConsumingService) w=getAttributeConsumingServices();
1884                 for (vector<AttributeConsumingService*>::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) {
1885                     if (*j) {
1886                         w.push_back((*j)->cloneAttributeConsumingService());
1887                     }
1888                 }
1889             }
1890
1891             IMPL_XMLOBJECT_CLONE(AttributeQueryDescriptorType);
1892             QueryDescriptorType* cloneQueryDescriptorType() const {
1893                 return new AttributeQueryDescriptorTypeImpl(*this);
1894             }
1895             RoleDescriptor* cloneRoleDescriptor() const {
1896                 return new AttributeQueryDescriptorTypeImpl(*this);
1897             }
1898
1899             IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end());
1900
1901         protected:
1902             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1903                 PROC_TYPED_CHILDREN(AttributeConsumingService,SAML20MD_NS,false);
1904                 QueryDescriptorTypeImpl::processChildElement(childXMLObject,root);
1905             }
1906         };
1907
1908         class SAML_DLLLOCAL AuthzDecisionQueryDescriptorTypeImpl : public virtual AuthzDecisionQueryDescriptorType, public QueryDescriptorTypeImpl
1909         {
1910         public:
1911             virtual ~AuthzDecisionQueryDescriptorTypeImpl() {}
1912
1913             AuthzDecisionQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1914                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1915
1916             AuthzDecisionQueryDescriptorTypeImpl(const AuthzDecisionQueryDescriptorTypeImpl& src)
1917                     : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {
1918                 VectorOf(ActionNamespace) w=getActionNamespaces();
1919                 for (vector<ActionNamespace*>::const_iterator j=src.m_ActionNamespaces.begin(); j!=src.m_ActionNamespaces.end(); j++) {
1920                     if (*j) {
1921                         w.push_back((*j)->cloneActionNamespace());
1922                     }
1923                 }
1924             }
1925
1926             IMPL_XMLOBJECT_CLONE(AuthzDecisionQueryDescriptorType);
1927             QueryDescriptorType* cloneQueryDescriptorType() const {
1928                 return new AuthzDecisionQueryDescriptorTypeImpl(*this);
1929             }
1930             RoleDescriptor* cloneRoleDescriptor() const {
1931                 return new AuthzDecisionQueryDescriptorTypeImpl(*this);
1932             }
1933
1934             IMPL_TYPED_CHILDREN(ActionNamespace,m_children.end());
1935
1936         protected:
1937             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1938                 PROC_TYPED_CHILDREN(ActionNamespace,samlconstants::SAML20MD_QUERY_EXT_NS,false);
1939                 QueryDescriptorTypeImpl::processChildElement(childXMLObject,root);
1940             }
1941         };
1942
1943         class SAML_DLLLOCAL AffiliationDescriptorImpl : public virtual AffiliationDescriptor,
1944             public virtual SignableObject,
1945             public AbstractComplexElement,
1946             public AbstractAttributeExtensibleXMLObject,
1947             public AbstractDOMCachingXMLObject,
1948             public AbstractXMLObjectMarshaller,
1949             public AbstractXMLObjectUnmarshaller
1950         {
1951             list<XMLObject*>::iterator m_pos_AffiliateMember;
1952
1953             void init() {
1954                 m_ID=m_AffiliationOwnerID=nullptr;
1955                 m_ValidUntil=m_CacheDuration=nullptr;
1956                 m_children.push_back(nullptr);
1957                 m_children.push_back(nullptr);
1958                 m_children.push_back(nullptr);
1959                 m_Signature=nullptr;
1960                 m_Extensions=nullptr;
1961                 m_pos_Signature=m_children.begin();
1962                 m_pos_Extensions=m_pos_Signature;
1963                 ++m_pos_Extensions;
1964                 m_pos_AffiliateMember=m_pos_Extensions;
1965                 ++m_pos_AffiliateMember;
1966             }
1967
1968         public:
1969             virtual ~AffiliationDescriptorImpl() {
1970                 XMLString::release(&m_ID);
1971                 XMLString::release(&m_AffiliationOwnerID);
1972                 delete m_ValidUntil;
1973                 delete m_CacheDuration;
1974             }
1975
1976             AffiliationDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1977                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1978                 init();
1979             }
1980
1981             AffiliationDescriptorImpl(const AffiliationDescriptorImpl& src)
1982                     : AbstractXMLObject(src), AbstractComplexElement(src),
1983                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
1984                 init();
1985                 setID(src.getID());
1986                 setAffiliationOwnerID(src.getAffiliationOwnerID());
1987                 setValidUntil(src.getValidUntil());
1988                 setCacheDuration(src.getCacheDuration());
1989                 if (src.getSignature())
1990                     setSignature(src.getSignature()->cloneSignature());
1991                 if (src.getExtensions())
1992                     setExtensions(src.getExtensions()->cloneExtensions());
1993
1994                 VectorOf(KeyDescriptor) v=getKeyDescriptors();
1995                 for (vector<KeyDescriptor*>::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) {
1996                     if (*i) {
1997                         v.push_back((*i)->cloneKeyDescriptor());
1998                     }
1999                 }
2000                 VectorOf(AffiliateMember) w=getAffiliateMembers();
2001                 for (vector<AffiliateMember*>::const_iterator j=src.m_AffiliateMembers.begin(); j!=src.m_AffiliateMembers.end(); j++) {
2002                     if (*j) {
2003                         w.push_back((*j)->cloneAffiliateMember());
2004                     }
2005                 }
2006             }
2007
2008             IMPL_XMLOBJECT_CLONE(AffiliationDescriptor);
2009
2010             //IMPL_TYPED_CHILD(Signature);
2011             // Need customized setter.
2012         protected:
2013             Signature* m_Signature;
2014             list<XMLObject*>::iterator m_pos_Signature;
2015         public:
2016             Signature* getSignature() const {
2017                 return m_Signature;
2018             }
2019
2020             void setSignature(Signature* sig) {
2021                 prepareForAssignment(m_Signature,sig);
2022                 *m_pos_Signature=m_Signature=sig;
2023                 // Sync content reference back up.
2024                 if (m_Signature)
2025                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
2026             }
2027
2028             IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
2029             IMPL_STRING_ATTRIB(AffiliationOwnerID);
2030             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
2031             IMPL_DURATION_ATTRIB(CacheDuration,0);
2032             IMPL_TYPED_CHILD(Extensions);
2033             IMPL_TYPED_CHILDREN(AffiliateMember,m_pos_AffiliateMember);
2034             IMPL_TYPED_CHILDREN(KeyDescriptor,m_children.end());
2035
2036             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
2037                 if (!qualifiedName.hasNamespaceURI()) {
2038                     if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
2039                         setID(value);
2040                         return;
2041                     }
2042                     else if (XMLString::equals(qualifiedName.getLocalPart(),AFFILIATIONOWNERID_ATTRIB_NAME)) {
2043                         setAffiliationOwnerID(value);
2044                         return;
2045                     }
2046                     else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
2047                         setValidUntil(value);
2048                         return;
2049                     }
2050                     else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
2051                         setCacheDuration(value);
2052                         return;
2053                     }
2054                 }
2055                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
2056             }
2057
2058         protected:
2059             void prepareForMarshalling() const {
2060                 if (m_Signature)
2061                     declareNonVisibleNamespaces();
2062             }
2063
2064             void marshallAttributes(DOMElement* domElement) const {
2065                 MARSHALL_ID_ATTRIB(ID,ID,nullptr);
2066                 MARSHALL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID,nullptr);
2067                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
2068                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
2069                 marshallExtensionAttributes(domElement);
2070             }
2071
2072             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2073                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
2074                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
2075                 PROC_TYPED_CHILDREN(AffiliateMember,SAML20MD_NS,false);
2076                 PROC_TYPED_CHILDREN(KeyDescriptor,SAML20MD_NS,false);
2077                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2078             }
2079
2080             void processAttribute(const DOMAttr* attribute) {
2081                 PROC_ID_ATTRIB(ID,ID,nullptr);
2082                 unmarshallExtensionAttribute(attribute);
2083             }
2084         };
2085
2086         class SAML_DLLLOCAL EntityDescriptorImpl : public virtual EntityDescriptor,
2087             public virtual SignableObject,
2088             public AbstractComplexElement,
2089             public AbstractAttributeExtensibleXMLObject,
2090             public AbstractDOMCachingXMLObject,
2091             public AbstractXMLObjectMarshaller,
2092             public AbstractXMLObjectUnmarshaller
2093         {
2094             list<XMLObject*>::iterator m_pos_ContactPerson;
2095
2096             void init() {
2097                 m_ID=m_EntityID=nullptr;
2098                 m_ValidUntil=m_CacheDuration=nullptr;
2099                 m_children.push_back(nullptr);
2100                 m_children.push_back(nullptr);
2101                 m_children.push_back(nullptr);
2102                 m_children.push_back(nullptr);
2103                 m_children.push_back(nullptr);
2104                 m_Signature=nullptr;
2105                 m_Extensions=nullptr;
2106                 m_AffiliationDescriptor=nullptr;
2107                 m_Organization=nullptr;
2108                 m_pos_Signature=m_children.begin();
2109                 m_pos_Extensions=m_pos_Signature;
2110                 ++m_pos_Extensions;
2111                 m_pos_AffiliationDescriptor=m_pos_Extensions;
2112                 ++m_pos_AffiliationDescriptor;
2113                 m_pos_Organization=m_pos_AffiliationDescriptor;
2114                 ++m_pos_Organization;
2115                 m_pos_ContactPerson=m_pos_Organization;
2116                 ++m_pos_ContactPerson;
2117             }
2118
2119         public:
2120             virtual ~EntityDescriptorImpl() {
2121                 XMLString::release(&m_ID);
2122                 XMLString::release(&m_EntityID);
2123                 delete m_ValidUntil;
2124                 delete m_CacheDuration;
2125             }
2126
2127             EntityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2128                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2129                 init();
2130             }
2131
2132             EntityDescriptorImpl(const EntityDescriptorImpl& src)
2133                     : AbstractXMLObject(src), AbstractComplexElement(src),
2134                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
2135                 init();
2136                 setID(src.getID());
2137                 setEntityID(src.getEntityID());
2138                 setValidUntil(src.getValidUntil());
2139                 setCacheDuration(src.getCacheDuration());
2140                 if (src.getSignature())
2141                     setSignature(src.getSignature()->cloneSignature());
2142                 if (src.getExtensions())
2143                     setExtensions(src.getExtensions()->cloneExtensions());
2144                 if (src.getAffiliationDescriptor())
2145                     setAffiliationDescriptor(src.getAffiliationDescriptor()->cloneAffiliationDescriptor());
2146                 if (src.getOrganization())
2147                     setOrganization(src.getOrganization()->cloneOrganization());
2148
2149                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2150                     if (*i) {
2151                         IDPSSODescriptor* idp=dynamic_cast<IDPSSODescriptor*>(*i);
2152                         if (idp) {
2153                             getIDPSSODescriptors().push_back(idp->cloneIDPSSODescriptor());
2154                             continue;
2155                         }
2156
2157                         SPSSODescriptor* sp=dynamic_cast<SPSSODescriptor*>(*i);
2158                         if (sp) {
2159                             getSPSSODescriptors().push_back(sp->cloneSPSSODescriptor());
2160                             continue;
2161                         }
2162
2163                         AuthnAuthorityDescriptor* authn=dynamic_cast<AuthnAuthorityDescriptor*>(*i);
2164                         if (authn) {
2165                             getAuthnAuthorityDescriptors().push_back(authn->cloneAuthnAuthorityDescriptor());
2166                             continue;
2167                         }
2168
2169                         AttributeAuthorityDescriptor* attr=dynamic_cast<AttributeAuthorityDescriptor*>(*i);
2170                         if (attr) {
2171                             getAttributeAuthorityDescriptors().push_back(attr->cloneAttributeAuthorityDescriptor());
2172                             continue;
2173                         }
2174
2175                         PDPDescriptor* pdp=dynamic_cast<PDPDescriptor*>(*i);
2176                         if (pdp) {
2177                             getPDPDescriptors().push_back(pdp->clonePDPDescriptor());
2178                             continue;
2179                         }
2180
2181                         AuthnQueryDescriptorType* authnq=dynamic_cast<AuthnQueryDescriptorType*>(*i);
2182                         if (authnq) {
2183                             getAuthnQueryDescriptorTypes().push_back(authnq->cloneAuthnQueryDescriptorType());
2184                             continue;
2185                         }
2186
2187                         AttributeQueryDescriptorType* attrq=dynamic_cast<AttributeQueryDescriptorType*>(*i);
2188                         if (attrq) {
2189                             getAttributeQueryDescriptorTypes().push_back(attrq->cloneAttributeQueryDescriptorType());
2190                             continue;
2191                         }
2192
2193                         AuthzDecisionQueryDescriptorType* authzq=dynamic_cast<AuthzDecisionQueryDescriptorType*>(*i);
2194                         if (authzq) {
2195                             getAuthzDecisionQueryDescriptorTypes().push_back(authzq->cloneAuthzDecisionQueryDescriptorType());
2196                             continue;
2197                         }
2198
2199                         RoleDescriptor* role=dynamic_cast<RoleDescriptor*>(*i);
2200                         if (role) {
2201                             getRoleDescriptors().push_back(role->cloneRoleDescriptor());
2202                             continue;
2203                         }
2204                     }
2205                 }
2206
2207                 VectorOf(ContactPerson) v=getContactPersons();
2208                 for (vector<ContactPerson*>::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) {
2209                     if (*j) {
2210                         v.push_back((*j)->cloneContactPerson());
2211                     }
2212                 }
2213                 VectorOf(AdditionalMetadataLocation) w=getAdditionalMetadataLocations();
2214                 for (vector<AdditionalMetadataLocation*>::const_iterator k=src.m_AdditionalMetadataLocations.begin(); k!=src.m_AdditionalMetadataLocations.end(); k++) {
2215                     if (*k) {
2216                         w.push_back((*k)->cloneAdditionalMetadataLocation());
2217                     }
2218                 }
2219             }
2220
2221             IMPL_XMLOBJECT_CLONE(EntityDescriptor);
2222
2223             //IMPL_TYPED_CHILD(Signature);
2224             // Need customized setter.
2225         protected:
2226             Signature* m_Signature;
2227             list<XMLObject*>::iterator m_pos_Signature;
2228         public:
2229             Signature* getSignature() const {
2230                 return m_Signature;
2231             }
2232
2233             void setSignature(Signature* sig) {
2234                 prepareForAssignment(m_Signature,sig);
2235                 *m_pos_Signature=m_Signature=sig;
2236                 // Sync content reference back up.
2237                 if (m_Signature)
2238                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
2239             }
2240
2241             IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
2242             IMPL_STRING_ATTRIB(EntityID);
2243             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
2244             IMPL_DURATION_ATTRIB(CacheDuration,0);
2245             IMPL_TYPED_CHILD(Extensions);
2246             IMPL_TYPED_CHILDREN(RoleDescriptor,m_pos_AffiliationDescriptor);
2247             IMPL_TYPED_CHILDREN(IDPSSODescriptor,m_pos_AffiliationDescriptor);
2248             IMPL_TYPED_CHILDREN(SPSSODescriptor,m_pos_AffiliationDescriptor);
2249             IMPL_TYPED_CHILDREN(AuthnAuthorityDescriptor,m_pos_AffiliationDescriptor);
2250             IMPL_TYPED_CHILDREN(AttributeAuthorityDescriptor,m_pos_AffiliationDescriptor);
2251             IMPL_TYPED_CHILDREN(PDPDescriptor,m_pos_AffiliationDescriptor);
2252             IMPL_TYPED_CHILDREN(AuthnQueryDescriptorType,m_pos_AffiliationDescriptor);
2253             IMPL_TYPED_CHILDREN(AttributeQueryDescriptorType,m_pos_AffiliationDescriptor);
2254             IMPL_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType,m_pos_AffiliationDescriptor);
2255             IMPL_TYPED_CHILD(AffiliationDescriptor);
2256             IMPL_TYPED_CHILD(Organization);
2257             IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson);
2258             IMPL_TYPED_CHILDREN(AdditionalMetadataLocation,m_children.end());
2259
2260             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
2261                 if (!qualifiedName.hasNamespaceURI()) {
2262                     if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
2263                         setID(value);
2264                         return;
2265                     }
2266                     else if (XMLString::equals(qualifiedName.getLocalPart(),ENTITYID_ATTRIB_NAME)) {
2267                         setEntityID(value);
2268                         return;
2269                     }
2270                     else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
2271                         setValidUntil(value);
2272                         return;
2273                     }
2274                     else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
2275                         setCacheDuration(value);
2276                         return;
2277                     }
2278                 }
2279                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
2280             }
2281
2282             const RoleDescriptor* getRoleDescriptor(const xmltooling::QName& qname, const XMLCh* protocol) const {
2283                 // Check for "known" elements/types.
2284                 if (qname == IDPSSODescriptor::ELEMENT_QNAME)
2285                     return find_if(m_IDPSSODescriptors, isValidForProtocol(protocol));
2286                 if (qname == SPSSODescriptor::ELEMENT_QNAME)
2287                     return find_if(m_SPSSODescriptors, isValidForProtocol(protocol));
2288                 if (qname == AuthnAuthorityDescriptor::ELEMENT_QNAME)
2289                     return find_if(m_AuthnAuthorityDescriptors, isValidForProtocol(protocol));
2290                 if (qname == AttributeAuthorityDescriptor::ELEMENT_QNAME)
2291                     return find_if(m_AttributeAuthorityDescriptors, isValidForProtocol(protocol));
2292                 if (qname == PDPDescriptor::ELEMENT_QNAME)
2293                     return find_if(m_PDPDescriptors, isValidForProtocol(protocol));
2294                 if (qname == AuthnQueryDescriptorType::TYPE_QNAME)
2295                     return find_if(m_AuthnQueryDescriptorTypes, isValidForProtocol(protocol));
2296                 if (qname == AttributeQueryDescriptorType::TYPE_QNAME)
2297                     return find_if(m_AttributeQueryDescriptorTypes, isValidForProtocol(protocol));
2298                 if (qname == AuthzDecisionQueryDescriptorType::TYPE_QNAME)
2299                     return find_if(m_AuthzDecisionQueryDescriptorTypes, isValidForProtocol(protocol));
2300
2301                 vector<RoleDescriptor*>::const_iterator i =
2302                     find_if(m_RoleDescriptors.begin(), m_RoleDescriptors.end(), ofTypeValidForProtocol(qname,protocol));
2303                 return (i!=m_RoleDescriptors.end()) ? *i : nullptr;
2304             }
2305
2306         protected:
2307             void prepareForMarshalling() const {
2308                 if (m_Signature)
2309                     declareNonVisibleNamespaces();
2310             }
2311
2312             void marshallAttributes(DOMElement* domElement) const {
2313                 MARSHALL_ID_ATTRIB(ID,ID,nullptr);
2314                 MARSHALL_STRING_ATTRIB(EntityID,ENTITYID,nullptr);
2315                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
2316                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
2317                 marshallExtensionAttributes(domElement);
2318             }
2319
2320             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2321                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
2322                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
2323                 PROC_TYPED_CHILDREN(IDPSSODescriptor,SAML20MD_NS,false);
2324                 PROC_TYPED_CHILDREN(SPSSODescriptor,SAML20MD_NS,false);
2325                 PROC_TYPED_CHILDREN(AuthnAuthorityDescriptor,SAML20MD_NS,false);
2326                 PROC_TYPED_CHILDREN(AttributeAuthorityDescriptor,SAML20MD_NS,false);
2327                 PROC_TYPED_CHILDREN(PDPDescriptor,SAML20MD_NS,false);
2328                 PROC_TYPED_CHILDREN(AuthnQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
2329                 PROC_TYPED_CHILDREN(AttributeQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
2330                 PROC_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
2331                 PROC_TYPED_CHILDREN(RoleDescriptor,SAML20MD_NS,false);
2332                 PROC_TYPED_CHILD(AffiliationDescriptor,SAML20MD_NS,false);
2333                 PROC_TYPED_CHILD(Organization,SAML20MD_NS,false);
2334                 PROC_TYPED_CHILDREN(ContactPerson,SAML20MD_NS,false);
2335                 PROC_TYPED_CHILDREN(AdditionalMetadataLocation,SAML20MD_NS,false);
2336                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2337             }
2338
2339             void processAttribute(const DOMAttr* attribute) {
2340                 PROC_ID_ATTRIB(ID,ID,nullptr);
2341                 unmarshallExtensionAttribute(attribute);
2342             }
2343         };
2344
2345         class SAML_DLLLOCAL EntitiesDescriptorImpl : public virtual EntitiesDescriptor,
2346             public virtual SignableObject,
2347             public AbstractComplexElement,
2348             public AbstractDOMCachingXMLObject,
2349             public AbstractXMLObjectMarshaller,
2350             public AbstractXMLObjectUnmarshaller
2351         {
2352             void init() {
2353                 m_ID=m_Name=nullptr;
2354                 m_ValidUntil=m_CacheDuration=nullptr;
2355                 m_children.push_back(nullptr);
2356                 m_children.push_back(nullptr);
2357                 m_Signature=nullptr;
2358                 m_Extensions=nullptr;
2359                 m_pos_Signature=m_children.begin();
2360                 m_pos_Extensions=m_pos_Signature;
2361                 ++m_pos_Extensions;
2362             }
2363
2364         public:
2365             virtual ~EntitiesDescriptorImpl() {
2366                 XMLString::release(&m_ID);
2367                 XMLString::release(&m_Name);
2368                 delete m_ValidUntil;
2369                 delete m_CacheDuration;
2370             }
2371
2372             EntitiesDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2373                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2374                 init();
2375             }
2376
2377             EntitiesDescriptorImpl(const EntitiesDescriptorImpl& src)
2378                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
2379                 init();
2380                 setID(src.getID());
2381                 setName(src.getName());
2382                 setValidUntil(src.getValidUntil());
2383                 setCacheDuration(src.getCacheDuration());
2384                 if (src.getSignature())
2385                     setSignature(src.getSignature()->cloneSignature());
2386                 if (src.getExtensions())
2387                     setExtensions(src.getExtensions()->cloneExtensions());
2388
2389                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2390                     if (*i) {
2391                         EntityDescriptor* e=dynamic_cast<EntityDescriptor*>(*i);
2392                         if (e) {
2393                             getEntityDescriptors().push_back(e->cloneEntityDescriptor());
2394                             continue;
2395                         }
2396
2397                         EntitiesDescriptor* es=dynamic_cast<EntitiesDescriptor*>(*i);
2398                         if (es) {
2399                             getEntitiesDescriptors().push_back(es->cloneEntitiesDescriptor());
2400                             continue;
2401                         }
2402                     }
2403                 }
2404             }
2405
2406             IMPL_XMLOBJECT_CLONE(EntitiesDescriptor);
2407
2408             //IMPL_TYPED_CHILD(Signature);
2409             // Need customized setter.
2410         protected:
2411             Signature* m_Signature;
2412             list<XMLObject*>::iterator m_pos_Signature;
2413         public:
2414             Signature* getSignature() const {
2415                 return m_Signature;
2416             }
2417
2418             void setSignature(Signature* sig) {
2419                 prepareForAssignment(m_Signature,sig);
2420                 *m_pos_Signature=m_Signature=sig;
2421                 // Sync content reference back up.
2422                 if (m_Signature)
2423                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
2424             }
2425
2426             IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
2427             IMPL_STRING_ATTRIB(Name);
2428             IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
2429             IMPL_DURATION_ATTRIB(CacheDuration,0);
2430             IMPL_TYPED_CHILD(Extensions);
2431             IMPL_TYPED_CHILDREN(EntityDescriptor,m_children.end());
2432             IMPL_TYPED_CHILDREN(EntitiesDescriptor,m_children.end());
2433
2434         protected:
2435             void prepareForMarshalling() const {
2436                 if (m_Signature)
2437                     declareNonVisibleNamespaces();
2438             }
2439
2440             void marshallAttributes(DOMElement* domElement) const {
2441                 MARSHALL_ID_ATTRIB(ID,ID,nullptr);
2442                 MARSHALL_STRING_ATTRIB(Name,NAME,nullptr);
2443                 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
2444                 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
2445             }
2446
2447             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2448                 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
2449                 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
2450                 PROC_TYPED_CHILDREN(EntityDescriptor,SAML20MD_NS,false);
2451                 PROC_TYPED_CHILDREN(EntitiesDescriptor,SAML20MD_NS,false);
2452                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2453             }
2454
2455             void processAttribute(const DOMAttr* attribute) {
2456                 PROC_ID_ATTRIB(ID,ID,nullptr);
2457                 PROC_STRING_ATTRIB(Name,NAME,nullptr);
2458                 PROC_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
2459                 PROC_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
2460             }
2461         };
2462
2463         class SAML_DLLLOCAL EntityAttributesImpl : public virtual EntityAttributes,
2464             public AbstractComplexElement,
2465             public AbstractDOMCachingXMLObject,
2466             public AbstractXMLObjectMarshaller,
2467             public AbstractXMLObjectUnmarshaller
2468         {
2469         public:
2470             virtual ~EntityAttributesImpl() {}
2471
2472             EntityAttributesImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2473                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2474             }
2475
2476             EntityAttributesImpl(const EntityAttributesImpl& src)
2477                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
2478                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2479                     if (*i) {
2480                         Attribute* a=dynamic_cast<Attribute*>(*i);
2481                         if (a) {
2482                             getAttributes().push_back(a->cloneAttribute());
2483                             continue;
2484                         }
2485
2486                         saml2::Assertion* as=dynamic_cast<saml2::Assertion*>(*i);
2487                         if (as) {
2488                             getAssertions().push_back(as->cloneAssertion());
2489                             continue;
2490                         }
2491                     }
2492                 }
2493             }
2494
2495             IMPL_XMLOBJECT_CLONE(EntityAttributes);
2496
2497             IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
2498             IMPL_TYPED_FOREIGN_CHILDREN(Assertion,saml2,m_children.end());
2499
2500         protected:
2501             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2502                 PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
2503                 PROC_TYPED_FOREIGN_CHILDREN(Assertion,saml2,SAML20_NS,false);
2504                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2505             }
2506         };
2507
2508         class SAML_DLLLOCAL DigestMethodImpl : public virtual DigestMethod,
2509             public AbstractComplexElement,
2510             public AbstractDOMCachingXMLObject,
2511             public AbstractXMLObjectMarshaller,
2512             public AbstractXMLObjectUnmarshaller
2513         {
2514         public:
2515             virtual ~DigestMethodImpl() {
2516                 XMLString::release(&m_Algorithm);
2517             }
2518
2519             DigestMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2520                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2521                 m_Algorithm = nullptr;
2522             }
2523
2524             DigestMethodImpl(const DigestMethodImpl& src)
2525                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
2526                 setAlgorithm(src.getAlgorithm());
2527                 VectorOf(XMLObject) v=getUnknownXMLObjects();
2528                 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
2529                     v.push_back((*i)->clone());
2530             }
2531
2532             IMPL_STRING_ATTRIB(Algorithm);
2533
2534             IMPL_XMLOBJECT_CLONE(DigestMethod);
2535             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
2536
2537         protected:
2538             void marshallAttributes(DOMElement* domElement) const {
2539                 MARSHALL_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
2540             }
2541
2542             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2543                 // Unknown child.
2544                 getUnknownXMLObjects().push_back(childXMLObject);
2545             }
2546
2547             void processAttribute(const DOMAttr* attribute) {
2548                 PROC_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
2549             }
2550         };
2551
2552         class SAML_DLLLOCAL SigningMethodImpl : public virtual SigningMethod,
2553             public AbstractComplexElement,
2554             public AbstractDOMCachingXMLObject,
2555             public AbstractXMLObjectMarshaller,
2556             public AbstractXMLObjectUnmarshaller
2557         {
2558         public:
2559             virtual ~SigningMethodImpl() {
2560                 XMLString::release(&m_Algorithm);
2561                 XMLString::release(&m_MinKeySize);
2562                 XMLString::release(&m_MaxKeySize);
2563             }
2564
2565             SigningMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2566                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2567                 m_Algorithm = nullptr;
2568                 m_MinKeySize = nullptr;
2569                 m_MaxKeySize = nullptr;
2570             }
2571
2572             SigningMethodImpl(const SigningMethodImpl& src)
2573                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
2574                 setAlgorithm(src.getAlgorithm());
2575                 setMinKeySize(src.m_MinKeySize);
2576                 setMaxKeySize(src.m_MaxKeySize);
2577                 VectorOf(XMLObject) v=getUnknownXMLObjects();
2578                 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
2579                     v.push_back((*i)->clone());
2580             }
2581
2582             IMPL_XMLOBJECT_CLONE(SigningMethod);
2583             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
2584
2585             IMPL_STRING_ATTRIB(Algorithm);
2586             IMPL_INTEGER_ATTRIB(MinKeySize);
2587             IMPL_INTEGER_ATTRIB(MaxKeySize);
2588
2589         protected:
2590             void marshallAttributes(DOMElement* domElement) const {
2591                 MARSHALL_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
2592                 MARSHALL_INTEGER_ATTRIB(MinKeySize,MINKEYSIZE,nullptr);
2593                 MARSHALL_INTEGER_ATTRIB(MaxKeySize,MAXKEYSIZE,nullptr);
2594             }
2595
2596             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2597                 // Unknown child.
2598                 getUnknownXMLObjects().push_back(childXMLObject);
2599             }
2600
2601             void processAttribute(const DOMAttr* attribute) {
2602                 PROC_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
2603                 PROC_INTEGER_ATTRIB(MinKeySize,MINKEYSIZE,nullptr);
2604                 PROC_INTEGER_ATTRIB(MaxKeySize,MAXKEYSIZE,nullptr);
2605             }
2606         };
2607
2608     };
2609 };
2610
2611 #if defined (_MSC_VER)
2612     #pragma warning( pop )
2613 #endif
2614
2615 IMPL_ELEMENT_QNAME(IDPSSODescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2616 IMPL_ELEMENT_QNAME(SPSSODescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2617 IMPL_ELEMENT_QNAME(AuthnAuthorityDescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2618 IMPL_ELEMENT_QNAME(AttributeAuthorityDescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2619 IMPL_ELEMENT_QNAME(PDPDescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2620 IMPL_TYPE_QNAME(AuthnQueryDescriptorType, SAML20MD_QUERY_EXT_NS, SAML20MD_QUERY_EXT_PREFIX);
2621 IMPL_TYPE_QNAME(AttributeQueryDescriptorType, SAML20MD_QUERY_EXT_NS, SAML20MD_QUERY_EXT_PREFIX);
2622 IMPL_TYPE_QNAME(AuthzDecisionQueryDescriptorType, SAML20MD_QUERY_EXT_NS, SAML20MD_QUERY_EXT_PREFIX);
2623
2624 // Builder Implementations
2625
2626 IMPL_XMLOBJECTBUILDER(AdditionalMetadataLocation);
2627 IMPL_XMLOBJECTBUILDER(AffiliateMember);
2628 IMPL_XMLOBJECTBUILDER(AffiliationDescriptor);
2629 IMPL_XMLOBJECTBUILDER(ArtifactResolutionService);
2630 IMPL_XMLOBJECTBUILDER(AssertionConsumerService);
2631 IMPL_XMLOBJECTBUILDER(AssertionIDRequestService);
2632 IMPL_XMLOBJECTBUILDER(AttributeAuthorityDescriptor);
2633 IMPL_XMLOBJECTBUILDER(AttributeConsumingService);
2634 IMPL_XMLOBJECTBUILDER(AttributeProfile);
2635 IMPL_XMLOBJECTBUILDER(AttributeQueryDescriptorType);
2636 IMPL_XMLOBJECTBUILDER(AttributeService);
2637 IMPL_XMLOBJECTBUILDER(AuthnAuthorityDescriptor);
2638 IMPL_XMLOBJECTBUILDER(AuthnQueryDescriptorType);
2639 IMPL_XMLOBJECTBUILDER(AuthnQueryService);
2640 IMPL_XMLOBJECTBUILDER(AuthzDecisionQueryDescriptorType);
2641 IMPL_XMLOBJECTBUILDER(AuthzService);
2642 IMPL_XMLOBJECTBUILDER(Company);
2643 IMPL_XMLOBJECTBUILDER(ContactPerson);
2644 IMPL_XMLOBJECTBUILDER(EmailAddress);
2645 IMPL_XMLOBJECTBUILDER(EndpointType);
2646 IMPL_XMLOBJECTBUILDER(EntitiesDescriptor);
2647 IMPL_XMLOBJECTBUILDER(EntityDescriptor);
2648 IMPL_XMLOBJECTBUILDER(Extensions);
2649 IMPL_XMLOBJECTBUILDER(GivenName);
2650 IMPL_XMLOBJECTBUILDER(IDPSSODescriptor);
2651 IMPL_XMLOBJECTBUILDER(IndexedEndpointType);
2652 IMPL_XMLOBJECTBUILDER(KeyDescriptor);
2653 IMPL_XMLOBJECTBUILDER(localizedNameType);
2654 IMPL_XMLOBJECTBUILDER(localizedURIType);
2655 IMPL_XMLOBJECTBUILDER(ManageNameIDService);
2656 IMPL_XMLOBJECTBUILDER(NameIDFormat);
2657 IMPL_XMLOBJECTBUILDER(NameIDMappingService);
2658 IMPL_XMLOBJECTBUILDER(Organization);
2659 IMPL_XMLOBJECTBUILDER(OrganizationName);
2660 IMPL_XMLOBJECTBUILDER(OrganizationDisplayName);
2661 IMPL_XMLOBJECTBUILDER(OrganizationURL);
2662 IMPL_XMLOBJECTBUILDER(PDPDescriptor);
2663 IMPL_XMLOBJECTBUILDER(RequestedAttribute);
2664 IMPL_XMLOBJECTBUILDER(ServiceDescription);
2665 IMPL_XMLOBJECTBUILDER(ServiceName);
2666 IMPL_XMLOBJECTBUILDER(SingleLogoutService);
2667 IMPL_XMLOBJECTBUILDER(SingleSignOnService);
2668 IMPL_XMLOBJECTBUILDER(SPSSODescriptor);
2669 IMPL_XMLOBJECTBUILDER(SurName);
2670 IMPL_XMLOBJECTBUILDER(TelephoneNumber);
2671
2672 IMPL_XMLOBJECTBUILDER(ActionNamespace);
2673 IMPL_XMLOBJECTBUILDER(SourceID);
2674 IMPL_XMLOBJECTBUILDER(EntityAttributes);
2675 IMPL_XMLOBJECTBUILDER(DigestMethod);
2676 IMPL_XMLOBJECTBUILDER(SigningMethod);
2677
2678 #ifdef HAVE_COVARIANT_RETURNS
2679 RoleDescriptor* RoleDescriptorBuilder::buildObject(
2680 #else
2681 xmltooling::XMLObject* RoleDescriptorBuilder::buildObject(
2682 #endif
2683     const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType
2684     ) const
2685 {
2686     return new RoleDescriptorTypeImpl(nsURI,localName,prefix,schemaType);
2687 }
2688
2689 const DigestMethod* RoleDescriptor::getDigestMethod() const
2690 {
2691     bool roleLevel = false;
2692     XMLToolingConfig& conf = XMLToolingConfig::getConfig();
2693
2694     if (getExtensions()) {
2695         const vector<XMLObject*>& exts = const_cast<const Extensions*>(getExtensions())->getUnknownXMLObjects();
2696         for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
2697             const opensaml::saml2md::DigestMethod* dm = dynamic_cast<opensaml::saml2md::DigestMethod*>(*i);
2698             if (dm) {
2699                 if (dm->getAlgorithm() && conf.isXMLAlgorithmSupported(dm->getAlgorithm(), XMLToolingConfig::ALGTYPE_DIGEST))
2700                     return dm;
2701                 roleLevel = true;
2702             }
2703         }
2704     }
2705
2706     if (!roleLevel) {
2707         const EntityDescriptor* entity = dynamic_cast<EntityDescriptor*>(getParent());
2708         if (entity && entity->getExtensions()) {
2709             const vector<XMLObject*>& exts = const_cast<const Extensions*>(entity->getExtensions())->getUnknownXMLObjects();
2710             for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
2711                 const opensaml::saml2md::DigestMethod* dm = dynamic_cast<opensaml::saml2md::DigestMethod*>(*i);
2712                 if (dm && dm->getAlgorithm() && conf.isXMLAlgorithmSupported(dm->getAlgorithm(), XMLToolingConfig::ALGTYPE_DIGEST))
2713                     return dm;
2714             }
2715         }
2716     }
2717
2718     return nullptr;
2719 }
2720
2721 pair<const SigningMethod*,const Credential*> RoleDescriptor::getSigningMethod(const CredentialResolver& resolver, CredentialCriteria& cc) const
2722 {
2723     bool roleLevel = false;
2724     XMLToolingConfig& conf = XMLToolingConfig::getConfig();
2725
2726     if (getExtensions()) {
2727         const vector<XMLObject*>& exts = const_cast<const Extensions*>(getExtensions())->getUnknownXMLObjects();
2728         for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
2729             const SigningMethod* sm = dynamic_cast<SigningMethod*>(*i);
2730             if (sm) {
2731                 roleLevel = true;
2732                 if (sm->getAlgorithm() && conf.isXMLAlgorithmSupported(sm->getAlgorithm(), XMLToolingConfig::ALGTYPE_SIGN)) {
2733                     cc.setXMLAlgorithm(sm->getAlgorithm());
2734                     pair<bool,int> minsize = sm->getMinKeySize(), maxsize = sm->getMaxKeySize();
2735                     if (minsize.first || maxsize.first) {
2736                         cc.setKeySize(minsize.first ? minsize.second : 0);
2737                         cc.setMaxKeySize(maxsize.first ? maxsize.second : UINT_MAX);
2738                     }
2739                     else {
2740                         cc.setKeySize(0);
2741                         cc.setMaxKeySize(0);
2742                     }
2743                     const Credential* cred = resolver.resolve(&cc);
2744                     if (cred)
2745                         return make_pair(sm, cred);
2746                 }
2747             }
2748         }
2749     }
2750
2751     if (!roleLevel) {
2752         const EntityDescriptor* entity = dynamic_cast<EntityDescriptor*>(getParent());
2753         if (entity && entity->getExtensions()) {
2754             const vector<XMLObject*>& exts = const_cast<const Extensions*>(entity->getExtensions())->getUnknownXMLObjects();
2755             for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
2756                 const SigningMethod* sm = dynamic_cast<SigningMethod*>(*i);
2757                 if (sm) {
2758                     if (sm->getAlgorithm() && conf.isXMLAlgorithmSupported(sm->getAlgorithm(), XMLToolingConfig::ALGTYPE_SIGN)) {
2759                         cc.setXMLAlgorithm(sm->getAlgorithm());
2760                         pair<bool,int> minsize = sm->getMinKeySize(), maxsize = sm->getMaxKeySize();
2761                         if (minsize.first || maxsize.first) {
2762                             cc.setKeySize(minsize.first ? minsize.second : 0);
2763                             cc.setMaxKeySize(maxsize.first ? maxsize.second : UINT_MAX);
2764                         }
2765                         else {
2766                             cc.setKeySize(0);
2767                             cc.setMaxKeySize(0);
2768                         }
2769                         const Credential* cred = resolver.resolve(&cc);
2770                         if (cred)
2771                             return make_pair(sm, cred);
2772                     }
2773                 }
2774             }
2775         }
2776     }
2777
2778     cc.setKeySize(0);
2779     cc.setMaxKeySize(0);
2780     cc.setXMLAlgorithm(nullptr);
2781     return pair<const SigningMethod*,const Credential*>(nullptr, resolver.resolve(&cc));
2782 }
2783
2784 const XMLCh ActionNamespace::LOCAL_NAME[] =             UNICODE_LITERAL_15(A,c,t,i,o,n,N,a,m,e,s,p,a,c,e);
2785 const XMLCh AdditionalMetadataLocation::LOCAL_NAME[] =  UNICODE_LITERAL_26(A,d,d,i,t,i,o,n,a,l,M,e,t,a,d,a,t,a,L,o,c,a,t,i,o,n);
2786 const XMLCh AdditionalMetadataLocation::TYPE_NAME[] =   UNICODE_LITERAL_30(A,d,d,i,t,i,o,n,a,l,M,e,t,a,d,a,t,a,L,o,c,a,t,i,o,n,T,y,p,e);
2787 const XMLCh AdditionalMetadataLocation::NAMESPACE_ATTRIB_NAME[] =   UNICODE_LITERAL_9(n,a,m,e,s,p,a,c,e);
2788 const XMLCh AffiliateMember::LOCAL_NAME[] =             UNICODE_LITERAL_15(A,f,f,i,l,i,a,t,e,M,e,m,b,e,r);
2789 const XMLCh AffiliationDescriptor::LOCAL_NAME[] =       UNICODE_LITERAL_21(A,f,f,i,l,i,a,t,i,o,n,D,e,s,c,r,i,p,t,o,r);
2790 const XMLCh AffiliationDescriptor::TYPE_NAME[] =        UNICODE_LITERAL_25(A,f,f,i,l,i,a,t,i,o,n,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2791 const XMLCh AffiliationDescriptor::ID_ATTRIB_NAME[] =   UNICODE_LITERAL_2(I,D);
2792 const XMLCh AffiliationDescriptor::AFFILIATIONOWNERID_ATTRIB_NAME[] =   UNICODE_LITERAL_18(a,f,f,i,l,i,a,t,i,o,n,O,w,n,e,r,I,D);
2793 const XMLCh ArtifactResolutionService::LOCAL_NAME[] =   UNICODE_LITERAL_25(A,r,t,i,f,a,c,t,R,e,s,o,l,u,t,i,o,n,S,e,r,v,i,c,e);
2794 const XMLCh AssertionConsumerService::LOCAL_NAME[] =    UNICODE_LITERAL_24(A,s,s,e,r,t,i,o,n,C,o,n,s,u,m,e,r,S,e,r,v,i,c,e);
2795 const XMLCh AssertionIDRequestService::LOCAL_NAME[] =   UNICODE_LITERAL_25(A,s,s,e,r,t,i,o,n,I,D,R,e,q,u,e,s,t,S,e,r,v,i,c,e);
2796 const XMLCh AttributeAuthorityDescriptor::LOCAL_NAME[] =UNICODE_LITERAL_28(A,t,t,r,i,b,u,t,e,A,u,t,h,o,r,i,t,y,D,e,s,c,r,i,p,t,o,r);
2797 const XMLCh AttributeAuthorityDescriptor::TYPE_NAME[] = UNICODE_LITERAL_32(A,t,t,r,i,b,u,t,e,A,u,t,h,o,r,i,t,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2798 const XMLCh AttributeConsumingService::LOCAL_NAME[] =   UNICODE_LITERAL_25(A,t,t,r,i,b,u,t,e,C,o,n,s,u,m,i,n,g,S,e,r,v,i,c,e);
2799 const XMLCh AttributeConsumingService::TYPE_NAME[] =    UNICODE_LITERAL_29(A,t,t,r,i,b,u,t,e,C,o,n,s,u,m,i,n,g,S,e,r,v,i,c,e,T,y,p,e);
2800 const XMLCh AttributeConsumingService::INDEX_ATTRIB_NAME[] =    UNICODE_LITERAL_5(i,n,d,e,x);
2801 const XMLCh AttributeConsumingService::ISDEFAULT_ATTRIB_NAME[] =    UNICODE_LITERAL_9(i,s,D,e,f,a,u,l,t);
2802 const XMLCh AttributeProfile::LOCAL_NAME[] =            UNICODE_LITERAL_16(A,t,t,r,i,b,u,t,e,P,r,o,f,i,l,e);
2803 const XMLCh AttributeQueryDescriptorType::LOCAL_NAME[] =UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2804 const XMLCh AttributeQueryDescriptorType::TYPE_NAME[] = UNICODE_LITERAL_28(A,t,t,r,i,b,u,t,e,Q,u,e,r,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2805 const XMLCh AttributeService::LOCAL_NAME[] =            UNICODE_LITERAL_16(A,t,t,r,i,b,u,t,e,S,e,r,v,i,c,e);
2806 const XMLCh AuthnAuthorityDescriptor::LOCAL_NAME[] =    UNICODE_LITERAL_24(A,u,t,h,n,A,u,t,h,o,r,i,t,y,D,e,s,c,r,i,p,t,o,r);
2807 const XMLCh AuthnAuthorityDescriptor::TYPE_NAME[] =     UNICODE_LITERAL_28(A,u,t,h,n,A,u,t,h,o,r,i,t,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2808 const XMLCh AuthnQueryDescriptorType::LOCAL_NAME[] =    UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2809 const XMLCh AuthnQueryDescriptorType::TYPE_NAME[] =     UNICODE_LITERAL_24(A,u,t,h,n,Q,u,e,r,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2810 const XMLCh AuthnQueryService::LOCAL_NAME[] =           UNICODE_LITERAL_17(A,u,t,h,n,Q,u,e,r,y,S,e,r,v,i,c,e);
2811 const XMLCh AuthzDecisionQueryDescriptorType::LOCAL_NAME[] =    UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2812 const XMLCh AuthzDecisionQueryDescriptorType::TYPE_NAME[] = UNICODE_LITERAL_32(A,u,t,h,z,D,e,c,i,s,i,o,n,Q,u,e,r,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2813 const XMLCh AuthzService::LOCAL_NAME[] =                UNICODE_LITERAL_12(A,u,t,h,z,S,e,r,v,i,c,e);
2814 const XMLCh CacheableSAMLObject::CACHEDURATION_ATTRIB_NAME[] =  UNICODE_LITERAL_13(c,a,c,h,e,D,u,r,a,t,i,o,n);
2815 const XMLCh Company::LOCAL_NAME[] =                     UNICODE_LITERAL_7(C,o,m,p,a,n,y);
2816 const XMLCh ContactPerson::LOCAL_NAME[] =               UNICODE_LITERAL_13(C,o,n,t,a,c,t,P,e,r,s,o,n);
2817 const XMLCh ContactPerson::TYPE_NAME[] =                UNICODE_LITERAL_11(C,o,n,t,a,c,t,T,y,p,e);
2818 const XMLCh ContactPerson::CONTACTTYPE_ATTRIB_NAME[] =  UNICODE_LITERAL_11(c,o,n,t,a,c,t,T,y,p,e);
2819 const XMLCh ContactPerson::CONTACT_TECHNICAL[] =        UNICODE_LITERAL_9(t,e,c,h,n,i,c,a,l);
2820 const XMLCh ContactPerson::CONTACT_SUPPORT[] =          UNICODE_LITERAL_7(s,u,p,p,o,r,t);
2821 const XMLCh ContactPerson::CONTACT_ADMINISTRATIVE[] =   UNICODE_LITERAL_14(a,d,m,i,n,i,s,t,r,a,t,i,v,e);
2822 const XMLCh ContactPerson::CONTACT_BILLING[] =          UNICODE_LITERAL_7(b,i,l,l,i,n,g);
2823 const XMLCh ContactPerson::CONTACT_OTHER[] =            UNICODE_LITERAL_5(o,t,h,e,r);
2824 const XMLCh DigestMethod::LOCAL_NAME[] =                UNICODE_LITERAL_12(D,i,g,e,s,t,M,e,t,h,o,d);
2825 const XMLCh DigestMethod::TYPE_NAME[] =                 UNICODE_LITERAL_16(D,i,g,e,s,t,M,e,t,h,o,d,T,y,p,e);
2826 const XMLCh DigestMethod::ALGORITHM_ATTRIB_NAME[] =     UNICODE_LITERAL_9(A,l,g,o,r,i,t,h,m);
2827 const XMLCh EmailAddress::LOCAL_NAME[] =                UNICODE_LITERAL_12(E,m,a,i,l,A,d,d,r,e,s,s);
2828 const XMLCh EndpointType::LOCAL_NAME[] =                {chNull};
2829 const XMLCh EndpointType::TYPE_NAME[] =                 UNICODE_LITERAL_12(E,n,d,p,o,i,n,t,T,y,p,e);
2830 const XMLCh EndpointType::BINDING_ATTRIB_NAME[] =       UNICODE_LITERAL_7(B,i,n,d,i,n,g);
2831 const XMLCh EndpointType::LOCATION_ATTRIB_NAME[] =      UNICODE_LITERAL_8(L,o,c,a,t,i,o,n);
2832 const XMLCh EndpointType::RESPONSELOCATION_ATTRIB_NAME[] =  UNICODE_LITERAL_16(R,e,s,p,o,n,s,e,L,o,c,a,t,i,o,n);
2833 const XMLCh EntitiesDescriptor::LOCAL_NAME[] =          UNICODE_LITERAL_18(E,n,t,i,t,i,e,s,D,e,s,c,r,i,p,t,o,r);
2834 const XMLCh EntitiesDescriptor::TYPE_NAME[] =           UNICODE_LITERAL_22(E,n,t,i,t,i,e,s,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2835 const XMLCh EntitiesDescriptor::ID_ATTRIB_NAME[] =      UNICODE_LITERAL_2(I,D);
2836 const XMLCh EntitiesDescriptor::NAME_ATTRIB_NAME[] =    UNICODE_LITERAL_4(N,a,m,e);
2837 const XMLCh EntityDescriptor::LOCAL_NAME[] =            UNICODE_LITERAL_16(E,n,t,i,t,y,D,e,s,c,r,i,p,t,o,r);
2838 const XMLCh EntityDescriptor::TYPE_NAME[] =             UNICODE_LITERAL_20(E,n,t,i,t,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2839 const XMLCh EntityDescriptor::ID_ATTRIB_NAME[] =        UNICODE_LITERAL_2(I,D);
2840 const XMLCh EntityDescriptor::ENTITYID_ATTRIB_NAME[] =  UNICODE_LITERAL_8(e,n,t,i,t,y,I,D);
2841 const XMLCh EntityAttributes::LOCAL_NAME[] =            UNICODE_LITERAL_16(E,n,t,i,t,y,A,t,t,r,i,b,u,t,e,s);
2842 const XMLCh EntityAttributes::TYPE_NAME[] =             UNICODE_LITERAL_20(E,n,t,i,t,y,A,t,t,r,i,b,u,t,e,s,T,y,p,e);
2843 const XMLCh Extensions::LOCAL_NAME[] =                  UNICODE_LITERAL_10(E,x,t,e,n,s,i,o,n,s);
2844 const XMLCh Extensions::TYPE_NAME[] =                   UNICODE_LITERAL_14(E,x,t,e,n,s,i,o,n,s,T,y,p,e);
2845 const XMLCh GivenName::LOCAL_NAME[] =                   UNICODE_LITERAL_9(G,i,v,e,n,N,a,m,e);
2846 const XMLCh IDPSSODescriptor::LOCAL_NAME[] =            UNICODE_LITERAL_16(I,D,P,S,S,O,D,e,s,c,r,i,p,t,o,r);
2847 const XMLCh IDPSSODescriptor::TYPE_NAME[] =             UNICODE_LITERAL_20(I,D,P,S,S,O,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2848 const XMLCh IDPSSODescriptor::WANTAUTHNREQUESTSSIGNED_ATTRIB_NAME[] =   UNICODE_LITERAL_23(W,a,n,t,A,u,t,h,n,R,e,q,u,e,s,t,s,S,i,g,n,e,d);
2849 const XMLCh IndexedEndpointType::LOCAL_NAME[] =         {chNull};
2850 const XMLCh IndexedEndpointType::TYPE_NAME[] =          UNICODE_LITERAL_19(I,n,d,e,x,e,d,E,n,d,p,o,i,n,t,T,y,p,e);
2851 const XMLCh IndexedEndpointType::INDEX_ATTRIB_NAME[] =  UNICODE_LITERAL_5(i,n,d,e,x);
2852 const XMLCh IndexedEndpointType::ISDEFAULT_ATTRIB_NAME[] =  UNICODE_LITERAL_9(i,s,D,e,f,a,u,l,t);
2853 const XMLCh KeyDescriptor::LOCAL_NAME[] =               UNICODE_LITERAL_13(K,e,y,D,e,s,c,r,i,p,t,o,r);
2854 const XMLCh KeyDescriptor::TYPE_NAME[] =                UNICODE_LITERAL_17(K,e,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2855 const XMLCh KeyDescriptor::USE_ATTRIB_NAME[] =          UNICODE_LITERAL_3(u,s,e);
2856 const XMLCh KeyDescriptor::KEYTYPE_ENCRYPTION[] =       UNICODE_LITERAL_10(e,n,c,r,y,p,t,i,o,n);
2857 const XMLCh KeyDescriptor::KEYTYPE_SIGNING[] =          UNICODE_LITERAL_7(s,i,g,n,i,n,g);
2858 const XMLCh localizedNameType::LOCAL_NAME[] =           {chNull};
2859 const XMLCh localizedNameType::TYPE_NAME[] =            UNICODE_LITERAL_17(l,o,c,a,l,i,z,e,d,N,a,m,e,T,y,p,e);
2860 const XMLCh localizedNameType::LANG_ATTRIB_NAME[] =     UNICODE_LITERAL_4(l,a,n,g);
2861 const XMLCh localizedURIType::LOCAL_NAME[] =            {chNull};
2862 const XMLCh localizedURIType::TYPE_NAME[] =             UNICODE_LITERAL_16(l,o,c,a,l,i,z,e,d,U,R,I,T,y,p,e);
2863 const XMLCh localizedURIType::LANG_ATTRIB_NAME[] =      UNICODE_LITERAL_4(l,a,n,g);
2864 const XMLCh ManageNameIDService::LOCAL_NAME[] =         UNICODE_LITERAL_19(M,a,n,a,g,e,N,a,m,e,I,D,S,e,r,v,i,c,e);
2865 const XMLCh NameIDFormat::LOCAL_NAME[] =                UNICODE_LITERAL_12(N,a,m,e,I,D,F,o,r,m,a,t);
2866 const XMLCh NameIDMappingService::LOCAL_NAME[] =        UNICODE_LITERAL_20(N,a,m,e,I,D,M,a,p,p,i,n,g,S,e,r,v,i,c,e);
2867 const XMLCh Organization::LOCAL_NAME[] =                UNICODE_LITERAL_12(O,r,g,a,n,i,z,a,t,i,o,n);
2868 const XMLCh Organization::TYPE_NAME[] =                 UNICODE_LITERAL_16(O,r,g,a,n,i,z,a,t,i,o,n,T,y,p,e);
2869 const XMLCh OrganizationName::LOCAL_NAME[] =            UNICODE_LITERAL_16(O,r,g,a,n,i,z,a,t,i,o,n,N,a,m,e);
2870 const XMLCh OrganizationDisplayName::LOCAL_NAME[] =     UNICODE_LITERAL_23(O,r,g,a,n,i,z,a,t,i,o,n,D,i,s,p,l,a,y,N,a,m,e);
2871 const XMLCh OrganizationURL::LOCAL_NAME[] =             UNICODE_LITERAL_15(O,r,g,a,n,i,z,a,t,i,o,n,U,R,L);
2872 const XMLCh PDPDescriptor::LOCAL_NAME[] =               UNICODE_LITERAL_13(P,D,P,D,e,s,c,r,i,p,t,o,r);
2873 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);
2874 const XMLCh QueryDescriptorType::LOCAL_NAME[] =         {chNull};
2875 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);
2876 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);
2877 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);
2878 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);
2879 const XMLCh RequestedAttribute::ISREQUIRED_ATTRIB_NAME[] =  UNICODE_LITERAL_10(i,s,R,e,q,u,i,r,e,d);
2880 const XMLCh RoleDescriptor::LOCAL_NAME[] =              UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2881 const XMLCh RoleDescriptor::ID_ATTRIB_NAME[] =          UNICODE_LITERAL_2(I,D);
2882 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);
2883 const XMLCh RoleDescriptor::ERRORURL_ATTRIB_NAME[] =    UNICODE_LITERAL_8(e,r,r,o,r,U,R,L);
2884 const XMLCh ServiceDescription::LOCAL_NAME[] =          UNICODE_LITERAL_18(S,e,r,v,i,c,e,D,e,s,c,r,i,p,t,i,o,n);
2885 const XMLCh ServiceName::LOCAL_NAME[] =                 UNICODE_LITERAL_11(S,e,r,v,i,c,e,N,a,m,e);
2886 const XMLCh SigningMethod::LOCAL_NAME[] =               UNICODE_LITERAL_13(S,i,g,n,i,n,g,M,e,t,h,o,d);
2887 const XMLCh SigningMethod::TYPE_NAME[] =                UNICODE_LITERAL_17(S,i,g,n,i,n,g,M,e,t,h,o,d,T,y,p,e);
2888 const XMLCh SigningMethod::ALGORITHM_ATTRIB_NAME[] =    UNICODE_LITERAL_9(A,l,g,o,r,i,t,h,m);
2889 const XMLCh SigningMethod::MINKEYSIZE_ATTRIB_NAME[] =   UNICODE_LITERAL_10(M,i,n,K,e,y,S,i,z,e);
2890 const XMLCh SigningMethod::MAXKEYSIZE_ATTRIB_NAME[] =   UNICODE_LITERAL_10(M,a,x,K,e,y,S,i,z,e);
2891 const XMLCh SingleLogoutService::LOCAL_NAME[] =         UNICODE_LITERAL_19(S,i,n,g,l,e,L,o,g,o,u,t,S,e,r,v,i,c,e);
2892 const XMLCh SingleSignOnService::LOCAL_NAME[] =         UNICODE_LITERAL_19(S,i,n,g,l,e,S,i,g,n,O,n,S,e,r,v,i,c,e);
2893 const XMLCh SourceID::LOCAL_NAME[] =                    UNICODE_LITERAL_8(S,o,u,r,c,e,I,D);
2894 const XMLCh SPSSODescriptor::LOCAL_NAME[] =             UNICODE_LITERAL_15(S,P,S,S,O,D,e,s,c,r,i,p,t,o,r);
2895 const XMLCh SPSSODescriptor::TYPE_NAME[] =              UNICODE_LITERAL_19(S,P,S,S,O,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2896 const XMLCh SPSSODescriptor::AUTHNREQUESTSSIGNED_ATTRIB_NAME[] =    UNICODE_LITERAL_19(A,u,t,h,n,R,e,q,u,e,s,t,s,S,i,g,n,e,d);
2897 const XMLCh SPSSODescriptor::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);
2898 const XMLCh SSODescriptorType::LOCAL_NAME[] =           {chNull};
2899 const XMLCh SSODescriptorType::TYPE_NAME[] =            UNICODE_LITERAL_17(S,S,O,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2900 const XMLCh SurName::LOCAL_NAME[] =                     UNICODE_LITERAL_7(S,u,r,N,a,m,e);
2901 const XMLCh TelephoneNumber::LOCAL_NAME[] =             UNICODE_LITERAL_15(T,e,l,e,p,h,o,n,e,N,u,m,b,e,r);
2902 const XMLCh TimeBoundSAMLObject::VALIDUNTIL_ATTRIB_NAME[] =   UNICODE_LITERAL_10(v,a,l,i,d,U,n,t,i,l);