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