a82771510dd27bcb6565891404b8e5e50e6e35b4
[shibboleth/cpp-opensaml.git] / saml / saml2 / core / impl / Assertions20Impl.cpp
1 /**
2  * Licensed to the University Corporation for Advanced Internet
3  * Development, Inc. (UCAID) under one or more contributor license
4  * agreements. See the NOTICE file distributed with this work for
5  * additional information regarding copyright ownership.
6  *
7  * UCAID licenses this file to you under the Apache License,
8  * Version 2.0 (the "License"); you may not use this file except
9  * in compliance with the License. You may obtain a copy of the
10  * License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17  * either express or implied. See the License for the specific
18  * language governing permissions and limitations under the License.
19  */
20
21 /**
22  * Assertions20Impl.cpp
23  *
24  * Implementation classes for SAML 2.0 Assertions schema.
25  */
26
27 #include "internal.h"
28 #include "exceptions.h"
29 #include "saml/encryption/EncryptedKeyResolver.h"
30 #include "saml2/core/Assertions.h"
31 #include "signature/ContentReference.h"
32
33 #include <xmltooling/AbstractComplexElement.h>
34 #include <xmltooling/AbstractSimpleElement.h>
35 #include <xmltooling/impl/AnyElement.h>
36 #include <xmltooling/io/AbstractXMLObjectMarshaller.h>
37 #include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
38 #include <xmltooling/signature/KeyInfo.h>
39 #include <xmltooling/signature/Signature.h>
40 #include <xmltooling/util/DateTime.h>
41 #include <xmltooling/util/XMLHelper.h>
42
43 #include <ctime>
44 #include <xercesc/util/XMLUniDefs.hpp>
45
46 using namespace opensaml::saml2;
47 using namespace xmlencryption;
48 using namespace xmlsignature;
49 using namespace xmltooling;
50 using namespace std;
51 using xmlconstants::XSI_NS;
52 using xmlconstants::XMLSIG_NS;
53 using xmlconstants::XMLENC_NS;
54 using xmlconstants::XML_BOOL_NULL;
55 using samlconstants::SAML20_NS;
56 using samlconstants::SAML20_DELEGATION_CONDITION_NS;
57
58
59 #if defined (_MSC_VER)
60     #pragma warning( push )
61     #pragma warning( disable : 4250 4251 )
62 #endif
63
64 namespace opensaml {
65     namespace saml2 {
66
67         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AssertionIDRef);
68         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AssertionURIRef);
69         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,Audience);
70         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AuthnContextClassRef);
71         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AuthnContextDeclRef);
72         DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AuthenticatingAuthority);
73
74         class SAML_DLLLOCAL NameIDTypeImpl : public virtual NameIDType,
75             public AbstractSimpleElement,
76             public AbstractDOMCachingXMLObject,
77             public AbstractXMLObjectMarshaller,
78             public AbstractXMLObjectUnmarshaller
79         {
80             void init() {
81                 m_Format=m_SPProvidedID=m_NameQualifier=m_SPNameQualifier=nullptr;
82             }
83
84         protected:
85             NameIDTypeImpl() {
86                 init();
87             }
88
89         public:
90             virtual ~NameIDTypeImpl() {
91                 XMLString::release(&m_NameQualifier);
92                 XMLString::release(&m_SPNameQualifier);
93                 XMLString::release(&m_Format);
94                 XMLString::release(&m_SPProvidedID);
95             }
96
97             NameIDTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
98                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
99                 init();
100             }
101
102             NameIDTypeImpl(const NameIDTypeImpl& src)
103                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
104                 init();
105             }
106
107             void _clone(const NameIDTypeImpl& src) {
108                 setNameQualifier(src.getNameQualifier());
109                 setSPNameQualifier(src.getSPNameQualifier());
110                 setFormat(src.getFormat());
111                 setSPProvidedID(src.getSPProvidedID());
112             }
113
114             IMPL_XMLOBJECT_CLONE_EX(NameIDType);
115             IMPL_STRING_ATTRIB(NameQualifier);
116             IMPL_STRING_ATTRIB(SPNameQualifier);
117             IMPL_STRING_ATTRIB(Format);
118             IMPL_STRING_ATTRIB(SPProvidedID);
119
120         protected:
121             void marshallAttributes(DOMElement* domElement) const {
122                 MARSHALL_STRING_ATTRIB(NameQualifier,NAMEQUALIFIER,nullptr);
123                 MARSHALL_STRING_ATTRIB(SPNameQualifier,SPNAMEQUALIFIER,nullptr);
124                 MARSHALL_STRING_ATTRIB(Format,FORMAT,nullptr);
125                 MARSHALL_STRING_ATTRIB(SPProvidedID,SPPROVIDEDID,nullptr);
126             }
127
128             void processAttribute(const DOMAttr* attribute) {
129                 PROC_STRING_ATTRIB(NameQualifier,NAMEQUALIFIER,nullptr);
130                 PROC_STRING_ATTRIB(SPNameQualifier,SPNAMEQUALIFIER,nullptr);
131                 PROC_STRING_ATTRIB(Format,FORMAT,nullptr);
132                 PROC_STRING_ATTRIB(SPProvidedID,SPPROVIDEDID,nullptr);
133                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
134             }
135         };
136
137         class SAML_DLLLOCAL NameIDImpl : public virtual NameID, public NameIDTypeImpl
138         {
139         public:
140             virtual ~NameIDImpl() {}
141
142             NameIDImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
143                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
144
145             NameIDImpl(const NameIDImpl& src) : AbstractXMLObject(src), NameIDTypeImpl(src) {
146             }
147
148             IMPL_XMLOBJECT_CLONE_EX(NameID);
149         };
150
151         class SAML_DLLLOCAL IssuerImpl : public virtual Issuer, public NameIDTypeImpl
152         {
153         public:
154             virtual ~IssuerImpl() {}
155
156             IssuerImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
157                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
158
159             IssuerImpl(const IssuerImpl& src) : AbstractXMLObject(src), NameIDTypeImpl(src) {
160             }
161
162             IMPL_XMLOBJECT_CLONE_EX(Issuer);
163         };
164
165         //TODO unit test for this
166         //  - need to test encryption/decryption too, or already done in xmltooling ?
167         class SAML_DLLLOCAL EncryptedElementTypeImpl : public virtual EncryptedElementType,
168             public AbstractComplexElement,
169             public AbstractDOMCachingXMLObject,
170             public AbstractXMLObjectMarshaller,
171             public AbstractXMLObjectUnmarshaller
172         {
173             void init() {
174                 m_EncryptedData=nullptr;
175                 m_children.push_back(nullptr);
176                 m_pos_EncryptedData=m_children.begin();
177             }
178
179         protected:
180             EncryptedElementTypeImpl() {
181                 init();
182             }
183
184         public:
185             virtual ~EncryptedElementTypeImpl() {}
186
187             EncryptedElementTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
188                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
189                 init();
190             }
191
192             EncryptedElementTypeImpl(const EncryptedElementTypeImpl& src)
193                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
194                 init();
195             }
196
197             void _clone(const EncryptedElementTypeImpl& src) {
198                 if (src.getEncryptedData())
199                     setEncryptedData(src.getEncryptedData()->cloneEncryptedData());
200                 VectorOf(EncryptedKey) v=getEncryptedKeys();
201                 for (vector<EncryptedKey*>::const_iterator i=src.m_EncryptedKeys.begin(); i!=src.m_EncryptedKeys.end(); i++) {
202                     if (*i) {
203                         v.push_back((*i)->cloneEncryptedKey());
204                     }
205                 }
206             }
207
208             IMPL_XMLOBJECT_CLONE_EX(EncryptedElementType);
209             IMPL_TYPED_FOREIGN_CHILD(EncryptedData,xmlencryption);
210             IMPL_TYPED_FOREIGN_CHILDREN(EncryptedKey,xmlencryption,m_children.end());
211
212         protected:
213             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
214                 PROC_TYPED_FOREIGN_CHILD(EncryptedData,xmlencryption,XMLENC_NS,false);
215                 PROC_TYPED_FOREIGN_CHILDREN(EncryptedKey,xmlencryption,XMLENC_NS,false);
216                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
217             }
218         };
219
220         class SAML_DLLLOCAL EncryptedIDImpl : public virtual EncryptedID, public EncryptedElementTypeImpl
221         {
222         public:
223             virtual ~EncryptedIDImpl() {}
224
225             EncryptedIDImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
226                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
227
228             EncryptedIDImpl(const EncryptedIDImpl& src) : AbstractXMLObject(src), EncryptedElementTypeImpl(src) {
229             }
230
231             IMPL_XMLOBJECT_CLONE_EX(EncryptedID);
232         };
233
234         class SAML_DLLLOCAL ConditionImpl : public virtual Condition, public AnyElementImpl
235         {
236         public:
237             virtual ~ConditionImpl() {}
238
239             ConditionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
240                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
241             }
242
243             ConditionImpl(const ConditionImpl& src) : AbstractXMLObject(src), AnyElementImpl(src) {}
244
245             IMPL_XMLOBJECT_CLONE(Condition);
246         };
247
248         class SAML_DLLLOCAL AudienceRestrictionImpl : public virtual AudienceRestriction,
249             public AbstractComplexElement,
250             public AbstractDOMCachingXMLObject,
251             public AbstractXMLObjectMarshaller,
252             public AbstractXMLObjectUnmarshaller
253         {
254         public:
255             virtual ~AudienceRestrictionImpl() {}
256
257             AudienceRestrictionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
258                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
259             }
260
261             AudienceRestrictionImpl(const AudienceRestrictionImpl& src)
262                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
263                 VectorOf(Audience) v=getAudiences();
264                 for (vector<Audience*>::const_iterator i=src.m_Audiences.begin(); i!=src.m_Audiences.end(); i++) {
265                     if (*i) {
266                         v.push_back((*i)->cloneAudience());
267                     }
268                 }
269             }
270
271             IMPL_XMLOBJECT_CLONE2(AudienceRestriction,Condition);
272             IMPL_TYPED_CHILDREN(Audience,m_children.end());
273
274         protected:
275             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
276                 PROC_TYPED_CHILDREN(Audience,SAML20_NS,false);
277                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
278             }
279         };
280
281         class SAML_DLLLOCAL OneTimeUseImpl : public virtual OneTimeUse,
282             public AbstractSimpleElement,
283             public AbstractDOMCachingXMLObject,
284             public AbstractXMLObjectMarshaller,
285             public AbstractXMLObjectUnmarshaller
286         {
287         public:
288             virtual ~OneTimeUseImpl() {}
289
290             OneTimeUseImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
291                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
292             }
293
294             OneTimeUseImpl(const OneTimeUseImpl& src)
295                 : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
296             }
297
298             IMPL_XMLOBJECT_CLONE2(OneTimeUse,Condition);
299         };
300
301         class SAML_DLLLOCAL ProxyRestrictionImpl : public virtual ProxyRestriction,
302             public AbstractComplexElement,
303             public AbstractDOMCachingXMLObject,
304             public AbstractXMLObjectMarshaller,
305             public AbstractXMLObjectUnmarshaller
306         {
307         public:
308             virtual ~ProxyRestrictionImpl() {
309                 XMLString::release(&m_Count);
310             }
311
312             ProxyRestrictionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
313                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
314                 m_Count=nullptr;
315             }
316
317             ProxyRestrictionImpl(const ProxyRestrictionImpl& src)
318                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
319                 setCount(src.m_Count);
320                 VectorOf(Audience) v=getAudiences();
321                 for (vector<Audience*>::const_iterator i=src.m_Audiences.begin(); i!=src.m_Audiences.end(); i++) {
322                     if (*i) {
323                         v.push_back((*i)->cloneAudience());
324                     }
325                 }
326             }
327
328             IMPL_XMLOBJECT_CLONE2(ProxyRestriction,Condition);
329             IMPL_TYPED_CHILDREN(Audience,m_children.end());
330             IMPL_INTEGER_ATTRIB(Count);
331
332         protected:
333             void marshallAttributes(DOMElement* domElement) const {
334                 MARSHALL_INTEGER_ATTRIB(Count,COUNT,nullptr);
335             }
336
337             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
338                 PROC_TYPED_CHILDREN(Audience,SAML20_NS,false);
339                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
340             }
341
342             void processAttribute(const DOMAttr* attribute) {
343                 PROC_INTEGER_ATTRIB(Count,COUNT,nullptr);
344                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
345             }
346         };
347
348         class SAML_DLLLOCAL DelegateImpl : public virtual Delegate,
349             public AbstractComplexElement,
350             public AbstractDOMCachingXMLObject,
351             public AbstractXMLObjectMarshaller,
352             public AbstractXMLObjectUnmarshaller
353         {
354             void init() {
355                 m_ConfirmationMethod=nullptr;
356                 m_DelegationInstant=nullptr;
357                 m_BaseID=nullptr;
358                 m_NameID=nullptr;
359                 m_EncryptedID=nullptr;
360                 m_children.push_back(nullptr);
361                 m_children.push_back(nullptr);
362                 m_children.push_back(nullptr);
363                 m_pos_BaseID=m_children.begin();
364                 m_pos_NameID=m_pos_BaseID;
365                 ++m_pos_NameID;
366                 m_pos_EncryptedID=m_pos_NameID;
367                 ++m_pos_EncryptedID;
368             }
369         public:
370             virtual ~DelegateImpl() {
371                 XMLString::release(&m_ConfirmationMethod);
372                 delete m_DelegationInstant;
373             }
374
375             DelegateImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
376                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
377                 init();
378             }
379
380             DelegateImpl(const DelegateImpl& src)
381                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
382                 init();
383                 setConfirmationMethod(src.getConfirmationMethod());
384                 setDelegationInstant(src.getDelegationInstant());
385                 if (src.getBaseID())
386                     setBaseID(src.getBaseID()->cloneBaseID());
387                 if (src.getNameID())
388                     setNameID(src.getNameID()->cloneNameID());
389                 if (src.getEncryptedID())
390                     setEncryptedID(src.getEncryptedID()->cloneEncryptedID());
391             }
392
393             IMPL_XMLOBJECT_CLONE(Delegate);
394             IMPL_STRING_ATTRIB(ConfirmationMethod);
395             IMPL_DATETIME_ATTRIB(DelegationInstant,0);
396             IMPL_TYPED_CHILD(NameID);
397             IMPL_TYPED_CHILD(BaseID);
398             IMPL_TYPED_CHILD(EncryptedID);
399
400         protected:
401             void marshallAttributes(DOMElement* domElement) const {
402                 MARSHALL_STRING_ATTRIB(ConfirmationMethod,CONFIRMATIONMETHOD,nullptr);
403                 MARSHALL_DATETIME_ATTRIB(DelegationInstant,DELEGATIONINSTANT,nullptr);
404             }
405
406             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
407                 PROC_TYPED_CHILD(BaseID,SAML20_NS,false);
408                 PROC_TYPED_CHILD(NameID,SAML20_NS,false);
409                 PROC_TYPED_CHILD(EncryptedID,SAML20_NS,false);
410                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
411             }
412
413             void processAttribute(const DOMAttr* attribute) {
414                 PROC_STRING_ATTRIB(ConfirmationMethod,CONFIRMATIONMETHOD,nullptr);
415                 PROC_DATETIME_ATTRIB(DelegationInstant,DELEGATIONINSTANT,nullptr);
416                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
417             }
418         };
419
420         class SAML_DLLLOCAL DelegationRestrictionTypeImpl : public virtual DelegationRestrictionType,
421             public AbstractComplexElement,
422             public AbstractDOMCachingXMLObject,
423             public AbstractXMLObjectMarshaller,
424             public AbstractXMLObjectUnmarshaller
425         {
426         public:
427             virtual ~DelegationRestrictionTypeImpl() {}
428
429             DelegationRestrictionTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
430                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
431             }
432
433             DelegationRestrictionTypeImpl(const DelegationRestrictionTypeImpl& src)
434                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
435                 VectorOf(Delegate) v=getDelegates();
436                 for (vector<Delegate*>::const_iterator i=src.m_Delegates.begin(); i!=src.m_Delegates.end(); i++) {
437                     if (*i) {
438                         v.push_back((*i)->cloneDelegate());
439                     }
440                 }
441             }
442
443             IMPL_XMLOBJECT_CLONE2(DelegationRestrictionType,Condition);
444             IMPL_TYPED_CHILDREN(Delegate,m_children.end());
445
446         protected:
447             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
448                 PROC_TYPED_CHILDREN(Delegate,SAML20_DELEGATION_CONDITION_NS,false);
449                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
450             }
451         };
452
453         class SAML_DLLLOCAL ConditionsImpl : public virtual Conditions,
454             public AbstractComplexElement,
455             public AbstractDOMCachingXMLObject,
456             public AbstractXMLObjectMarshaller,
457             public AbstractXMLObjectUnmarshaller
458         {
459             void init() {
460                 m_NotBefore=m_NotOnOrAfter=nullptr;
461             }
462         public:
463             virtual ~ConditionsImpl() {
464                 delete m_NotBefore;
465                 delete m_NotOnOrAfter;
466             }
467
468             ConditionsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
469                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
470                 init();
471             }
472
473             ConditionsImpl(const ConditionsImpl& src)
474                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
475                 init();
476                 setNotBefore(src.getNotBefore());
477                 setNotOnOrAfter(src.getNotOnOrAfter());
478
479                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
480                     if (*i) {
481                         AudienceRestriction* arc=dynamic_cast<AudienceRestriction*>(*i);
482                         if (arc) {
483                             getAudienceRestrictions().push_back(arc->cloneAudienceRestriction());
484                             continue;
485                         }
486
487                         OneTimeUse* dncc=dynamic_cast<OneTimeUse*>(*i);
488                         if (dncc) {
489                             getOneTimeUses().push_back(dncc->cloneOneTimeUse());
490                             continue;
491                         }
492
493                         ProxyRestriction* prc=dynamic_cast<ProxyRestriction*>(*i);
494                         if (prc) {
495                             getProxyRestrictions().push_back(prc->cloneProxyRestriction());
496                             continue;
497                         }
498
499                         Condition* c=dynamic_cast<Condition*>(*i);
500                         if (c) {
501                             getConditions().push_back(c->cloneCondition());
502                             continue;
503                         }
504                     }
505                 }
506             }
507
508             IMPL_XMLOBJECT_CLONE(Conditions);
509             IMPL_DATETIME_ATTRIB(NotBefore,0);
510             IMPL_DATETIME_ATTRIB(NotOnOrAfter,SAMLTIME_MAX);
511             IMPL_TYPED_CHILDREN(AudienceRestriction, m_children.end());
512             IMPL_TYPED_CHILDREN(OneTimeUse,m_children.end());
513             IMPL_TYPED_CHILDREN(ProxyRestriction, m_children.end());
514             IMPL_TYPED_CHILDREN(Condition,m_children.end());
515
516         protected:
517             void marshallAttributes(DOMElement* domElement) const {
518                 MARSHALL_DATETIME_ATTRIB(NotBefore,NOTBEFORE,nullptr);
519                 MARSHALL_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,nullptr);
520             }
521
522             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
523                 PROC_TYPED_CHILDREN(AudienceRestriction,SAML20_NS,false);
524                 PROC_TYPED_CHILDREN(OneTimeUse,SAML20_NS,false);
525                 PROC_TYPED_CHILDREN(ProxyRestriction,SAML20_NS,false);
526                 PROC_TYPED_CHILDREN(Condition,SAML20_NS,false);
527                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
528             }
529
530             void processAttribute(const DOMAttr* attribute) {
531                 PROC_DATETIME_ATTRIB(NotBefore,NOTBEFORE,nullptr);
532                 PROC_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,nullptr);
533                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
534             }
535         };
536
537         class SAML_DLLLOCAL SubjectConfirmationDataTypeImpl : public virtual SubjectConfirmationDataType, public virtual AbstractXMLObject
538         {
539             void init() {
540                 m_NotBefore=m_NotOnOrAfter=nullptr;
541                 m_Recipient=m_InResponseTo=m_Address=nullptr;
542             }
543
544         protected:
545             SubjectConfirmationDataTypeImpl() {
546                 init();
547             }
548
549         public:
550             virtual ~SubjectConfirmationDataTypeImpl() {
551                 delete m_NotBefore;
552                 delete m_NotOnOrAfter;
553                 XMLString::release(&m_Recipient);
554                 XMLString::release(&m_InResponseTo);
555                 XMLString::release(&m_Address);
556             }
557
558             SubjectConfirmationDataTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
559                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
560                 init();
561             }
562
563             SubjectConfirmationDataTypeImpl(const SubjectConfirmationDataTypeImpl& src) : AbstractXMLObject(src) {
564                 init();
565             }
566
567             void _clone(const SubjectConfirmationDataTypeImpl& src) {
568                 setNotBefore(src.getNotBefore());
569                 setNotOnOrAfter(src.getNotOnOrAfter());
570                 setRecipient(src.getRecipient());
571                 setInResponseTo(src.getInResponseTo());
572                 setAddress(src.getAddress());
573             }
574
575             SubjectConfirmationDataType* cloneSubjectConfirmationDataType() const {
576                 return dynamic_cast<SubjectConfirmationDataType*>(clone());
577             }
578
579             IMPL_DATETIME_ATTRIB(NotBefore,0);
580             IMPL_DATETIME_ATTRIB(NotOnOrAfter,SAMLTIME_MAX);
581             IMPL_STRING_ATTRIB(Recipient);
582             IMPL_STRING_ATTRIB(InResponseTo);
583             IMPL_STRING_ATTRIB(Address);
584
585         protected:
586             void marshallAttributes(DOMElement* domElement) const {
587                 MARSHALL_DATETIME_ATTRIB(NotBefore,NOTBEFORE,nullptr);
588                 MARSHALL_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,nullptr);
589                 MARSHALL_STRING_ATTRIB(Recipient,RECIPIENT,nullptr);
590                 MARSHALL_STRING_ATTRIB(InResponseTo,INRESPONSETO,nullptr);
591                 MARSHALL_STRING_ATTRIB(Address,ADDRESS,nullptr);
592             }
593
594             void processAttribute(const DOMAttr* attribute) {
595                 PROC_DATETIME_ATTRIB(NotBefore,NOTBEFORE,nullptr);
596                 PROC_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,nullptr);
597                 PROC_STRING_ATTRIB(Recipient,RECIPIENT,nullptr);
598                 PROC_STRING_ATTRIB(InResponseTo,INRESPONSETO,nullptr);
599                 PROC_STRING_ATTRIB(Address,ADDRESS,nullptr);
600             }
601         };
602
603         class SAML_DLLLOCAL SubjectConfirmationDataImpl : public SubjectConfirmationData,
604             public SubjectConfirmationDataTypeImpl, public AnyElementImpl
605         {
606         public:
607             virtual ~SubjectConfirmationDataImpl() {}
608
609             SubjectConfirmationDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
610                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
611             }
612
613             SubjectConfirmationDataImpl(const SubjectConfirmationDataImpl& src)
614                     : AbstractXMLObject(src), SubjectConfirmationDataTypeImpl(src), AnyElementImpl(src) {
615             }
616
617             void _clone(const SubjectConfirmationDataImpl& src) {
618                 SubjectConfirmationDataTypeImpl::_clone(src);
619                 AnyElementImpl::_clone(src);
620             }
621
622             IMPL_XMLOBJECT_CLONE_EX(SubjectConfirmationData);
623
624             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
625                 if (!qualifiedName.hasNamespaceURI()) {
626                     if (XMLString::equals(qualifiedName.getLocalPart(),NOTBEFORE_ATTRIB_NAME)) {
627                         setNotBefore(value);
628                         return;
629                     }
630                     else if (XMLString::equals(qualifiedName.getLocalPart(),NOTONORAFTER_ATTRIB_NAME)) {
631                         setNotOnOrAfter(value);
632                         return;
633                     }
634                     else if (XMLString::equals(qualifiedName.getLocalPart(),RECIPIENT_ATTRIB_NAME)) {
635                         setRecipient(value);
636                         return;
637                     }
638                     else if (XMLString::equals(qualifiedName.getLocalPart(),INRESPONSETO_ATTRIB_NAME)) {
639                         setInResponseTo(value);
640                         return;
641                     }
642                     else if (XMLString::equals(qualifiedName.getLocalPart(),ADDRESS_ATTRIB_NAME)) {
643                         setAddress(value);
644                         return;
645                     }
646                 }
647                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
648             }
649
650         protected:
651             void marshallAttributes(DOMElement* domElement) const {
652                 SubjectConfirmationDataTypeImpl::marshallAttributes(domElement);
653                 AnyElementImpl::marshallAttributes(domElement);
654             }
655
656             void processAttribute(const DOMAttr* attribute) {
657                 PROC_DATETIME_ATTRIB(NotBefore,NOTBEFORE,nullptr);
658                 PROC_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,nullptr);
659                 PROC_STRING_ATTRIB(Recipient,RECIPIENT,nullptr);
660                 PROC_STRING_ATTRIB(InResponseTo,INRESPONSETO,nullptr);
661                 PROC_STRING_ATTRIB(Address,ADDRESS,nullptr);
662                 AnyElementImpl::processAttribute(attribute);
663             }
664         };
665
666         class SAML_DLLLOCAL KeyInfoConfirmationDataTypeImpl : public virtual KeyInfoConfirmationDataType,
667                 public SubjectConfirmationDataTypeImpl,
668                 public AbstractComplexElement,
669                 public AbstractAttributeExtensibleXMLObject,
670                 public AbstractDOMCachingXMLObject,
671                 public AbstractXMLObjectMarshaller,
672                 public AbstractXMLObjectUnmarshaller
673         {
674         public:
675             virtual ~KeyInfoConfirmationDataTypeImpl() {}
676
677             KeyInfoConfirmationDataTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
678                     : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
679             }
680
681             KeyInfoConfirmationDataTypeImpl(const KeyInfoConfirmationDataTypeImpl& src)
682                     : AbstractXMLObject(src), SubjectConfirmationDataTypeImpl(src), AbstractComplexElement(src),
683                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
684             }
685
686             void _clone(const KeyInfoConfirmationDataTypeImpl& src) {
687                 SubjectConfirmationDataTypeImpl::_clone(src);
688                 VectorOf(KeyInfo) v=getKeyInfos();
689                 for (vector<KeyInfo*>::const_iterator i=src.m_KeyInfos.begin(); i!=src.m_KeyInfos.end(); ++i)
690                     v.push_back((*i)->cloneKeyInfo());
691             }
692
693             IMPL_XMLOBJECT_CLONE_EX(KeyInfoConfirmationDataType);
694             IMPL_TYPED_CHILDREN(KeyInfo,m_children.end());
695
696         public:
697             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
698                 if (!qualifiedName.hasNamespaceURI()) {
699                     if (XMLString::equals(qualifiedName.getLocalPart(),NOTBEFORE_ATTRIB_NAME)) {
700                         setNotBefore(value);
701                         return;
702                     }
703                     else if (XMLString::equals(qualifiedName.getLocalPart(),NOTONORAFTER_ATTRIB_NAME)) {
704                         setNotOnOrAfter(value);
705                         return;
706                     }
707                     else if (XMLString::equals(qualifiedName.getLocalPart(),RECIPIENT_ATTRIB_NAME)) {
708                         setRecipient(value);
709                         return;
710                     }
711                     else if (XMLString::equals(qualifiedName.getLocalPart(),INRESPONSETO_ATTRIB_NAME)) {
712                         setInResponseTo(value);
713                         return;
714                     }
715                     else if (XMLString::equals(qualifiedName.getLocalPart(),ADDRESS_ATTRIB_NAME)) {
716                         setAddress(value);
717                         return;
718                     }
719                 }
720                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
721             }
722
723         protected:
724             void marshallAttributes(DOMElement* domElement) const {
725                 SubjectConfirmationDataTypeImpl::marshallAttributes(domElement);
726                 marshallExtensionAttributes(domElement);
727             }
728
729             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
730                 PROC_TYPED_CHILDREN(KeyInfo,XMLSIG_NS,false);
731                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
732             }
733
734             void processAttribute(const DOMAttr* attribute) {
735                 unmarshallExtensionAttribute(attribute);
736             }
737         };
738
739         class SAML_DLLLOCAL SubjectConfirmationImpl : public virtual SubjectConfirmation,
740             public AbstractComplexElement,
741             public AbstractDOMCachingXMLObject,
742             public AbstractXMLObjectMarshaller,
743             public AbstractXMLObjectUnmarshaller
744         {
745             void init() {
746                 m_Method=nullptr;
747                 m_BaseID=nullptr;
748                 m_NameID=nullptr;
749                 m_EncryptedID=nullptr;
750                 m_SubjectConfirmationData=nullptr;
751                 m_children.push_back(nullptr);
752                 m_children.push_back(nullptr);
753                 m_children.push_back(nullptr);
754                 m_children.push_back(nullptr);
755                 m_pos_BaseID=m_children.begin();
756                 m_pos_NameID=m_pos_BaseID;
757                 ++m_pos_NameID;
758                 m_pos_EncryptedID=m_pos_NameID;
759                 ++m_pos_EncryptedID;
760                 m_pos_SubjectConfirmationData=m_pos_EncryptedID;
761                 ++m_pos_SubjectConfirmationData;
762             }
763         public:
764             virtual ~SubjectConfirmationImpl() {
765                 XMLString::release(&m_Method);
766             }
767
768             SubjectConfirmationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
769                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
770                 init();
771             }
772
773             SubjectConfirmationImpl(const SubjectConfirmationImpl& src)
774                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
775                 init();
776                 setMethod(src.getMethod());
777                 if (src.getBaseID())
778                     setBaseID(src.getBaseID()->cloneBaseID());
779                 if (src.getNameID())
780                     setNameID(src.getNameID()->cloneNameID());
781                 if (src.getEncryptedID())
782                     setEncryptedID(src.getEncryptedID()->cloneEncryptedID());
783                 if (src.getSubjectConfirmationData())
784                     setSubjectConfirmationData(src.getSubjectConfirmationData()->clone());
785             }
786
787             IMPL_XMLOBJECT_CLONE(SubjectConfirmation);
788             IMPL_STRING_ATTRIB(Method);
789             IMPL_TYPED_CHILD(BaseID);
790             IMPL_TYPED_CHILD(NameID);
791             IMPL_TYPED_CHILD(EncryptedID);
792             IMPL_XMLOBJECT_CHILD(SubjectConfirmationData);
793
794         protected:
795             void marshallAttributes(DOMElement* domElement) const {
796                 MARSHALL_STRING_ATTRIB(Method,METHOD,nullptr);
797             }
798
799             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
800                 PROC_TYPED_CHILD(BaseID,SAML20_NS,false);
801                 PROC_TYPED_CHILD(NameID,SAML20_NS,false);
802                 PROC_TYPED_CHILD(EncryptedID,SAML20_NS,false);
803                 PROC_XMLOBJECT_CHILD(SubjectConfirmationData,SAML20_NS);
804                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
805             }
806
807             void processAttribute(const DOMAttr* attribute) {
808                 PROC_STRING_ATTRIB(Method,METHOD,nullptr);
809                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
810             }
811         };
812
813         class SAML_DLLLOCAL SubjectImpl : public virtual Subject,
814             public AbstractComplexElement,
815             public AbstractDOMCachingXMLObject,
816             public AbstractXMLObjectMarshaller,
817             public AbstractXMLObjectUnmarshaller
818         {
819             void init() {
820                 m_BaseID=nullptr;
821                 m_NameID=nullptr;
822                 m_EncryptedID=nullptr;
823                 m_children.push_back(nullptr);
824                 m_children.push_back(nullptr);
825                 m_children.push_back(nullptr);
826                 m_pos_BaseID=m_children.begin();
827                 m_pos_NameID=m_pos_BaseID;
828                 ++m_pos_NameID;
829                 m_pos_EncryptedID=m_pos_NameID;
830                 ++m_pos_EncryptedID;
831             }
832         public:
833             virtual ~SubjectImpl() {}
834
835             SubjectImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
836                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
837                 init();
838             }
839
840             SubjectImpl(const SubjectImpl& src)
841                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
842                 init();
843                 if (src.getBaseID())
844                     setBaseID(src.getBaseID()->cloneBaseID());
845                 if (src.getNameID())
846                     setNameID(src.getNameID()->cloneNameID());
847                 if (src.getEncryptedID())
848                     setEncryptedID(src.getEncryptedID()->cloneEncryptedID());
849                 VectorOf(SubjectConfirmation) v=getSubjectConfirmations();
850                 for (vector<SubjectConfirmation*>::const_iterator i=src.m_SubjectConfirmations.begin(); i!=src.m_SubjectConfirmations.end(); i++) {
851                     if (*i) {
852                         v.push_back((*i)->cloneSubjectConfirmation());
853                     }
854                 }
855             }
856
857             IMPL_XMLOBJECT_CLONE(Subject);
858             IMPL_TYPED_CHILD(NameID);
859             IMPL_TYPED_CHILD(BaseID);
860             IMPL_TYPED_CHILD(EncryptedID);
861             IMPL_TYPED_CHILDREN(SubjectConfirmation,m_children.end());
862
863         protected:
864             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
865                 PROC_TYPED_CHILD(BaseID,SAML20_NS,false);
866                 PROC_TYPED_CHILD(NameID,SAML20_NS,false);
867                 PROC_TYPED_CHILD(EncryptedID,SAML20_NS,false);
868                 PROC_TYPED_CHILDREN(SubjectConfirmation,SAML20_NS,false);
869                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
870             }
871         };
872
873         class SAML_DLLLOCAL SubjectLocalityImpl : public virtual SubjectLocality,
874             public AbstractSimpleElement,
875             public AbstractDOMCachingXMLObject,
876             public AbstractXMLObjectMarshaller,
877             public AbstractXMLObjectUnmarshaller
878         {
879             void init() {
880                 m_Address=m_DNSName=nullptr;
881             }
882         public:
883             virtual ~SubjectLocalityImpl() {
884                 XMLString::release(&m_Address);
885                 XMLString::release(&m_DNSName);
886             }
887
888             SubjectLocalityImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
889                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
890                 init();
891             }
892
893             SubjectLocalityImpl(const SubjectLocalityImpl& src)
894                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
895                 init();
896                 setAddress(src.getAddress());
897                 setDNSName(src.getDNSName());
898             }
899
900             IMPL_XMLOBJECT_CLONE(SubjectLocality);
901             IMPL_STRING_ATTRIB(Address);
902             IMPL_STRING_ATTRIB(DNSName);
903
904         protected:
905             void marshallAttributes(DOMElement* domElement) const {
906                 MARSHALL_STRING_ATTRIB(Address,ADDRESS,nullptr);
907                 MARSHALL_STRING_ATTRIB(DNSName,DNSNAME,nullptr);
908             }
909
910             void processAttribute(const DOMAttr* attribute) {
911                 PROC_STRING_ATTRIB(Address,ADDRESS,nullptr);
912                 PROC_STRING_ATTRIB(DNSName,DNSNAME,nullptr);
913                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
914             }
915         };
916
917         class SAML_DLLLOCAL StatementImpl : public virtual Statement, public AnyElementImpl
918         {
919         public:
920             virtual ~StatementImpl() {}
921
922             StatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
923                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
924             }
925
926             StatementImpl(const StatementImpl& src) : AbstractXMLObject(src), AnyElementImpl(src) {}
927
928             IMPL_XMLOBJECT_CLONE_EX(Statement);
929         };
930
931         //TODO need unit test for this
932         class SAML_DLLLOCAL AuthnContextDeclImpl : public virtual AuthnContextDecl, public AnyElementImpl
933         {
934         public:
935             virtual ~AuthnContextDeclImpl() {}
936
937             AuthnContextDeclImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
938                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
939             }
940
941             AuthnContextDeclImpl(const AuthnContextDeclImpl& src) : AbstractXMLObject(src), AnyElementImpl(src) {
942             }
943
944             IMPL_XMLOBJECT_CLONE_EX(AuthnContextDecl);
945         };
946
947         class SAML_DLLLOCAL AuthnContextImpl : public virtual AuthnContext,
948             public AbstractComplexElement,
949             public AbstractDOMCachingXMLObject,
950             public AbstractXMLObjectMarshaller,
951             public AbstractXMLObjectUnmarshaller
952         {
953             void init() {
954                 m_AuthnContextClassRef=nullptr;
955                 m_AuthnContextDecl=nullptr;
956                 m_AuthnContextDeclRef=nullptr;
957                 m_children.push_back(nullptr);
958                 m_children.push_back(nullptr);
959                 m_children.push_back(nullptr);
960                 m_pos_AuthnContextClassRef=m_children.begin();
961                 m_pos_AuthnContextDecl=m_pos_AuthnContextClassRef;
962                 ++m_pos_AuthnContextDecl;
963                 m_pos_AuthnContextDeclRef=m_pos_AuthnContextDecl;
964                 ++m_pos_AuthnContextDeclRef;
965             }
966         public:
967             virtual ~AuthnContextImpl() {}
968
969             AuthnContextImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
970                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
971                 init();
972             }
973
974             AuthnContextImpl(const AuthnContextImpl& src)
975                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
976                 init();
977                 if (src.getAuthnContextClassRef())
978                     setAuthnContextClassRef(src.getAuthnContextClassRef()->cloneAuthnContextClassRef());
979                 if (src.getAuthnContextDecl())
980                     setAuthnContextDecl(src.getAuthnContextDecl()->clone());
981                 if (src.getAuthnContextDeclRef())
982                     setAuthnContextDeclRef(src.getAuthnContextDeclRef()->cloneAuthnContextDeclRef());
983                 VectorOf(AuthenticatingAuthority) v=getAuthenticatingAuthoritys();
984                 for (vector<AuthenticatingAuthority*>::const_iterator i=src.m_AuthenticatingAuthoritys.begin(); i!=src.m_AuthenticatingAuthoritys.end(); i++) {
985                     if (*i) {
986                         v.push_back((*i)->cloneAuthenticatingAuthority());
987                     }
988                 }
989             }
990
991             IMPL_XMLOBJECT_CLONE(AuthnContext);
992             IMPL_TYPED_CHILD(AuthnContextClassRef);
993             IMPL_XMLOBJECT_CHILD(AuthnContextDecl);
994             IMPL_TYPED_CHILD(AuthnContextDeclRef);
995             IMPL_TYPED_CHILDREN(AuthenticatingAuthority,m_children.end());
996
997         protected:
998             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
999                 PROC_TYPED_CHILD(AuthnContextClassRef,SAML20_NS,false);
1000                 PROC_XMLOBJECT_CHILD(AuthnContextDecl,SAML20_NS);
1001                 PROC_TYPED_CHILD(AuthnContextDeclRef,SAML20_NS,false);
1002                 PROC_TYPED_CHILDREN(AuthenticatingAuthority,SAML20_NS,false);
1003                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1004             }
1005         };
1006
1007         class SAML_DLLLOCAL AuthnStatementImpl : public virtual AuthnStatement,
1008             public AbstractComplexElement,
1009             public AbstractDOMCachingXMLObject,
1010             public AbstractXMLObjectMarshaller,
1011             public AbstractXMLObjectUnmarshaller
1012         {
1013             void init() {
1014                 m_AuthnInstant=nullptr;
1015                 m_SessionIndex=nullptr;
1016                 m_SessionNotOnOrAfter=nullptr;
1017                 m_SubjectLocality=nullptr;
1018                 m_AuthnContext=nullptr;
1019                 m_children.push_back(nullptr);
1020                 m_children.push_back(nullptr);
1021                 m_pos_SubjectLocality=m_children.begin();
1022                 m_pos_AuthnContext=m_pos_SubjectLocality;
1023                 ++m_pos_AuthnContext;
1024             }
1025         public:
1026             virtual ~AuthnStatementImpl() {
1027                 delete m_AuthnInstant;
1028                 XMLString::release(&m_SessionIndex);
1029                 delete m_SessionNotOnOrAfter;
1030             }
1031
1032             AuthnStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1033                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1034                 init();
1035             }
1036
1037             AuthnStatementImpl(const AuthnStatementImpl& src)
1038                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
1039                 init();
1040                 setAuthnInstant(src.getAuthnInstant());
1041                 setSessionIndex(src.getSessionIndex());
1042                 setSessionNotOnOrAfter(src.getSessionNotOnOrAfter());
1043                 if (src.getSubjectLocality())
1044                     setSubjectLocality(src.getSubjectLocality()->cloneSubjectLocality());
1045                 if (src.getAuthnContext())
1046                     setAuthnContext(src.getAuthnContext()->cloneAuthnContext());
1047             }
1048
1049             IMPL_XMLOBJECT_CLONE2(AuthnStatement,Statement);
1050             IMPL_DATETIME_ATTRIB(AuthnInstant,0);
1051             IMPL_STRING_ATTRIB(SessionIndex);
1052             IMPL_DATETIME_ATTRIB(SessionNotOnOrAfter,SAMLTIME_MAX);
1053             IMPL_TYPED_CHILD(SubjectLocality);
1054             IMPL_TYPED_CHILD(AuthnContext);
1055
1056         protected:
1057             void marshallAttributes(DOMElement* domElement) const {
1058                 MARSHALL_DATETIME_ATTRIB(AuthnInstant,AUTHNINSTANT,nullptr);
1059                 MARSHALL_STRING_ATTRIB(SessionIndex,SESSIONINDEX,nullptr);
1060                 MARSHALL_DATETIME_ATTRIB(SessionNotOnOrAfter,SESSIONNOTONORAFTER,nullptr);
1061             }
1062
1063             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1064                 PROC_TYPED_CHILD(SubjectLocality,SAML20_NS,false);
1065                 PROC_TYPED_CHILD(AuthnContext,SAML20_NS,false);
1066                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1067             }
1068
1069             void processAttribute(const DOMAttr* attribute) {
1070                 PROC_DATETIME_ATTRIB(AuthnInstant,AUTHNINSTANT,nullptr);
1071                 PROC_STRING_ATTRIB(SessionIndex,SESSIONINDEX,nullptr);
1072                 PROC_DATETIME_ATTRIB(SessionNotOnOrAfter,SESSIONNOTONORAFTER,nullptr);
1073                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
1074             }
1075         };
1076
1077         class SAML_DLLLOCAL ActionImpl : public virtual Action,
1078             public AbstractSimpleElement,
1079             public AbstractDOMCachingXMLObject,
1080             public AbstractXMLObjectMarshaller,
1081             public AbstractXMLObjectUnmarshaller
1082         {
1083         public:
1084             virtual ~ActionImpl() {
1085                 XMLString::release(&m_Namespace);
1086             }
1087
1088             ActionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1089                     : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_Namespace(nullptr) {
1090             }
1091
1092             ActionImpl(const ActionImpl& src)
1093                     : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
1094                 setNamespace(src.getNamespace());
1095             }
1096
1097             IMPL_XMLOBJECT_CLONE(Action);
1098             IMPL_STRING_ATTRIB(Namespace);
1099
1100         protected:
1101             void marshallAttributes(DOMElement* domElement) const {
1102                 MARSHALL_STRING_ATTRIB(Namespace,NAMESPACE,nullptr);
1103             }
1104
1105             void processAttribute(const DOMAttr* attribute) {
1106                 PROC_STRING_ATTRIB(Namespace,NAMESPACE,nullptr);
1107                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
1108             }
1109         };
1110
1111         class SAML_DLLLOCAL EvidenceImpl : public virtual Evidence,
1112             public AbstractComplexElement,
1113             public AbstractDOMCachingXMLObject,
1114             public AbstractXMLObjectMarshaller,
1115             public AbstractXMLObjectUnmarshaller
1116         {
1117         public:
1118             virtual ~EvidenceImpl() {}
1119
1120             EvidenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1121                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1122             }
1123
1124             EvidenceImpl(const EvidenceImpl& src)
1125                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
1126                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
1127                     if (*i) {
1128                         AssertionIDRef* ref=dynamic_cast<AssertionIDRef*>(*i);
1129                         if (ref) {
1130                             getAssertionIDRefs().push_back(ref->cloneAssertionIDRef());
1131                             continue;
1132                         }
1133
1134                         AssertionURIRef* uri=dynamic_cast<AssertionURIRef*>(*i);
1135                         if (uri) {
1136                             getAssertionURIRefs().push_back(uri->cloneAssertionURIRef());
1137                             continue;
1138                         }
1139
1140                         Assertion* assertion=dynamic_cast<Assertion*>(*i);
1141                         if (assertion) {
1142                             getAssertions().push_back(assertion->cloneAssertion());
1143                             continue;
1144                         }
1145
1146                         EncryptedAssertion* enc=dynamic_cast<EncryptedAssertion*>(*i);
1147                         if (enc) {
1148                             getEncryptedAssertions().push_back(enc->cloneEncryptedAssertion());
1149                             continue;
1150                         }
1151                     }
1152                 }
1153             }
1154
1155             IMPL_XMLOBJECT_CLONE(Evidence);
1156             IMPL_TYPED_CHILDREN(AssertionIDRef,m_children.end());
1157             IMPL_TYPED_CHILDREN(AssertionURIRef,m_children.end());
1158             IMPL_TYPED_CHILDREN(Assertion,m_children.end());
1159             IMPL_TYPED_CHILDREN(EncryptedAssertion,m_children.end());
1160
1161         protected:
1162             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1163                 PROC_TYPED_CHILDREN(AssertionIDRef,SAML20_NS,false);
1164                 PROC_TYPED_CHILDREN(AssertionURIRef,SAML20_NS,false);
1165                 PROC_TYPED_CHILDREN(Assertion,SAML20_NS,false);
1166                 PROC_TYPED_CHILDREN(EncryptedAssertion,SAML20_NS,false);
1167                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1168             }
1169         };
1170
1171         class SAML_DLLLOCAL AuthzDecisionStatementImpl : public virtual AuthzDecisionStatement,
1172             public AbstractComplexElement,
1173             public AbstractDOMCachingXMLObject,
1174             public AbstractXMLObjectMarshaller,
1175             public AbstractXMLObjectUnmarshaller
1176         {
1177             void init() {
1178                 m_Resource=nullptr;
1179                 m_Decision=nullptr;
1180                 m_Evidence=nullptr;
1181                 m_children.push_back(nullptr);
1182                 m_pos_Evidence=m_children.begin();
1183             }
1184         public:
1185             virtual ~AuthzDecisionStatementImpl() {
1186                 XMLString::release(&m_Resource);
1187                 XMLString::release(&m_Decision);
1188             }
1189
1190             AuthzDecisionStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1191                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1192                 init();
1193             }
1194
1195             AuthzDecisionStatementImpl(const AuthzDecisionStatementImpl& src)
1196                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
1197                 init();
1198                 setResource(src.getResource());
1199                 setDecision(src.getDecision());
1200                 if (src.getEvidence())
1201                     setEvidence(src.getEvidence()->cloneEvidence());
1202                 VectorOf(Action) v=getActions();
1203                 for (vector<Action*>::const_iterator i=src.m_Actions.begin(); i!=src.m_Actions.end(); i++) {
1204                     if (*i) {
1205                         v.push_back((*i)->cloneAction());
1206                     }
1207                 }
1208             }
1209
1210             IMPL_XMLOBJECT_CLONE2(AuthzDecisionStatement,Statement);
1211             IMPL_STRING_ATTRIB(Resource);
1212             IMPL_STRING_ATTRIB(Decision);
1213             IMPL_TYPED_CHILD(Evidence);
1214             IMPL_TYPED_CHILDREN(Action, m_pos_Evidence);
1215
1216         protected:
1217             void marshallAttributes(DOMElement* domElement) const {
1218                 MARSHALL_STRING_ATTRIB(Resource,RESOURCE,nullptr);
1219                 MARSHALL_STRING_ATTRIB(Decision,DECISION,nullptr);
1220             }
1221
1222             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1223                 PROC_TYPED_CHILD(Evidence,SAML20_NS,false);
1224                 PROC_TYPED_CHILDREN(Action,SAML20_NS,false);
1225                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1226             }
1227
1228             void processAttribute(const DOMAttr* attribute) {
1229                 PROC_STRING_ATTRIB(Resource,RESOURCE,nullptr);
1230                 PROC_STRING_ATTRIB(Decision,DECISION,nullptr);
1231                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
1232             }
1233         };
1234
1235         class SAML_DLLLOCAL AttributeValueImpl : public virtual AttributeValue, public AnyElementImpl
1236         {
1237         public:
1238             virtual ~AttributeValueImpl() {}
1239
1240             AttributeValueImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1241                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1242             }
1243
1244             AttributeValueImpl(const AttributeValueImpl& src) : AbstractXMLObject(src), AnyElementImpl(src) {
1245             }
1246
1247             IMPL_XMLOBJECT_CLONE_EX(AttributeValue);
1248         };
1249
1250
1251         class SAML_DLLLOCAL AttributeImpl : public virtual Attribute,
1252             public AbstractComplexElement,
1253             public AbstractAttributeExtensibleXMLObject,
1254             public AbstractDOMCachingXMLObject,
1255             public AbstractXMLObjectMarshaller,
1256             public AbstractXMLObjectUnmarshaller
1257         {
1258             void init() {
1259                 m_Name=m_NameFormat=m_FriendlyName=nullptr;
1260             }
1261         public:
1262             virtual ~AttributeImpl() {
1263                 XMLString::release(&m_Name);
1264                 XMLString::release(&m_NameFormat);
1265                 XMLString::release(&m_FriendlyName);
1266             }
1267
1268             AttributeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1269                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1270                 init();
1271             }
1272
1273             AttributeImpl(const AttributeImpl& src)
1274                     : AbstractXMLObject(src), AbstractComplexElement(src),
1275                         AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
1276                 init();
1277                 setName(src.getName());
1278                 setNameFormat(src.getNameFormat());
1279                 setFriendlyName(src.getFriendlyName());
1280                 VectorOf(XMLObject) v=getAttributeValues();
1281                 for (vector<XMLObject*>::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) {
1282                     if (*i) {
1283                         v.push_back((*i)->clone());
1284                     }
1285                 }
1286             }
1287
1288             IMPL_XMLOBJECT_CLONE(Attribute);
1289             IMPL_STRING_ATTRIB(Name);
1290             IMPL_STRING_ATTRIB(NameFormat);
1291             IMPL_STRING_ATTRIB(FriendlyName);
1292             IMPL_XMLOBJECT_CHILDREN(AttributeValue,m_children.end());
1293
1294             void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1295                 if (!qualifiedName.hasNamespaceURI()) {
1296                     if (XMLString::equals(qualifiedName.getLocalPart(),NAME_ATTRIB_NAME)) {
1297                         setName(value);
1298                         return;
1299                     }
1300                     else if (XMLString::equals(qualifiedName.getLocalPart(),NAMEFORMAT_ATTRIB_NAME)) {
1301                         setNameFormat(value);
1302                         return;
1303                     }
1304                     else if (XMLString::equals(qualifiedName.getLocalPart(),FRIENDLYNAME_ATTRIB_NAME)) {
1305                         setFriendlyName(value);
1306                         return;
1307                     }
1308                 }
1309                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
1310             }
1311
1312         protected:
1313             void marshallAttributes(DOMElement* domElement) const {
1314                 MARSHALL_STRING_ATTRIB(Name,NAME,nullptr);
1315                 MARSHALL_STRING_ATTRIB(NameFormat,NAMEFORMAT,nullptr);
1316                 MARSHALL_STRING_ATTRIB(FriendlyName,FRIENDLYNAME,nullptr);
1317                 marshallExtensionAttributes(domElement);
1318             }
1319
1320             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1321                 getAttributeValues().push_back(childXMLObject);
1322             }
1323
1324             void processAttribute(const DOMAttr* attribute) {
1325                 unmarshallExtensionAttribute(attribute);
1326             }
1327         };
1328
1329         //TODO unit test for this
1330         class SAML_DLLLOCAL EncryptedAttributeImpl : public virtual EncryptedAttribute, public EncryptedElementTypeImpl
1331         {
1332         public:
1333             virtual ~EncryptedAttributeImpl() {}
1334
1335             EncryptedAttributeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1336                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1337
1338             EncryptedAttributeImpl(const EncryptedAttributeImpl& src) : AbstractXMLObject(src), EncryptedElementTypeImpl(src) {}
1339
1340             IMPL_XMLOBJECT_CLONE_EX(EncryptedAttribute);
1341         };
1342
1343         class SAML_DLLLOCAL AttributeStatementImpl : public virtual AttributeStatement,
1344             public AbstractComplexElement,
1345             public AbstractDOMCachingXMLObject,
1346             public AbstractXMLObjectMarshaller,
1347             public AbstractXMLObjectUnmarshaller
1348         {
1349         public:
1350             virtual ~AttributeStatementImpl() {}
1351
1352             AttributeStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1353                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1354             }
1355
1356             AttributeStatementImpl(const AttributeStatementImpl& src)
1357                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
1358                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
1359                     if (*i) {
1360                         Attribute* attribute=dynamic_cast<Attribute*>(*i);
1361                         if (attribute) {
1362                             getAttributes().push_back(attribute->cloneAttribute());
1363                             continue;
1364                         }
1365
1366                         EncryptedAttribute* enc=dynamic_cast<EncryptedAttribute*>(*i);
1367                         if (enc) {
1368                             getEncryptedAttributes().push_back(enc->cloneEncryptedAttribute());
1369                             continue;
1370                         }
1371                     }
1372                 }
1373             }
1374
1375             IMPL_XMLOBJECT_CLONE2(AttributeStatement,Statement);
1376             IMPL_TYPED_CHILDREN(Attribute, m_children.end());
1377             IMPL_TYPED_CHILDREN(EncryptedAttribute, m_children.end());
1378
1379         protected:
1380             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1381                 PROC_TYPED_CHILDREN(Attribute,SAML20_NS,false);
1382                 PROC_TYPED_CHILDREN(EncryptedAttribute,SAML20_NS,false);
1383                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1384             }
1385         };
1386
1387         class SAML_DLLLOCAL AdviceImpl : public virtual Advice,
1388             public AbstractComplexElement,
1389             public AbstractDOMCachingXMLObject,
1390             public AbstractXMLObjectMarshaller,
1391             public AbstractXMLObjectUnmarshaller
1392         {
1393         public:
1394             virtual ~AdviceImpl() {}
1395
1396             AdviceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1397                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1398             }
1399
1400             AdviceImpl(const AdviceImpl& src)
1401                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
1402                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
1403                     if (*i) {
1404                         AssertionIDRef* ref=dynamic_cast<AssertionIDRef*>(*i);
1405                         if (ref) {
1406                             getAssertionIDRefs().push_back(ref->cloneAssertionIDRef());
1407                             continue;
1408                         }
1409
1410                         AssertionURIRef* uri=dynamic_cast<AssertionURIRef*>(*i);
1411                         if (uri) {
1412                             getAssertionURIRefs().push_back(uri->cloneAssertionURIRef());
1413                             continue;
1414                         }
1415
1416                         Assertion* assertion=dynamic_cast<Assertion*>(*i);
1417                         if (assertion) {
1418                             getAssertions().push_back(assertion->cloneAssertion());
1419                             continue;
1420                         }
1421
1422                         EncryptedAssertion* enc=dynamic_cast<EncryptedAssertion*>(*i);
1423                         if (enc) {
1424                             getEncryptedAssertions().push_back(enc->cloneEncryptedAssertion());
1425                             continue;
1426                         }
1427
1428                         getUnknownXMLObjects().push_back((*i)->clone());
1429                     }
1430                 }
1431             }
1432
1433             IMPL_XMLOBJECT_CLONE(Advice);
1434             IMPL_TYPED_CHILDREN(AssertionIDRef,m_children.end());
1435             IMPL_TYPED_CHILDREN(AssertionURIRef,m_children.end());
1436             IMPL_TYPED_CHILDREN(Assertion,m_children.end());
1437             IMPL_TYPED_CHILDREN(EncryptedAssertion,m_children.end());
1438             IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
1439
1440         protected:
1441             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1442                 PROC_TYPED_CHILDREN(AssertionIDRef,SAML20_NS,false);
1443                 PROC_TYPED_CHILDREN(AssertionURIRef,SAML20_NS,false);
1444                 PROC_TYPED_CHILDREN(Assertion,SAML20_NS,false);
1445                 PROC_TYPED_CHILDREN(EncryptedAssertion,SAML20_NS,false);
1446
1447                 // Unknown child.
1448                 const XMLCh* nsURI=root->getNamespaceURI();
1449                 if (!XMLString::equals(nsURI,SAML20_NS) && nsURI && *nsURI) {
1450                     getUnknownXMLObjects().push_back(childXMLObject);
1451                     return;
1452                 }
1453
1454                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1455             }
1456         };
1457
1458         //TODO unit test for this
1459         class SAML_DLLLOCAL EncryptedAssertionImpl : public virtual EncryptedAssertion, public EncryptedElementTypeImpl
1460         {
1461         public:
1462             virtual ~EncryptedAssertionImpl() {}
1463
1464             EncryptedAssertionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1465                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1466
1467             EncryptedAssertionImpl(const EncryptedAssertionImpl& src) : AbstractXMLObject(src), EncryptedElementTypeImpl(src) {}
1468
1469             IMPL_XMLOBJECT_CLONE_EX(EncryptedAssertion);
1470         };
1471
1472         class SAML_DLLLOCAL AssertionImpl : public virtual Assertion,
1473             public AbstractComplexElement,
1474             public AbstractDOMCachingXMLObject,
1475             public AbstractXMLObjectMarshaller,
1476             public AbstractXMLObjectUnmarshaller
1477         {
1478             void init() {
1479                 m_ID=nullptr;
1480                 m_Version=nullptr;
1481                 m_IssueInstant=nullptr;
1482                 m_Issuer=nullptr;
1483                 m_Signature=nullptr;
1484                 m_Subject=nullptr;
1485                 m_Conditions=nullptr;
1486                 m_Advice=nullptr;
1487                 m_children.push_back(nullptr);
1488                 m_children.push_back(nullptr);
1489                 m_children.push_back(nullptr);
1490                 m_children.push_back(nullptr);
1491                 m_children.push_back(nullptr);
1492                 m_pos_Issuer=m_children.begin();
1493                 m_pos_Signature=m_pos_Issuer;
1494                 ++m_pos_Signature;
1495                 m_pos_Subject=m_pos_Signature;
1496                 ++m_pos_Subject;
1497                 m_pos_Conditions=m_pos_Subject;
1498                 ++m_pos_Conditions;
1499                 m_pos_Advice=m_pos_Conditions;
1500                 ++m_pos_Advice;
1501             }
1502         public:
1503             virtual ~AssertionImpl() {
1504                 XMLString::release(&m_ID);
1505                 XMLString::release(&m_Version);
1506                 delete m_IssueInstant;
1507             }
1508
1509             AssertionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1510                 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1511                 init();
1512             }
1513
1514             AssertionImpl(const AssertionImpl& src)
1515                     : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
1516                 init();
1517                 setVersion(src.getVersion());
1518                 setID(src.getID());
1519                 setIssueInstant(src.getIssueInstant());
1520                 if (src.getIssuer())
1521                     setIssuer(src.getIssuer()->cloneIssuer());
1522                 if (src.getSignature())
1523                     setSignature(src.getSignature()->cloneSignature());
1524                 if (src.getSubject())
1525                     setSubject(src.getSubject()->cloneSubject());
1526                 if (src.getConditions())
1527                     setConditions(src.getConditions()->cloneConditions());
1528                 if (src.getAdvice())
1529                     setAdvice(src.getAdvice()->cloneAdvice());
1530                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
1531                     if (*i) {
1532                         AuthnStatement* authst=dynamic_cast<AuthnStatement*>(*i);
1533                         if (authst) {
1534                             getAuthnStatements().push_back(authst->cloneAuthnStatement());
1535                             continue;
1536                         }
1537
1538                         AttributeStatement* attst=dynamic_cast<AttributeStatement*>(*i);
1539                         if (attst) {
1540                             getAttributeStatements().push_back(attst->cloneAttributeStatement());
1541                             continue;
1542                         }
1543
1544                         AuthzDecisionStatement* authzst=dynamic_cast<AuthzDecisionStatement*>(*i);
1545                         if (authzst) {
1546                             getAuthzDecisionStatements().push_back(authzst->cloneAuthzDecisionStatement());
1547                             continue;
1548                         }
1549
1550                         Statement* st=dynamic_cast<Statement*>(*i);
1551                         if (st) {
1552                             getStatements().push_back(st->cloneStatement());
1553                             continue;
1554                         }
1555                     }
1556                 }
1557             }
1558
1559             //IMPL_TYPED_CHILD(Signature);
1560             // Need customized setter.
1561         protected:
1562             Signature* m_Signature;
1563             list<XMLObject*>::iterator m_pos_Signature;
1564         public:
1565             Signature* getSignature() const {
1566                 return m_Signature;
1567             }
1568
1569             void setSignature(Signature* sig) {
1570                 prepareForAssignment(m_Signature,sig);
1571                 *m_pos_Signature=m_Signature=sig;
1572                 // Sync content reference back up.
1573                 if (m_Signature)
1574                     m_Signature->setContentReference(new opensaml::ContentReference(*this));
1575             }
1576
1577             IMPL_XMLOBJECT_CLONE(Assertion);
1578             IMPL_STRING_ATTRIB(Version);
1579             IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
1580             IMPL_DATETIME_ATTRIB(IssueInstant,0);
1581             IMPL_TYPED_CHILD(Issuer);
1582             IMPL_TYPED_CHILD(Subject);
1583             IMPL_TYPED_CHILD(Conditions);
1584             IMPL_TYPED_CHILD(Advice);
1585             IMPL_TYPED_CHILDREN(Statement, m_children.end());
1586             IMPL_TYPED_CHILDREN(AuthnStatement, m_children.end());
1587             IMPL_TYPED_CHILDREN(AttributeStatement, m_children.end());
1588             IMPL_TYPED_CHILDREN(AuthzDecisionStatement, m_children.end());
1589
1590         protected:
1591             void prepareForMarshalling() const {
1592                 if (m_Signature)
1593                     declareNonVisibleNamespaces();
1594             }
1595
1596             void marshallAttributes(DOMElement* domElement) const {
1597                 if (!m_Version)
1598                     const_cast<AssertionImpl*>(this)->m_Version=XMLString::transcode("2.0");
1599                 MARSHALL_STRING_ATTRIB(Version,VER,nullptr);
1600                 if (!m_ID)
1601                     const_cast<AssertionImpl*>(this)->m_ID=SAMLConfig::getConfig().generateIdentifier();
1602                 MARSHALL_ID_ATTRIB(ID,ID,nullptr);
1603                 if (!m_IssueInstant) {
1604                     const_cast<AssertionImpl*>(this)->m_IssueInstantEpoch=time(nullptr);
1605                     const_cast<AssertionImpl*>(this)->m_IssueInstant=new DateTime(m_IssueInstantEpoch);
1606                 }
1607                 MARSHALL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,nullptr);
1608             }
1609
1610             void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1611                 PROC_TYPED_CHILD(Issuer,SAML20_NS,false);
1612                 PROC_TYPED_CHILD(Signature,XMLSIG_NS,false);
1613                 PROC_TYPED_CHILD(Subject,SAML20_NS,false);
1614                 PROC_TYPED_CHILD(Conditions,SAML20_NS,false);
1615                 PROC_TYPED_CHILD(Advice,SAML20_NS,false);
1616                 PROC_TYPED_CHILDREN(AuthnStatement,SAML20_NS,false);
1617                 PROC_TYPED_CHILDREN(AttributeStatement,SAML20_NS,false);
1618                 PROC_TYPED_CHILDREN(AuthzDecisionStatement,SAML20_NS,false);
1619                 PROC_TYPED_CHILDREN(Statement,SAML20_NS,false);
1620                 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1621             }
1622
1623             void processAttribute(const DOMAttr* attribute) {
1624                 PROC_STRING_ATTRIB(Version,VER,nullptr);
1625                 PROC_ID_ATTRIB(ID,ID,nullptr);
1626                 PROC_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,nullptr);
1627                 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
1628             }
1629         };
1630
1631     };
1632 };
1633
1634 #if defined (_MSC_VER)
1635     #pragma warning( pop )
1636 #endif
1637
1638 // Builder Implementations
1639
1640 IMPL_XMLOBJECTBUILDER(Action);
1641 IMPL_XMLOBJECTBUILDER(Advice);
1642 IMPL_XMLOBJECTBUILDER(Assertion);
1643 IMPL_XMLOBJECTBUILDER(AssertionIDRef);
1644 IMPL_XMLOBJECTBUILDER(AssertionURIRef);
1645 IMPL_XMLOBJECTBUILDER(Attribute);
1646 IMPL_XMLOBJECTBUILDER(AttributeStatement);
1647 IMPL_XMLOBJECTBUILDER(AttributeValue);
1648 IMPL_XMLOBJECTBUILDER(Audience);
1649 IMPL_XMLOBJECTBUILDER(AudienceRestriction);
1650 IMPL_XMLOBJECTBUILDER(AuthenticatingAuthority);
1651 IMPL_XMLOBJECTBUILDER(AuthnContext);
1652 IMPL_XMLOBJECTBUILDER(AuthnContextClassRef);
1653 IMPL_XMLOBJECTBUILDER(AuthnContextDecl);
1654 IMPL_XMLOBJECTBUILDER(AuthnContextDeclRef);
1655 IMPL_XMLOBJECTBUILDER(AuthnStatement);
1656 IMPL_XMLOBJECTBUILDER(AuthzDecisionStatement);
1657 IMPL_XMLOBJECTBUILDER(Condition);
1658 IMPL_XMLOBJECTBUILDER(Conditions);
1659 IMPL_XMLOBJECTBUILDER(Delegate);
1660 IMPL_XMLOBJECTBUILDER(DelegationRestrictionType);
1661 IMPL_XMLOBJECTBUILDER(EncryptedAssertion);
1662 IMPL_XMLOBJECTBUILDER(EncryptedAttribute);
1663 IMPL_XMLOBJECTBUILDER(EncryptedID);
1664 IMPL_XMLOBJECTBUILDER(Evidence);
1665 IMPL_XMLOBJECTBUILDER(Issuer);
1666 IMPL_XMLOBJECTBUILDER(KeyInfoConfirmationDataType);
1667 IMPL_XMLOBJECTBUILDER(NameID);
1668 IMPL_XMLOBJECTBUILDER(NameIDType);
1669 IMPL_XMLOBJECTBUILDER(OneTimeUse);
1670 IMPL_XMLOBJECTBUILDER(ProxyRestriction);
1671 IMPL_XMLOBJECTBUILDER(Statement);
1672 IMPL_XMLOBJECTBUILDER(Subject);
1673 IMPL_XMLOBJECTBUILDER(SubjectConfirmation);
1674 IMPL_XMLOBJECTBUILDER(SubjectConfirmationData);
1675 IMPL_XMLOBJECTBUILDER(SubjectLocality);
1676
1677 // Unicode literals
1678 const XMLCh Action::LOCAL_NAME[] =                  UNICODE_LITERAL_6(A,c,t,i,o,n);
1679 const XMLCh Action::TYPE_NAME[] =                   UNICODE_LITERAL_10(A,c,t,i,o,n,T,y,p,e);
1680 const XMLCh Action::NAMESPACE_ATTRIB_NAME[] =       UNICODE_LITERAL_9(N,a,m,e,s,p,a,c,e);
1681 const XMLCh Advice::LOCAL_NAME[] =                  UNICODE_LITERAL_6(A,d,v,i,c,e);
1682 const XMLCh Advice::TYPE_NAME[] =                   UNICODE_LITERAL_10(A,d,v,i,c,e,T,y,p,e);
1683 const XMLCh Assertion::LOCAL_NAME[] =               UNICODE_LITERAL_9(A,s,s,e,r,t,i,o,n);
1684 const XMLCh Assertion::TYPE_NAME[] =                UNICODE_LITERAL_13(A,s,s,e,r,t,i,o,n,T,y,p,e);
1685 const XMLCh Assertion::VER_ATTRIB_NAME[] =          UNICODE_LITERAL_7(V,e,r,s,i,o,n);
1686 const XMLCh Assertion::ID_ATTRIB_NAME[] =           UNICODE_LITERAL_2(I,D);
1687 const XMLCh Assertion::ISSUEINSTANT_ATTRIB_NAME[] = UNICODE_LITERAL_12(I,s,s,u,e,I,n,s,t,a,n,t);
1688 const XMLCh AssertionIDRef::LOCAL_NAME[] =          UNICODE_LITERAL_14(A,s,s,e,r,t,i,o,n,I,D,R,e,f);
1689 const XMLCh AssertionURIRef::LOCAL_NAME[] =         UNICODE_LITERAL_15(A,s,s,e,r,t,i,o,n,U,R,I,R,e,f);
1690 const XMLCh Attribute::LOCAL_NAME[] =               UNICODE_LITERAL_9(A,t,t,r,i,b,u,t,e);
1691 const XMLCh Attribute::TYPE_NAME[] =                UNICODE_LITERAL_13(A,t,t,r,i,b,u,t,e,T,y,p,e);
1692 const XMLCh Attribute::NAME_ATTRIB_NAME[] =         UNICODE_LITERAL_4(N,a,m,e);
1693 const XMLCh Attribute::NAMEFORMAT_ATTRIB_NAME[] =   UNICODE_LITERAL_10(N,a,m,e,F,o,r,m,a,t);
1694 const XMLCh Attribute::FRIENDLYNAME_ATTRIB_NAME[] = UNICODE_LITERAL_12(F,r,i,e,n,d,l,y,N,a,m,e);
1695 const XMLCh AttributeStatement::LOCAL_NAME[] =      UNICODE_LITERAL_18(A,t,t,r,i,b,u,t,e,S,t,a,t,e,m,e,n,t);
1696 const XMLCh AttributeStatement::TYPE_NAME[] =       UNICODE_LITERAL_22(A,t,t,r,i,b,u,t,e,S,t,a,t,e,m,e,n,t,T,y,p,e);
1697 const XMLCh AttributeValue::LOCAL_NAME[] =          UNICODE_LITERAL_14(A,t,t,r,i,b,u,t,e,V,a,l,u,e);
1698 const XMLCh Audience::LOCAL_NAME[] =                UNICODE_LITERAL_8(A,u,d,i,e,n,c,e);
1699 const XMLCh AudienceRestriction::LOCAL_NAME[] =     UNICODE_LITERAL_19(A,u,d,i,e,n,c,e,R,e,s,t,r,i,c,t,i,o,n);
1700 const XMLCh AudienceRestriction::TYPE_NAME[] =      UNICODE_LITERAL_23(A,u,d,i,e,n,c,e,R,e,s,t,r,i,c,t,i,o,n,T,y,p,e);
1701 const XMLCh AuthenticatingAuthority::LOCAL_NAME[] = UNICODE_LITERAL_23(A,u,t,h,e,n,t,i,c,a,t,i,n,g,A,u,t,h,o,r,i,t,y);
1702 const XMLCh AuthnContext::LOCAL_NAME[] =            UNICODE_LITERAL_12(A,u,t,h,n,C,o,n,t,e,x,t);
1703 const XMLCh AuthnContext::TYPE_NAME[] =             UNICODE_LITERAL_16(A,u,t,h,n,C,o,n,t,e,x,t,T,y,p,e);
1704 const XMLCh AuthnContextClassRef::LOCAL_NAME[] =    UNICODE_LITERAL_20(A,u,t,h,n,C,o,n,t,e,x,t,C,l,a,s,s,R,e,f);
1705 const XMLCh AuthnContextDecl::LOCAL_NAME[] =        UNICODE_LITERAL_16(A,u,t,h,n,C,o,n,t,e,x,t,D,e,c,l);
1706 const XMLCh AuthnContextDeclRef::LOCAL_NAME[] =     UNICODE_LITERAL_19(A,u,t,h,n,C,o,n,t,e,x,t,D,e,c,l,R,e,f);
1707 const XMLCh AuthnStatement::LOCAL_NAME[] =          UNICODE_LITERAL_14(A,u,t,h,n,S,t,a,t,e,m,e,n,t);
1708 const XMLCh AuthnStatement::TYPE_NAME[] =           UNICODE_LITERAL_18(A,u,t,h,n,S,t,a,t,e,m,e,n,t,T,y,p,e);
1709 const XMLCh AuthnStatement::AUTHNINSTANT_ATTRIB_NAME[] =    UNICODE_LITERAL_12(A,u,t,h,n,I,n,s,t,a,n,t);
1710 const XMLCh AuthnStatement::SESSIONINDEX_ATTRIB_NAME[] =    UNICODE_LITERAL_12(S,e,s,s,i,o,n,I,n,d,e,x);
1711 const XMLCh AuthnStatement::SESSIONNOTONORAFTER_ATTRIB_NAME[] = UNICODE_LITERAL_19(S,e,s,s,i,o,n,N,o,t,O,n,O,r,A,f,t,e,r);
1712 const XMLCh AuthzDecisionStatement::LOCAL_NAME[] =  UNICODE_LITERAL_22(A,u,t,h,z,D,e,c,i,s,i,o,n,S,t,a,t,e,m,e,n,t);
1713 const XMLCh AuthzDecisionStatement::TYPE_NAME[] =   UNICODE_LITERAL_26(A,u,t,h,z,D,e,c,i,s,i,o,n,S,t,a,t,e,m,e,n,t,T,y,p,e);
1714 const XMLCh AuthzDecisionStatement::RESOURCE_ATTRIB_NAME[] =    UNICODE_LITERAL_8(R,e,s,o,u,r,c,e);
1715 const XMLCh AuthzDecisionStatement::DECISION_ATTRIB_NAME[] =    UNICODE_LITERAL_8(D,e,c,i,s,i,o,n);
1716 const XMLCh AuthzDecisionStatement::DECISION_PERMIT[] = UNICODE_LITERAL_6(P,e,r,m,i,t);
1717 const XMLCh AuthzDecisionStatement::DECISION_DENY[] =   UNICODE_LITERAL_4(D,e,n,y);
1718 const XMLCh AuthzDecisionStatement::DECISION_INDETERMINATE[] =  UNICODE_LITERAL_13(I,n,d,e,t,e,r,m,i,n,a,t,e);
1719 const XMLCh BaseID::LOCAL_NAME[] =                  UNICODE_LITERAL_6(B,a,s,e,I,D);
1720 const XMLCh BaseID::NAMEQUALIFIER_ATTRIB_NAME[] =   UNICODE_LITERAL_13(N,a,m,e,Q,u,a,l,i,f,i,e,r);
1721 const XMLCh BaseID::SPNAMEQUALIFIER_ATTRIB_NAME[] = UNICODE_LITERAL_15(S,P,N,a,m,e,Q,u,a,l,i,f,i,e,r);
1722 const XMLCh Condition::LOCAL_NAME[] =               UNICODE_LITERAL_9(C,o,n,d,i,t,i,o,n);
1723 const XMLCh Conditions::LOCAL_NAME[] =              UNICODE_LITERAL_10(C,o,n,d,i,t,i,o,n,s);
1724 const XMLCh Conditions::TYPE_NAME[] =               UNICODE_LITERAL_14(C,o,n,d,i,t,i,o,n,s,T,y,p,e);
1725 const XMLCh Conditions::NOTBEFORE_ATTRIB_NAME[] =   UNICODE_LITERAL_9(N,o,t,B,e,f,o,r,e);
1726 const XMLCh Conditions::NOTONORAFTER_ATTRIB_NAME[] =UNICODE_LITERAL_12(N,o,t,O,n,O,r,A,f,t,e,r);
1727 const XMLCh Delegate::LOCAL_NAME[] =                UNICODE_LITERAL_8(D,e,l,e,g,a,t,e);
1728 const XMLCh Delegate::TYPE_NAME[] =                 UNICODE_LITERAL_12(D,e,l,e,g,a,t,e,T,y,p,e);
1729 const XMLCh Delegate::CONFIRMATIONMETHOD_ATTRIB_NAME[] = UNICODE_LITERAL_18(C,o,n,f,i,r,m,a,t,i,o,n,M,e,t,h,o,d);
1730 const XMLCh Delegate::DELEGATIONINSTANT_ATTRIB_NAME[] = UNICODE_LITERAL_17(D,e,l,e,g,a,t,i,o,n,I,n,s,t,a,n,t);
1731 const XMLCh DelegationRestrictionType::LOCAL_NAME[] = UNICODE_LITERAL_9(C,o,n,d,i,t,i,o,n);
1732 const XMLCh DelegationRestrictionType::TYPE_NAME[] =UNICODE_LITERAL_25(D,e,l,e,g,a,t,i,o,n,R,e,s,t,r,i,c,t,i,o,n,T,y,p,e);
1733 const XMLCh EncryptedAssertion::LOCAL_NAME[] =      UNICODE_LITERAL_18(E,n,c,r,y,p,t,e,d,A,s,s,e,r,t,i,o,n);
1734 const XMLCh EncryptedAttribute::LOCAL_NAME[] =      UNICODE_LITERAL_18(E,n,c,r,y,p,t,e,d,A,t,t,r,i,b,u,t,e);
1735 const XMLCh EncryptedElementType::LOCAL_NAME[] =    {chNull};
1736 const XMLCh EncryptedElementType::TYPE_NAME[] =     UNICODE_LITERAL_20(E,n,c,r,y,p,t,e,d,E,l,e,m,e,n,t,T,y,p,e);
1737 const XMLCh EncryptedID::LOCAL_NAME[] =             UNICODE_LITERAL_11(E,n,c,r,y,p,t,e,d,I,D);
1738 const XMLCh Evidence::LOCAL_NAME[] =                UNICODE_LITERAL_8(E,v,i,d,e,n,c,e);
1739 const XMLCh Evidence::TYPE_NAME[] =                 UNICODE_LITERAL_12(E,v,i,d,e,n,c,e,T,y,p,e);
1740 const XMLCh Issuer::LOCAL_NAME[] =                  UNICODE_LITERAL_6(I,s,s,u,e,r);
1741 const XMLCh KeyInfoConfirmationDataType::LOCAL_NAME[] = UNICODE_LITERAL_23(S,u,b,j,e,c,t,C,o,n,f,i,r,m,a,t,i,o,n,D,a,t,a);
1742 const XMLCh KeyInfoConfirmationDataType::TYPE_NAME[] = UNICODE_LITERAL_27(K,e,y,I,n,f,o,C,o,n,f,i,r,m,a,t,i,o,n,D,a,t,a,T,y,p,e);
1743 const XMLCh NameID::LOCAL_NAME[] =                  UNICODE_LITERAL_6(N,a,m,e,I,D);
1744 const XMLCh NameIDType::LOCAL_NAME[] =              {chNull};
1745 const XMLCh NameIDType::TYPE_NAME[] =               UNICODE_LITERAL_10(N,a,m,e,I,D,T,y,p,e);
1746 const XMLCh NameIDType::NAMEQUALIFIER_ATTRIB_NAME[] =   UNICODE_LITERAL_13(N,a,m,e,Q,u,a,l,i,f,i,e,r);
1747 const XMLCh NameIDType::SPNAMEQUALIFIER_ATTRIB_NAME[] = UNICODE_LITERAL_15(S,P,N,a,m,e,Q,u,a,l,i,f,i,e,r);
1748 const XMLCh NameIDType::FORMAT_ATTRIB_NAME[] =      UNICODE_LITERAL_6(F,o,r,m,a,t);
1749 const XMLCh NameIDType::SPPROVIDEDID_ATTRIB_NAME[] =    UNICODE_LITERAL_12(S,P,P,r,o,v,i,d,e,d,I,D);
1750 const XMLCh OneTimeUse::LOCAL_NAME[] =              UNICODE_LITERAL_10(O,n,e,T,i,m,e,U,s,e);
1751 const XMLCh OneTimeUse::TYPE_NAME[] =               UNICODE_LITERAL_14(O,n,e,T,i,m,e,U,s,e,T,y,p,e);
1752 const XMLCh ProxyRestriction::LOCAL_NAME[] =        UNICODE_LITERAL_16(P,r,o,x,y,R,e,s,t,r,i,c,t,i,o,n);
1753 const XMLCh ProxyRestriction::TYPE_NAME[] =         UNICODE_LITERAL_20(P,r,o,x,y,R,e,s,t,r,i,c,t,i,o,n,T,y,p,e);
1754 const XMLCh ProxyRestriction::COUNT_ATTRIB_NAME[] = UNICODE_LITERAL_5(C,o,u,n,t);
1755 const XMLCh Statement::LOCAL_NAME[] =               UNICODE_LITERAL_9(S,t,a,t,e,m,e,n,t);
1756 const XMLCh Subject::LOCAL_NAME[] =                 UNICODE_LITERAL_7(S,u,b,j,e,c,t);
1757 const XMLCh Subject::TYPE_NAME[] =                  UNICODE_LITERAL_11(S,u,b,j,e,c,t,T,y,p,e);
1758 const XMLCh SubjectConfirmation::LOCAL_NAME[] =     UNICODE_LITERAL_19(S,u,b,j,e,c,t,C,o,n,f,i,r,m,a,t,i,o,n);
1759 const XMLCh SubjectConfirmation::TYPE_NAME[] =      UNICODE_LITERAL_23(S,u,b,j,e,c,t,C,o,n,f,i,r,m,a,t,i,o,n,T,y,p,e);
1760 const XMLCh SubjectConfirmation::METHOD_ATTRIB_NAME[] = UNICODE_LITERAL_6(M,e,t,h,o,d);
1761 const XMLCh SubjectConfirmationData::LOCAL_NAME[] = UNICODE_LITERAL_23(S,u,b,j,e,c,t,C,o,n,f,i,r,m,a,t,i,o,n,D,a,t,a);
1762 const XMLCh SubjectConfirmationDataType::NOTBEFORE_ATTRIB_NAME[] =      UNICODE_LITERAL_9(N,o,t,B,e,f,o,r,e);
1763 const XMLCh SubjectConfirmationDataType::NOTONORAFTER_ATTRIB_NAME[] =   UNICODE_LITERAL_12(N,o,t,O,n,O,r,A,f,t,e,r);
1764 const XMLCh SubjectConfirmationDataType::INRESPONSETO_ATTRIB_NAME[] =   UNICODE_LITERAL_12(I,n,R,e,s,p,o,n,s,e,T,o);
1765 const XMLCh SubjectConfirmationDataType::RECIPIENT_ATTRIB_NAME[] =      UNICODE_LITERAL_9(R,e,c,i,p,i,e,n,t);
1766 const XMLCh SubjectConfirmationDataType::ADDRESS_ATTRIB_NAME[] =        UNICODE_LITERAL_7(A,d,d,r,e,s,s);
1767 const XMLCh SubjectLocality::LOCAL_NAME[] =         UNICODE_LITERAL_15(S,u,b,j,e,c,t,L,o,c,a,l,i,t,y);
1768 const XMLCh SubjectLocality::TYPE_NAME[] =          UNICODE_LITERAL_19(S,u,b,j,e,c,t,L,o,c,a,l,i,t,y,T,y,p,e);
1769 const XMLCh SubjectLocality::ADDRESS_ATTRIB_NAME[] =UNICODE_LITERAL_7(A,d,d,r,e,s,s);
1770 const XMLCh SubjectLocality::DNSNAME_ATTRIB_NAME[] =UNICODE_LITERAL_7(D,N,S,N,a,m,e);
1771
1772 const XMLCh NameIDType::UNSPECIFIED[] = // urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
1773 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1774   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1775   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_1, chColon,
1776   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_i, chLatin_d, chDash,
1777   chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chColon,
1778   chLatin_u, chLatin_n, chLatin_s, chLatin_p, chLatin_e, chLatin_c, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_d, chNull
1779 };
1780
1781 const XMLCh NameIDType::EMAIL[] = // urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
1782 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1783   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1784   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_1, chColon,
1785   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_i, chLatin_d, chDash,
1786   chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chColon,
1787   chLatin_e, chLatin_m, chLatin_a, chLatin_i, chLatin_l, chLatin_A, chLatin_d, chLatin_d, chLatin_r, chLatin_e, chLatin_s, chLatin_s, chNull
1788 };
1789
1790 const XMLCh NameIDType::X509_SUBJECT[] = // urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName
1791 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1792   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1793   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_1, chColon,
1794   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_i, chLatin_d, chDash,
1795   chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chColon,
1796   chLatin_X, chDigit_5, chDigit_0, chDigit_9, chLatin_S, chLatin_u, chLatin_b, chLatin_j, chLatin_e, chLatin_c, chLatin_t,
1797   chLatin_N, chLatin_a, chLatin_m, chLatin_e, chNull
1798 };
1799
1800 const XMLCh NameIDType::WIN_DOMAIN_QUALIFIED[] = // urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName
1801 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1802   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1803   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_1, chColon,
1804   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_i, chLatin_d, chDash,
1805   chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chColon,
1806   chLatin_W, chLatin_i, chLatin_n, chLatin_d, chLatin_o, chLatin_w, chLatin_s,
1807   chLatin_D, chLatin_o, chLatin_m, chLatin_a, chLatin_i, chLatin_n,
1808   chLatin_Q, chLatin_u, chLatin_a, chLatin_l, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_d,
1809   chLatin_N, chLatin_a, chLatin_m, chLatin_e, chNull
1810 };
1811
1812 const XMLCh NameIDType::KERBEROS[] = // urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos
1813 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1814   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1815   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
1816   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_i, chLatin_d, chDash,
1817   chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chColon,
1818   chLatin_k, chLatin_e, chLatin_r, chLatin_b, chLatin_e, chLatin_r, chLatin_o, chLatin_s, chNull
1819 };
1820
1821 const XMLCh NameIDType::ENTITY[] = // urn:oasis:names:tc:SAML:2.0:nameid-format:entity
1822 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1823   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1824   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
1825   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_i, chLatin_d, chDash,
1826   chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chColon,
1827   chLatin_e, chLatin_n, chLatin_t, chLatin_i, chLatin_t, chLatin_y, chNull
1828 };
1829
1830 const XMLCh NameIDType::PERSISTENT[] = // urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
1831 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1832   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1833   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
1834   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_i, chLatin_d, chDash,
1835   chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chColon,
1836   chLatin_p, chLatin_e, chLatin_r, chLatin_s, chLatin_i, chLatin_s, chLatin_t, chLatin_e, chLatin_n, chLatin_t, chNull
1837 };
1838
1839 const XMLCh NameIDType::TRANSIENT[] = // urn:oasis:names:tc:SAML:2.0:nameid-format:transient
1840 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1841   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1842   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
1843   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_i, chLatin_d, chDash,
1844   chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chColon,
1845   chLatin_t, chLatin_r, chLatin_a, chLatin_n, chLatin_s, chLatin_i, chLatin_e, chLatin_n, chLatin_t, chNull
1846 };
1847
1848 const XMLCh SubjectConfirmation::BEARER[] = // urn:oasis:names:tc:SAML:2.0:cm:bearer
1849 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1850   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1851   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
1852   chLatin_c, chLatin_m, chColon, chLatin_b, chLatin_e, chLatin_a, chLatin_r, chLatin_e, chLatin_r, chNull
1853 };
1854
1855 const XMLCh SubjectConfirmation::HOLDER_KEY[] = // urn:oasis:names:tc:SAML:2.0:cm:holder-of-key
1856 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1857   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1858   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
1859   chLatin_c, chLatin_m, chColon, chLatin_h, chLatin_o, chLatin_l, chLatin_d, chLatin_e, chLatin_r, chDash,
1860       chLatin_o, chLatin_f, chDash, chLatin_k, chLatin_e, chLatin_y, chNull
1861 };
1862
1863 const XMLCh SubjectConfirmation::SENDER_VOUCHES[] = // urn:oasis:names:tc:SAML:2.0:cm:sender-vouches
1864 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1865   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1866   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
1867   chLatin_c, chLatin_m, chColon, chLatin_s, chLatin_e, chLatin_n, chLatin_d, chLatin_e, chLatin_r, chDash,
1868       chLatin_v, chLatin_o, chLatin_u, chLatin_c, chLatin_h, chLatin_e, chLatin_s, chNull
1869 };
1870
1871 const XMLCh Action::RWEDC_ACTION_NAMESPACE[] = // urn:oasis:names:tc:SAML:1.0:action:rwedc
1872 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1873   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1874   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon,
1875   chLatin_a, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chColon,
1876   chLatin_r, chLatin_w, chLatin_e, chLatin_d, chLatin_c, chNull
1877 };
1878
1879 const XMLCh Action::RWEDC_NEG_ACTION_NAMESPACE[] = // urn:oasis:names:tc:SAML:1.0:action:rwedc-negation
1880 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1881   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1882   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon,
1883   chLatin_a, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chColon,
1884   chLatin_r, chLatin_w, chLatin_e, chLatin_d, chLatin_c, chDash,
1885   chLatin_n, chLatin_e, chLatin_g, chLatin_a, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull
1886 };
1887
1888 const XMLCh Action::GHPP_ACTION_NAMESPACE[] = // urn:oasis:names:tc:SAML:1.0:action:ghpp
1889 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1890   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1891   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon,
1892   chLatin_a, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chColon,
1893   chLatin_g, chLatin_h, chLatin_p, chLatin_p, chNull
1894 };
1895
1896 const XMLCh Action::UNIX_ACTION_NAMESPACE[] = // urn:oasis:names:tc:SAML:1.0:action:unix
1897 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1898   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1899   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon,
1900   chLatin_a, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chColon,
1901   chLatin_u, chLatin_n, chLatin_i, chLatin_x, chNull
1902 };
1903
1904 const XMLCh Attribute::UNSPECIFIED[] = // urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified
1905 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1906   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1907   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
1908   chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chDash,
1909   chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chColon,
1910   chLatin_u, chLatin_n, chLatin_s, chLatin_p, chLatin_e, chLatin_c, chLatin_i, chLatin_f, chLatin_i, chLatin_e, chLatin_d, chNull
1911 };
1912
1913 const XMLCh Attribute::URI_REFERENCE[] = // urn:oasis:names:tc:SAML:2.0:attrname-format:uri
1914 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1915   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1916   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
1917   chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chDash,
1918   chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chColon,
1919   chLatin_u, chLatin_r, chLatin_i, chNull
1920 };
1921
1922 const XMLCh Attribute::BASIC[] = // urn:oasis:names:tc:SAML:2.0:attrname-format:basic
1923 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon,
1924   chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon,
1925   chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon,
1926   chLatin_a, chLatin_t, chLatin_t, chLatin_r, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chDash,
1927   chLatin_f, chLatin_o, chLatin_r, chLatin_m, chLatin_a, chLatin_t, chColon,
1928   chLatin_b, chLatin_a, chLatin_s, chLatin_i, chLatin_c, chNull
1929 };