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