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