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