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