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