CPPOST-95 - Add MD RPI extension implementation to metadata classes.
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / Metadata.h
1 /**
2  * Licensed to the University Corporation for Advanced Internet
3  * Development, Inc. (UCAID) under one or more contributor license
4  * agreements. See the NOTICE file distributed with this work for
5  * additional information regarding copyright ownership.
6  *
7  * UCAID licenses this file to you under the Apache License,
8  * Version 2.0 (the "License"); you may not use this file except
9  * in compliance with the License. You may obtain a copy of the
10  * License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17  * either express or implied. See the License for the specific
18  * language governing permissions and limitations under the License.
19  */
20
21 /**
22  * @file saml/saml2/metadata/Metadata.h
23  *
24  * XMLObjects representing the SAML 2.0 Metadata schema.
25  */
26
27 #ifndef __saml2_metadata_h__
28 #define __saml2_metadata_h__
29
30 #include <saml/saml2/core/Assertions.h>
31
32 #include <ctime>
33 #include <xercesc/util/XMLUniDefs.hpp>
34 #include <xmltooling/util/Predicates.h>
35
36
37 #define DECL_SAML2MDOBJECTBUILDER(cname) \
38     DECL_XMLOBJECTBUILDER(SAML_API,cname,samlconstants::SAML20MD_NS,samlconstants::SAML20MD_PREFIX)
39
40 namespace xmltooling {
41     class XMLTOOL_API Credential;
42     class XMLTOOL_API CredentialResolver;
43 }
44
45 namespace xmlencryption {
46     class XMLTOOL_API EncryptionMethod;
47 };
48
49 namespace opensaml {
50
51     /**
52      * @namespace opensaml::saml2md
53      * SAML 2.0 metadata namespace
54      */
55     namespace saml2md {
56
57         class SAML_API DigestMethod;
58         class SAML_API SigningMethod;
59
60         /**
61          * Base class for metadata objects that feature a cacheDuration attribute.
62          */
63         class SAML_API CacheableSAMLObject : public virtual xmltooling::XMLObject
64         {
65         protected:
66             CacheableSAMLObject() {}
67         public:
68             ~CacheableSAMLObject() {}
69             DECL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION);
70         };
71
72         /**
73          * Base class for metadata objects that feature a validUntil attribute.
74          */
75         class SAML_API TimeBoundSAMLObject : public virtual xmltooling::XMLObject
76         {
77         protected:
78             TimeBoundSAMLObject() {}
79         public:
80             ~TimeBoundSAMLObject() {}
81             DECL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL);
82             /** Returns true iff the object is valid at the current time. */
83             bool isValid() const {
84                 return time(nullptr) <= getValidUntilEpoch();
85             }
86             /**
87              * Returns true iff the object is valid at the supplied time.
88              *
89              * @param t the time to check against
90              */
91             bool isValid(time_t t) const {
92                 return t <= getValidUntilEpoch();
93             }
94         };
95
96         DECL_XMLOBJECT_SIMPLE(SAML_API,AffiliateMember,ID,SAML 2.0 AffiliateMember element);
97         DECL_XMLOBJECT_SIMPLE(SAML_API,AttributeProfile,ProfileURI,SAML 2.0 AttributeProfile element);
98         DECL_XMLOBJECT_SIMPLE(SAML_API,Company,Name,SAML 2.0 Company element);
99         DECL_XMLOBJECT_SIMPLE(SAML_API,EmailAddress,Address,SAML 2.0 EmailAddress element);
100         DECL_XMLOBJECT_SIMPLE(SAML_API,GivenName,Name,SAML 2.0 GivenName element);
101         DECL_XMLOBJECT_SIMPLE(SAML_API,NameIDFormat,Format,SAML 2.0 NameIDFormat element);
102         DECL_XMLOBJECT_SIMPLE(SAML_API,SurName,Name,SAML 2.0 SurName element);
103         DECL_XMLOBJECT_SIMPLE(SAML_API,TelephoneNumber,Number,SAML 2.0 TelephoneNumber element);
104
105         DECL_XMLOBJECT_SIMPLE(SAML_API,ActionNamespace,Namespace,SAML 2.0 Metadata Extension ActionNamespace element);
106
107         BEGIN_XMLOBJECT(SAML_API,localizedNameType,xmltooling::XMLObject,SAML 2.0 localizedNameType type);
108             /** xml:lang attribute name. */
109             static const XMLCh LANG_ATTRIB_NAME[];
110
111             /**
112              * Sets the xml:lang attribute.
113              *
114              * @param Lang  the value to set
115              */
116             virtual void setLang(const XMLCh* Lang)=0;
117
118             /** localizedNameType local name */
119             static const XMLCh TYPE_NAME[];
120         END_XMLOBJECT;
121
122         BEGIN_XMLOBJECT(SAML_API,localizedURIType,xmltooling::XMLObject,SAML 2.0 localizedURIType type);
123             /** xml:lang attribute name. */
124             static const XMLCh LANG_ATTRIB_NAME[];
125
126             /**
127              * Sets the xml:lang attribute.
128              *
129              * @param Lang  the value to set
130              */
131             virtual void setLang(const XMLCh* Lang)=0;
132
133             /** localizedURIType local name */
134             static const XMLCh TYPE_NAME[];
135         END_XMLOBJECT;
136
137         BEGIN_XMLOBJECT(SAML_API,OrganizationName,localizedNameType,SAML 2.0 OrganizationName element);
138             DECL_SIMPLE_CONTENT(Name);
139         END_XMLOBJECT;
140
141         BEGIN_XMLOBJECT(SAML_API,OrganizationDisplayName,localizedNameType,SAML 2.0 OrganizationDisplayName element);
142             DECL_SIMPLE_CONTENT(Name);
143         END_XMLOBJECT;
144
145         BEGIN_XMLOBJECT(SAML_API,OrganizationURL,localizedURIType,SAML 2.0 OrganizationURL element);
146             DECL_SIMPLE_CONTENT(URL);
147         END_XMLOBJECT;
148
149         BEGIN_XMLOBJECT(SAML_API,Extensions,xmltooling::ElementExtensibleXMLObject,SAML 2.0 Extensions element);
150             /** ExtensionsType local name */
151             static const XMLCh TYPE_NAME[];
152         END_XMLOBJECT;
153
154         BEGIN_XMLOBJECT(SAML_API,Organization,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 Organization element);
155             DECL_TYPED_CHILD(Extensions);
156             DECL_TYPED_CHILDREN(OrganizationName);
157             DECL_TYPED_CHILDREN(OrganizationDisplayName);
158             DECL_TYPED_CHILDREN(OrganizationURL);
159             /** OrganizationType local name */
160             static const XMLCh TYPE_NAME[];
161         END_XMLOBJECT;
162
163         BEGIN_XMLOBJECT(SAML_API,ContactPerson,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 ContactPerson element);
164             DECL_STRING_ATTRIB(ContactType,CONTACTTYPE);
165             DECL_TYPED_CHILD(Extensions);
166             DECL_TYPED_CHILD(Company);
167             DECL_TYPED_CHILD(GivenName);
168             DECL_TYPED_CHILD(SurName);
169             DECL_TYPED_CHILDREN(EmailAddress);
170             DECL_TYPED_CHILDREN(TelephoneNumber);
171             /** ContactType local name */
172             static const XMLCh TYPE_NAME[];
173             /** technical Contact Type */
174             static const XMLCh CONTACT_TECHNICAL[];
175             /** support Contact Type */
176             static const XMLCh CONTACT_SUPPORT[];
177             /** administrative Contact Type */
178             static const XMLCh CONTACT_ADMINISTRATIVE[];
179             /** billing Contact Type */
180             static const XMLCh CONTACT_BILLING[];
181             /** other Contact Type */
182             static const XMLCh CONTACT_OTHER[];
183         END_XMLOBJECT;
184
185         BEGIN_XMLOBJECT(SAML_API,AdditionalMetadataLocation,xmltooling::XMLObject,SAML 2.0 AdditionalMetadataLocation element);
186             DECL_STRING_ATTRIB(Namespace,NAMESPACE);
187             DECL_SIMPLE_CONTENT(Location);
188             /** AdditionalMetadataLocationType local name */
189             static const XMLCh TYPE_NAME[];
190         END_XMLOBJECT;
191
192         BEGIN_XMLOBJECT(SAML_API,KeyDescriptor,xmltooling::XMLObject,SAML 2.0 KeyDescriptor element);
193             DECL_STRING_ATTRIB(Use,USE);
194             DECL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
195             DECL_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption);
196             /** KeyDescriptorType local name */
197             static const XMLCh TYPE_NAME[];
198             /** encryption Key Type */
199             static const XMLCh KEYTYPE_ENCRYPTION[];
200             /** signing Key Type */
201             static const XMLCh KEYTYPE_SIGNING[];
202         END_XMLOBJECT;
203
204         BEGIN_XMLOBJECT4(SAML_API,RoleDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
205                 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 RoleDescriptor abstract element);
206             DECL_STRING_ATTRIB(ID,ID);
207             DECL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION);
208             /** Searches the ProtocolSupportEnumeration attribute for the indicated protocol. */
209             virtual bool hasSupport(const XMLCh* protocol) const=0;
210             /** Adds the indicated protocol to the ProtocolSupportEnumeration attribute. */
211             virtual void addSupport(const XMLCh* protocol)=0;
212             DECL_STRING_ATTRIB(ErrorURL,ERRORURL);
213             DECL_TYPED_CHILD(Extensions);
214             DECL_TYPED_CHILDREN(KeyDescriptor);
215             DECL_TYPED_CHILD(Organization);
216             DECL_TYPED_CHILDREN(ContactPerson);
217             /** Returns the first digest method supported by the role and the underlying implementation, if any. */
218             virtual const DigestMethod* getDigestMethod() const;
219             /** Returns the first signing method supported by the role and the underlying implementation, if any, along with a matching credential. */
220             virtual std::pair<const SigningMethod*,const xmltooling::Credential*> getSigningMethod(
221                 const xmltooling::CredentialResolver& resolver, xmltooling::CredentialCriteria& cc
222                 ) const;
223         END_XMLOBJECT;
224
225         BEGIN_XMLOBJECT2(SAML_API,RoleDescriptorType,RoleDescriptor,xmltooling::ElementExtensibleXMLObject,SAML 2.0 RoleDescriptor extension);
226         END_XMLOBJECT;
227
228         BEGIN_XMLOBJECT(SAML_API,EndpointType,xmltooling::ElementProxy,SAML 2.0 EndpointType type);
229             DECL_STRING_ATTRIB(Binding,BINDING);
230             DECL_STRING_ATTRIB(Location,LOCATION);
231             DECL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION);
232             /** EndpointType local name */
233             static const XMLCh TYPE_NAME[];
234         END_XMLOBJECT;
235
236         BEGIN_XMLOBJECT(SAML_API,IndexedEndpointType,EndpointType,SAML 2.0 IndexedEndpointType type);
237             DECL_INTEGER_ATTRIB(Index,INDEX);
238             DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
239             /** IndexedEndpointType local name */
240             static const XMLCh TYPE_NAME[];
241         END_XMLOBJECT;
242
243         BEGIN_XMLOBJECT(SAML_API,ArtifactResolutionService,IndexedEndpointType,SAML 2.0 ArtifactResolutionService element);
244         END_XMLOBJECT;
245
246         BEGIN_XMLOBJECT(SAML_API,SingleLogoutService,EndpointType,SAML 2.0 SingleLogoutService element);
247         END_XMLOBJECT;
248
249         BEGIN_XMLOBJECT(SAML_API,ManageNameIDService,EndpointType,SAML 2.0 ManageNameIDService element);
250         END_XMLOBJECT;
251
252         BEGIN_XMLOBJECT(SAML_API,SSODescriptorType,RoleDescriptor,SAML 2.0 SSODescriptorType abstract type);
253             DECL_TYPED_CHILDREN(ArtifactResolutionService);
254             DECL_TYPED_CHILDREN(SingleLogoutService);
255             DECL_TYPED_CHILDREN(ManageNameIDService);
256             DECL_TYPED_CHILDREN(NameIDFormat);
257             /** SSODescriptorType local name */
258             static const XMLCh TYPE_NAME[];
259         END_XMLOBJECT;
260
261         BEGIN_XMLOBJECT(SAML_API,SingleSignOnService,EndpointType,SAML 2.0 SingleSignOnService element);
262         END_XMLOBJECT;
263
264         BEGIN_XMLOBJECT(SAML_API,NameIDMappingService,EndpointType,SAML 2.0 NameIDMappingService element);
265         END_XMLOBJECT;
266
267         BEGIN_XMLOBJECT(SAML_API,AssertionIDRequestService,EndpointType,SAML 2.0 AssertionIDRequestService element);
268         END_XMLOBJECT;
269
270         BEGIN_XMLOBJECT(SAML_API,IDPSSODescriptor,SSODescriptorType,SAML 2.0 IDPSSODescriptor element);
271             DECL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,false);
272             DECL_TYPED_CHILDREN(SingleSignOnService);
273             DECL_TYPED_CHILDREN(NameIDMappingService);
274             DECL_TYPED_CHILDREN(AssertionIDRequestService);
275             DECL_TYPED_CHILDREN(AttributeProfile);
276             DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
277             /** IDPSSODescriptorType local name */
278             static const XMLCh TYPE_NAME[];
279             DECL_ELEMENT_QNAME;
280         END_XMLOBJECT;
281
282         BEGIN_XMLOBJECT(SAML_API,ServiceName,localizedNameType,SAML 2.0 ServiceName element);
283             DECL_SIMPLE_CONTENT(Name);
284         END_XMLOBJECT;
285
286         BEGIN_XMLOBJECT(SAML_API,ServiceDescription,localizedNameType,SAML 2.0 ServiceDescription element);
287             DECL_SIMPLE_CONTENT(Description);
288         END_XMLOBJECT;
289
290         BEGIN_XMLOBJECT(SAML_API,RequestedAttribute,saml2::Attribute,SAML 2.0 RequestedAttribute element);
291             DECL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,false);
292             /** RequestedAttributeType local name */
293             static const XMLCh TYPE_NAME[];
294         END_XMLOBJECT;
295
296         BEGIN_XMLOBJECT(SAML_API,AttributeConsumingService,xmltooling::XMLObject,SAML 2.0 AttributeConsumingService element);
297             DECL_INTEGER_ATTRIB(Index,INDEX);
298             DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
299             DECL_TYPED_CHILDREN(ServiceName);
300             DECL_TYPED_CHILDREN(ServiceDescription);
301             DECL_TYPED_CHILDREN(RequestedAttribute);
302             /** AttributeConsumingServiceType local name */
303             static const XMLCh TYPE_NAME[];
304         END_XMLOBJECT;
305
306         BEGIN_XMLOBJECT(SAML_API,AssertionConsumerService,IndexedEndpointType,SAML 2.0 AssertionConsumerService element);
307         END_XMLOBJECT;
308
309         BEGIN_XMLOBJECT(SAML_API,SPSSODescriptor,SSODescriptorType,SAML 2.0 SPSSODescriptor element);
310             DECL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,false);
311             DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
312             DECL_TYPED_CHILDREN(AssertionConsumerService);
313             DECL_TYPED_CHILDREN(AttributeConsumingService);
314             /** SPSSODescriptorType local name */
315             static const XMLCh TYPE_NAME[];
316             DECL_ELEMENT_QNAME;
317         END_XMLOBJECT;
318
319         BEGIN_XMLOBJECT(SAML_API,AuthnQueryService,EndpointType,SAML 2.0 AuthnQueryService element);
320         END_XMLOBJECT;
321
322         BEGIN_XMLOBJECT(SAML_API,AuthnAuthorityDescriptor,RoleDescriptor,SAML 2.0 AuthnAuthorityDescriptor element);
323             DECL_TYPED_CHILDREN(AuthnQueryService);
324             DECL_TYPED_CHILDREN(AssertionIDRequestService);
325             DECL_TYPED_CHILDREN(NameIDFormat);
326             /** AuthnAuthorityDescriptorType local name */
327             static const XMLCh TYPE_NAME[];
328             DECL_ELEMENT_QNAME;
329         END_XMLOBJECT;
330
331         BEGIN_XMLOBJECT(SAML_API,AuthzService,EndpointType,SAML 2.0 AuthzService element);
332         END_XMLOBJECT;
333
334         BEGIN_XMLOBJECT(SAML_API,PDPDescriptor,RoleDescriptor,SAML 2.0 PDPDescriptor element);
335             DECL_TYPED_CHILDREN(AuthzService);
336             DECL_TYPED_CHILDREN(AssertionIDRequestService);
337             DECL_TYPED_CHILDREN(NameIDFormat);
338             /** PDPDescriptorType local name */
339             static const XMLCh TYPE_NAME[];
340             DECL_ELEMENT_QNAME;
341         END_XMLOBJECT;
342
343         BEGIN_XMLOBJECT(SAML_API,AttributeService,EndpointType,SAML 2.0 AttributeService element);
344         END_XMLOBJECT;
345
346         BEGIN_XMLOBJECT(SAML_API,AttributeAuthorityDescriptor,RoleDescriptor,SAML 2.0 AttributeAuthorityDescriptor element);
347             DECL_TYPED_CHILDREN(AttributeService);
348             DECL_TYPED_CHILDREN(AssertionIDRequestService);
349             DECL_TYPED_CHILDREN(NameIDFormat);
350             DECL_TYPED_CHILDREN(AttributeProfile);
351             DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
352             /** AttributeAuthorityDescriptorType local name */
353             static const XMLCh TYPE_NAME[];
354             DECL_ELEMENT_QNAME;
355         END_XMLOBJECT;
356
357         BEGIN_XMLOBJECT(SAML_API,QueryDescriptorType,RoleDescriptor,SAML 2.0 QueryDescriptorType abstract type);
358             DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
359             DECL_TYPED_CHILDREN(NameIDFormat);
360             /** QueryDescriptorType local name */
361             static const XMLCh TYPE_NAME[];
362         END_XMLOBJECT;
363
364         BEGIN_XMLOBJECT(SAML_API,AuthnQueryDescriptorType,QueryDescriptorType,SAML 2.0 AuthnQueryDescriptorType extension type);
365             /** AuthnQueryDescriptorType local name */
366             static const XMLCh TYPE_NAME[];
367             DECL_TYPE_QNAME;
368         END_XMLOBJECT;
369
370         BEGIN_XMLOBJECT(SAML_API,AttributeQueryDescriptorType,QueryDescriptorType,SAML 2.0 AttributeQueryDescriptorType extension type);
371             DECL_TYPED_CHILDREN(AttributeConsumingService);
372             /** AttributeQueryDescriptorType local name */
373             static const XMLCh TYPE_NAME[];
374             DECL_TYPE_QNAME;
375         END_XMLOBJECT;
376
377         BEGIN_XMLOBJECT(SAML_API,AuthzDecisionQueryDescriptorType,QueryDescriptorType,SAML 2.0 AuthzDecisionQueryDescriptorType extension type);
378             DECL_TYPED_CHILDREN(ActionNamespace);
379             /** AuthzDecisionQueryDescriptorType local name */
380             static const XMLCh TYPE_NAME[];
381             DECL_TYPE_QNAME;
382         END_XMLOBJECT;
383
384         BEGIN_XMLOBJECT4(SAML_API,AffiliationDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
385                 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 AffiliationDescriptor element);
386             DECL_STRING_ATTRIB(ID,ID);
387             DECL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID);
388             DECL_TYPED_CHILD(Extensions);
389             DECL_TYPED_CHILDREN(AffiliateMember);
390             DECL_TYPED_CHILDREN(KeyDescriptor);
391             /** AffiliationDescriptorType local name */
392             static const XMLCh TYPE_NAME[];
393         END_XMLOBJECT;
394
395         BEGIN_XMLOBJECT4(SAML_API,EntityDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
396                 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 EntityDescriptor element);
397             DECL_STRING_ATTRIB(ID,ID);
398             DECL_STRING_ATTRIB(EntityID,ENTITYID);
399             DECL_TYPED_CHILD(Extensions);
400             DECL_TYPED_CHILD(AffiliationDescriptor);
401             DECL_TYPED_CHILDREN(RoleDescriptor);
402             DECL_TYPED_CHILDREN(IDPSSODescriptor);
403             DECL_TYPED_CHILDREN(SPSSODescriptor);
404             DECL_TYPED_CHILDREN(AuthnAuthorityDescriptor);
405             DECL_TYPED_CHILDREN(AttributeAuthorityDescriptor);
406             DECL_TYPED_CHILDREN(PDPDescriptor);
407             DECL_TYPED_CHILDREN(AuthnQueryDescriptorType);
408             DECL_TYPED_CHILDREN(AttributeQueryDescriptorType);
409             DECL_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType);
410             DECL_TYPED_CHILD(Organization);
411             DECL_TYPED_CHILDREN(ContactPerson);
412             DECL_TYPED_CHILDREN(AdditionalMetadataLocation);
413             /** Finds an arbitrary role type supporting a given protocol. */
414             virtual const RoleDescriptor* getRoleDescriptor(const xmltooling::QName& qname, const XMLCh* protocol) const=0;
415             /** EntityDescriptorType local name */
416             static const XMLCh TYPE_NAME[];
417         END_XMLOBJECT;
418
419         BEGIN_XMLOBJECT3(SAML_API,EntitiesDescriptor,SignableObject,CacheableSAMLObject,
420                 TimeBoundSAMLObject,SAML 2.0 EntitiesDescriptor element);
421             DECL_STRING_ATTRIB(ID,ID);
422             DECL_STRING_ATTRIB(Name,NAME);
423             DECL_TYPED_CHILD(Extensions);
424             DECL_TYPED_CHILDREN(EntityDescriptor);
425             DECL_TYPED_CHILDREN(EntitiesDescriptor);
426             /** EntitiesDescriptorType local name */
427             static const XMLCh TYPE_NAME[];
428         END_XMLOBJECT;
429
430         // Known Metadata Extensions
431
432         DECL_XMLOBJECT_SIMPLE(SAML_API,SourceID,ID,SAML 1.x Metadata Profile SourceID element);
433
434         BEGIN_XMLOBJECT(SAML_API,DiscoveryResponse,IndexedEndpointType,Identity Provider Discovery Protocol DiscoveryResponse element);
435         END_XMLOBJECT;
436
437         BEGIN_XMLOBJECT(SAML_API,RequestInitiator,EndpointType,Service Provider Request Initiation RequestInitiator element);
438         END_XMLOBJECT;
439
440         BEGIN_XMLOBJECT(SAML_API,EntityAttributes,xmltooling::XMLObject,SAML Metadata Extension for Entity Attributes element);
441             DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
442             DECL_TYPED_FOREIGN_CHILDREN(Assertion,saml2);
443             /** EntityAttributesType local name */
444             static const XMLCh TYPE_NAME[];
445         END_XMLOBJECT;
446
447         BEGIN_XMLOBJECT(SAML_API,DigestMethod,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Algorithm Support DigestMethod element);
448             DECL_STRING_ATTRIB(Algorithm,ALGORITHM);
449             /** DigestMethodType local name */
450             static const XMLCh TYPE_NAME[];
451         END_XMLOBJECT;
452
453         BEGIN_XMLOBJECT(SAML_API,SigningMethod,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Algorithm Support SigningMethod element);
454             DECL_STRING_ATTRIB(Algorithm,ALGORITHM);
455             DECL_INTEGER_ATTRIB(MinKeySize,MINKEYSIZE);
456             DECL_INTEGER_ATTRIB(MaxKeySize,MAXKEYSIZE);
457             /** SigningMethodType local name */
458             static const XMLCh TYPE_NAME[];
459         END_XMLOBJECT;
460
461         BEGIN_XMLOBJECT(SAML_API,DisplayName,localizedNameType,SAML Metadata Extension for Login UI DisplayName element);
462             DECL_SIMPLE_CONTENT(Name);
463         END_XMLOBJECT;
464
465         BEGIN_XMLOBJECT(SAML_API,Description,localizedNameType,SAML Metadata Extension for Login UI Description element);
466             DECL_SIMPLE_CONTENT(Description);
467         END_XMLOBJECT;
468
469         BEGIN_XMLOBJECT(SAML_API,Keywords,xmltooling::XMLObject,SAML Metadata Extension for Login UI Keywords element);
470             /** xml:lang attribute name. */
471             static const XMLCh LANG_ATTRIB_NAME[];
472
473             /**
474              * Sets the xml:lang attribute.
475              *
476              * @param Lang  the value to set
477              */
478             virtual void setLang(const XMLCh* Lang)=0;
479
480             DECL_SIMPLE_CONTENT(Values);
481             /** KeywordsType local name */
482             static const XMLCh TYPE_NAME[];
483         END_XMLOBJECT;
484
485         BEGIN_XMLOBJECT(SAML_API,Logo,xmltooling::XMLObject,SAML Metadata Extension for Login UI Logo element);
486             /** xml:lang attribute name. */
487             static const XMLCh LANG_ATTRIB_NAME[];
488
489             /**
490              * Sets the xml:lang attribute.
491              *
492              * @param Lang  the value to set
493              */
494             virtual void setLang(const XMLCh* Lang)=0;
495
496             DECL_INTEGER_ATTRIB(Height,HEIGHT);
497             DECL_INTEGER_ATTRIB(Width,WIDTH);
498             DECL_SIMPLE_CONTENT(URL);
499             /** LogoType local name */
500             static const XMLCh TYPE_NAME[];
501         END_XMLOBJECT;
502
503         BEGIN_XMLOBJECT(SAML_API,InformationURL,localizedURIType,SAML Metadata Extension for Login UI InformationURL element);
504             DECL_SIMPLE_CONTENT(URL);
505         END_XMLOBJECT;
506
507         BEGIN_XMLOBJECT(SAML_API,PrivacyStatementURL,localizedURIType,SAML Metadata Extension for Login UI PrivacyStatementURL element);
508             DECL_SIMPLE_CONTENT(URL);
509         END_XMLOBJECT;
510
511         BEGIN_XMLOBJECT(SAML_API,UIInfo,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Login UI UIInfo element);
512             DECL_TYPED_CHILDREN(DisplayName);
513             DECL_TYPED_CHILDREN(Description);
514                         DECL_TYPED_CHILDREN(Keywords);
515             DECL_TYPED_CHILDREN(Logo);
516             DECL_TYPED_CHILDREN(InformationURL);
517             DECL_TYPED_CHILDREN(PrivacyStatementURL);
518             /** UIInfoType local name */
519             static const XMLCh TYPE_NAME[];
520         END_XMLOBJECT;
521
522         DECL_XMLOBJECT_SIMPLE(SAML_API,IPHint,Hint,SAML Metadata Extension for Login UI IPHint element);
523         DECL_XMLOBJECT_SIMPLE(SAML_API,DomainHint,Hint,SAML Metadata Extension for Login UI DomainHint element);
524         DECL_XMLOBJECT_SIMPLE(SAML_API,GeolocationHint,Hint,SAML Metadata Extension for Login UI GeolocationHint element);
525
526         BEGIN_XMLOBJECT(SAML_API,DiscoHints,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Login UI DiscoHints element);
527             DECL_TYPED_CHILDREN(IPHint);
528             DECL_TYPED_CHILDREN(DomainHint);
529             DECL_TYPED_CHILDREN(GeolocationHint);
530             /** DiscoHintsType local name */
531             static const XMLCh TYPE_NAME[];
532         END_XMLOBJECT;
533
534         BEGIN_XMLOBJECT(SAML_API, RegistrationPolicy, localizedURIType, SAML Metadata Extension for RPI RegistrationPolicy element);
535             DECL_SIMPLE_CONTENT(URL);
536         END_XMLOBJECT;
537
538         BEGIN_XMLOBJECT(SAML_API,RegistrationInfo,xmltooling::ElementProxy,SAML Metadata Extension for RPI RegistrationInfo element);
539             DECL_STRING_ATTRIB(RegistrationAuthority,REGAUTHORITY);
540             DECL_DATETIME_ATTRIB(RegistrationInstant,REGINSTANT);
541             DECL_TYPED_CHILDREN(RegistrationPolicy);
542             /** RegistrationInfoType local name */
543             static const XMLCh TYPE_NAME[];
544         END_XMLOBJECT;
545
546         BEGIN_XMLOBJECT(SAML_API, UsagePolicy, localizedURIType, SAML Metadata Extension for RPI UsagePolicy element);
547             DECL_SIMPLE_CONTENT(URL);
548         END_XMLOBJECT;
549
550         /**
551          * Predicate to test a role for validity and protocol support.
552          */
553         class isValidForProtocol
554         {
555         public:
556             /**
557              * Constructor.
558              *
559              * @param protocol  support constant to test for
560              */
561             isValidForProtocol(const XMLCh* protocol) : m_time(time(nullptr)), m_protocol(protocol) {
562             }
563
564             /**
565              * Returns true iff the supplied role is valid now and supports the right protocol.
566              *
567              * @param role  role to test
568              * @return  result of predicate
569              */
570             bool operator()(const RoleDescriptor* role) const {
571                 return role ? (role->isValid(m_time) && role->hasSupport(m_protocol)) : false;
572             }
573
574         private:
575             time_t m_time;
576             const XMLCh* m_protocol;
577         };
578
579         /**
580          * Predicate to test a role for type equivalence, validity, and protocol support.
581          */
582         class ofTypeValidForProtocol : public isValidForProtocol, public xmltooling::hasSchemaType
583         {
584         public:
585             /**
586              * Constructor.
587              *
588              * @param q         schema type to test for
589              * @param protocol  support constant to test for
590              */
591             ofTypeValidForProtocol(const xmltooling::QName& q, const XMLCh* protocol)
592                 : isValidForProtocol(protocol), xmltooling::hasSchemaType(q)  {
593             }
594
595             /**
596              * Returns true iff the supplied role is of the right type, valid now, and supports the right protocol.
597              *
598              * @param role  role to test
599              * @return  result of predicate
600              */
601             bool operator()(const RoleDescriptor* role) const {
602                 return xmltooling::hasSchemaType::operator()(role) && isValidForProtocol::operator()(role);
603             }
604         };
605
606         DECL_SAML2MDOBJECTBUILDER(AdditionalMetadataLocation);
607         DECL_SAML2MDOBJECTBUILDER(AffiliateMember);
608         DECL_SAML2MDOBJECTBUILDER(AffiliationDescriptor);
609         DECL_SAML2MDOBJECTBUILDER(ArtifactResolutionService);
610         DECL_SAML2MDOBJECTBUILDER(AssertionConsumerService);
611         DECL_SAML2MDOBJECTBUILDER(AssertionIDRequestService);
612         DECL_SAML2MDOBJECTBUILDER(AttributeAuthorityDescriptor);
613         DECL_SAML2MDOBJECTBUILDER(AttributeConsumingService);
614         DECL_SAML2MDOBJECTBUILDER(AttributeProfile);
615         DECL_SAML2MDOBJECTBUILDER(AttributeService);
616         DECL_SAML2MDOBJECTBUILDER(AuthnAuthorityDescriptor);
617         DECL_SAML2MDOBJECTBUILDER(AuthnQueryService);
618         DECL_SAML2MDOBJECTBUILDER(AuthzService);
619         DECL_SAML2MDOBJECTBUILDER(Company);
620         DECL_SAML2MDOBJECTBUILDER(ContactPerson);
621         DECL_SAML2MDOBJECTBUILDER(EmailAddress);
622         DECL_SAML2MDOBJECTBUILDER(EntitiesDescriptor);
623         DECL_SAML2MDOBJECTBUILDER(EntityDescriptor);
624         DECL_SAML2MDOBJECTBUILDER(Extensions);
625         DECL_SAML2MDOBJECTBUILDER(GivenName);
626         DECL_SAML2MDOBJECTBUILDER(IDPSSODescriptor);
627         DECL_SAML2MDOBJECTBUILDER(KeyDescriptor);
628         DECL_SAML2MDOBJECTBUILDER(ManageNameIDService);
629         DECL_SAML2MDOBJECTBUILDER(NameIDFormat);
630         DECL_SAML2MDOBJECTBUILDER(NameIDMappingService);
631         DECL_SAML2MDOBJECTBUILDER(Organization);
632         DECL_SAML2MDOBJECTBUILDER(OrganizationName);
633         DECL_SAML2MDOBJECTBUILDER(OrganizationDisplayName);
634         DECL_SAML2MDOBJECTBUILDER(OrganizationURL);
635         DECL_SAML2MDOBJECTBUILDER(PDPDescriptor);
636         DECL_SAML2MDOBJECTBUILDER(RequestedAttribute);
637         DECL_SAML2MDOBJECTBUILDER(ServiceDescription);
638         DECL_SAML2MDOBJECTBUILDER(ServiceName);
639         DECL_SAML2MDOBJECTBUILDER(SingleLogoutService);
640         DECL_SAML2MDOBJECTBUILDER(SingleSignOnService);
641         DECL_SAML2MDOBJECTBUILDER(SPSSODescriptor);
642         DECL_SAML2MDOBJECTBUILDER(SurName);
643         DECL_SAML2MDOBJECTBUILDER(TelephoneNumber);
644
645         DECL_XMLOBJECTBUILDER(SAML_API,ActionNamespace,samlconstants::SAML20MD_QUERY_EXT_NS,samlconstants::SAML20MD_QUERY_EXT_PREFIX);
646         DECL_XMLOBJECTBUILDER(SAML_API,SourceID,samlconstants::SAML1MD_NS,samlconstants::SAML1MD_PREFIX);
647         DECL_XMLOBJECTBUILDER(SAML_API,DiscoveryResponse,samlconstants::IDP_DISCOVERY_PROTOCOL_NS,samlconstants::IDP_DISCOVERY_PROTOCOL_PREFIX);
648         DECL_XMLOBJECTBUILDER(SAML_API,RequestInitiator,samlconstants::SP_REQUEST_INIT_NS,samlconstants::SP_REQUEST_INIT_PREFIX);
649         DECL_XMLOBJECTBUILDER(SAML_API,EntityAttributes,samlconstants::SAML20MD_ENTITY_ATTRIBUTE_NS,samlconstants::SAML20MD_ENTITY_ATTRIBUTE_PREFIX);
650         DECL_XMLOBJECTBUILDER(SAML_API,DigestMethod,samlconstants::SAML20MD_ALGSUPPORT_NS,samlconstants::SAML20MD_ALGSUPPORT_PREFIX);
651         DECL_XMLOBJECTBUILDER(SAML_API,SigningMethod,samlconstants::SAML20MD_ALGSUPPORT_NS,samlconstants::SAML20MD_ALGSUPPORT_PREFIX);
652
653         DECL_XMLOBJECTBUILDER(SAML_API,UIInfo,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
654         DECL_XMLOBJECTBUILDER(SAML_API,DisplayName,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
655         DECL_XMLOBJECTBUILDER(SAML_API,Description,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
656                 DECL_XMLOBJECTBUILDER(SAML_API,Keywords,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
657         DECL_XMLOBJECTBUILDER(SAML_API,Logo,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
658         DECL_XMLOBJECTBUILDER(SAML_API,InformationURL,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
659         DECL_XMLOBJECTBUILDER(SAML_API,PrivacyStatementURL,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
660         DECL_XMLOBJECTBUILDER(SAML_API,DiscoHints,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
661         DECL_XMLOBJECTBUILDER(SAML_API,IPHint,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
662         DECL_XMLOBJECTBUILDER(SAML_API,DomainHint,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
663         DECL_XMLOBJECTBUILDER(SAML_API,GeolocationHint,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
664
665         DECL_XMLOBJECTBUILDER(SAML_API, RegistrationInfo, samlconstants::SAML20MD_RPI_NS, samlconstants::SAML20MD_RPI_PREFIX);
666         DECL_XMLOBJECTBUILDER(SAML_API, RegistrationPolicy, samlconstants::SAML20MD_RPI_NS, samlconstants::SAML20MD_RPI_PREFIX);
667         DECL_XMLOBJECTBUILDER(SAML_API, UsagePolicy, samlconstants::SAML20MD_RPI_NS, samlconstants::SAML20MD_RPI_PREFIX);
668
669         /**
670          * Builder for localizedNameType objects.
671          *
672          * This is customized to force the element name to be specified.
673          */
674         class SAML_API localizedNameTypeBuilder : public xmltooling::XMLObjectBuilder {
675         public:
676             virtual ~localizedNameTypeBuilder() {}
677             /** Builder that allows element/type override. */
678 #ifdef HAVE_COVARIANT_RETURNS
679             virtual localizedNameType* buildObject(
680 #else
681             virtual xmltooling::XMLObject* buildObject(
682 #endif
683                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
684                 ) const;
685
686             /** Singleton builder. */
687             static localizedNameType* buildlocalizedNameType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
688                 const localizedNameTypeBuilder* b = dynamic_cast<const localizedNameTypeBuilder*>(
689                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME))
690                     );
691                 if (b) {
692                     xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
693 #ifdef HAVE_COVARIANT_RETURNS
694                     return b->buildObject(nsURI, localName, prefix, &schemaType);
695 #else
696                     return dynamic_cast<localizedNameType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
697 #endif
698                 }
699                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedNameType.");
700             }
701         };
702
703         /**
704          * Builder for localizedURIType objects.
705          *
706          * This is customized to force the element name to be specified.
707          */
708         class SAML_API localizedURITypeBuilder : public xmltooling::XMLObjectBuilder {
709         public:
710             virtual ~localizedURITypeBuilder() {}
711             /** Builder that allows element/type override. */
712 #ifdef HAVE_COVARIANT_RETURNS
713             virtual localizedURIType* buildObject(
714 #else
715             virtual xmltooling::XMLObject* buildObject(
716 #endif
717                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
718                 ) const;
719
720             /** Singleton builder. */
721             static localizedURIType* buildlocalizedURIType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
722                 const localizedURITypeBuilder* b = dynamic_cast<const localizedURITypeBuilder*>(
723                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME))
724                     );
725                 if (b) {
726                     xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
727 #ifdef HAVE_COVARIANT_RETURNS
728                     return b->buildObject(nsURI, localName, prefix, &schemaType);
729 #else
730                     return dynamic_cast<localizedURIType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
731 #endif
732                 }
733                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedURIType.");
734             }
735         };
736
737         /**
738          * Builder for EndpointType objects.
739          *
740          * This is customized to force the element name to be specified.
741          */
742         class SAML_API EndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
743         public:
744             virtual ~EndpointTypeBuilder() {}
745             /** Builder that allows element/type override. */
746 #ifdef HAVE_COVARIANT_RETURNS
747             virtual EndpointType* buildObject(
748 #else
749             virtual xmltooling::XMLObject* buildObject(
750 #endif
751                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
752                 ) const;
753
754             /** Singleton builder. */
755             static EndpointType* buildEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
756                 const EndpointTypeBuilder* b = dynamic_cast<const EndpointTypeBuilder*>(
757                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME))
758                     );
759                 if (b) {
760                     xmltooling::QName schemaType(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
761 #ifdef HAVE_COVARIANT_RETURNS
762                     return b->buildObject(nsURI, localName, prefix, &schemaType);
763 #else
764                     return dynamic_cast<EndpointType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
765 #endif
766                 }
767                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for EndpointType.");
768             }
769         };
770
771         /**
772          * Builder for IndexedEndpointType objects.
773          *
774          * This is customized to force the element name to be specified.
775          */
776         class SAML_API IndexedEndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
777         public:
778             virtual ~IndexedEndpointTypeBuilder() {}
779             /** Builder that allows element/type override. */
780 #ifdef HAVE_COVARIANT_RETURNS
781             virtual IndexedEndpointType* buildObject(
782 #else
783             virtual xmltooling::XMLObject* buildObject(
784 #endif
785                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
786                 ) const;
787
788             /** Singleton builder. */
789             static IndexedEndpointType* buildIndexedEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
790                 const IndexedEndpointTypeBuilder* b = dynamic_cast<const IndexedEndpointTypeBuilder*>(
791                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME))
792                     );
793                 if (b) {
794                     xmltooling::QName schemaType(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
795 #ifdef HAVE_COVARIANT_RETURNS
796                     return b->buildObject(nsURI, localName, prefix, &schemaType);
797 #else
798                     return dynamic_cast<IndexedEndpointType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
799 #endif
800                 }
801                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for IndexedEndpointType.");
802             }
803         };
804
805         /**
806          * Builder for RoleDescriptor extension objects.
807          *
808          * This is customized to force the schema type to be specified.
809          */
810         class SAML_API RoleDescriptorBuilder : public xmltooling::XMLObjectBuilder {
811         public:
812             virtual ~RoleDescriptorBuilder() {}
813             /** Builder that allows element/type override. */
814 #ifdef HAVE_COVARIANT_RETURNS
815             virtual RoleDescriptor* buildObject(
816 #else
817             virtual xmltooling::XMLObject* buildObject(
818 #endif
819                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
820                 ) const;
821
822             /** Singleton builder. */
823             static RoleDescriptor* buildRoleDescriptor(const xmltooling::QName& schemaType) {
824                 const RoleDescriptorBuilder* b = dynamic_cast<const RoleDescriptorBuilder*>(
825                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,RoleDescriptor::LOCAL_NAME))
826                     );
827                 if (b) {
828 #ifdef HAVE_COVARIANT_RETURNS
829                     return b->buildObject(samlconstants::SAML20MD_NS, RoleDescriptor::LOCAL_NAME, samlconstants::SAML20MD_PREFIX, &schemaType);
830 #else
831                     return dynamic_cast<RoleDescriptor*>(b->buildObject(samlconstants::SAML20MD_NS, RoleDescriptor::LOCAL_NAME, samlconstants::SAML20MD_PREFIX, &schemaType));
832 #endif
833                 }
834                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for RoleDescriptor.");
835             }
836         };
837
838         /**
839          * Builder for AuthnQueryDescriptorType objects.
840          *
841          * This is customized to return a RoleDescriptor element with an
842          * xsi:type of AuthnQueryDescriptorType.
843          */
844         class SAML_API AuthnQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
845         public:
846             virtual ~AuthnQueryDescriptorTypeBuilder() {}
847             /** Default builder. */
848 #ifdef HAVE_COVARIANT_RETURNS
849             virtual AuthnQueryDescriptorType* buildObject() const {
850 #else
851             virtual xmltooling::XMLObject* buildObject() const {
852 #endif
853                 xmltooling::QName schemaType(
854                     samlconstants::SAML20MD_QUERY_EXT_NS,AuthnQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
855                     );
856                 return buildObject(
857                     samlconstants::SAML20MD_NS,AuthnQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
858                     );
859             }
860             /** Builder that allows element/type override. */
861 #ifdef HAVE_COVARIANT_RETURNS
862             virtual AuthnQueryDescriptorType* buildObject(
863 #else
864             virtual xmltooling::XMLObject* buildObject(
865 #endif
866                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
867                 ) const;
868
869             /** Singleton builder. */
870             static AuthnQueryDescriptorType* buildAuthnQueryDescriptorType() {
871                 const AuthnQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthnQueryDescriptorTypeBuilder*>(
872                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthnQueryDescriptorType::TYPE_NAME))
873                     );
874                 if (b) {
875 #ifdef HAVE_COVARIANT_RETURNS
876                     return b->buildObject();
877 #else
878                     return dynamic_cast<AuthnQueryDescriptorType*>(b->buildObject());
879 #endif
880                 }
881                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthnQueryDescriptorType.");
882             }
883         };
884
885         /**
886          * Builder for AttributeQueryDescriptorType objects.
887          *
888          * This is customized to return a RoleDescriptor element with an
889          * xsi:type of AttributeQueryDescriptorType.
890          */
891         class SAML_API AttributeQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
892         public:
893             virtual ~AttributeQueryDescriptorTypeBuilder() {}
894             /** Default builder. */
895 #ifdef HAVE_COVARIANT_RETURNS
896             virtual AttributeQueryDescriptorType* buildObject() const {
897 #else
898             virtual xmltooling::XMLObject* buildObject() const {
899 #endif
900                 xmltooling::QName schemaType(
901                     samlconstants::SAML20MD_QUERY_EXT_NS,AttributeQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
902                     );
903                 return buildObject(
904                     samlconstants::SAML20MD_NS,AttributeQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
905                     );
906             }
907             /** Builder that allows element/type override. */
908 #ifdef HAVE_COVARIANT_RETURNS
909             virtual AttributeQueryDescriptorType* buildObject(
910 #else
911             virtual xmltooling::XMLObject* buildObject(
912 #endif
913                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
914                 ) const;
915
916             /** Singleton builder. */
917             static AttributeQueryDescriptorType* buildAttributeQueryDescriptorType() {
918                 const AttributeQueryDescriptorTypeBuilder* b = dynamic_cast<const AttributeQueryDescriptorTypeBuilder*>(
919                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AttributeQueryDescriptorType::TYPE_NAME))
920                     );
921                 if (b) {
922 #ifdef HAVE_COVARIANT_RETURNS
923                     return b->buildObject();
924 #else
925                     return dynamic_cast<AttributeQueryDescriptorType*>(b->buildObject());
926 #endif
927                 }
928                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AttributeQueryDescriptorType.");
929             }
930         };
931
932         /**
933          * Builder for AuthzDecisionQueryDescriptorType objects.
934          *
935          * This is customized to return a RoleDescriptor element with an
936          * xsi:type of AuthzDecisionQueryDescriptorType.
937          */
938         class SAML_API AuthzDecisionQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
939         public:
940             virtual ~AuthzDecisionQueryDescriptorTypeBuilder() {}
941             /** Default builder. */
942 #ifdef HAVE_COVARIANT_RETURNS
943             virtual AuthzDecisionQueryDescriptorType* buildObject() const {
944 #else
945             virtual xmltooling::XMLObject* buildObject() const {
946 #endif
947                 xmltooling::QName schemaType(
948                     samlconstants::SAML20MD_QUERY_EXT_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
949                     );
950                 return buildObject(
951                     samlconstants::SAML20MD_NS,AuthzDecisionQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
952                     );
953             }
954             /** Builder that allows element/type override. */
955 #ifdef HAVE_COVARIANT_RETURNS
956             virtual AuthzDecisionQueryDescriptorType* buildObject(
957 #else
958             virtual xmltooling::XMLObject* buildObject(
959 #endif
960                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
961                 ) const;
962
963             /** Singleton builder. */
964             static AuthzDecisionQueryDescriptorType* buildAuthzDecisionQueryDescriptorType() {
965                 const AuthzDecisionQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthzDecisionQueryDescriptorTypeBuilder*>(
966                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME))
967                     );
968                 if (b) {
969 #ifdef HAVE_COVARIANT_RETURNS
970                     return b->buildObject();
971 #else
972                     return dynamic_cast<AuthzDecisionQueryDescriptorType*>(b->buildObject());
973 #endif
974                 }
975                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthzDecisionQueryDescriptorType.");
976             }
977         };
978
979         /**
980          * Registers builders and validators for SAML 2.0 Metadata classes into the runtime.
981          */
982         void SAML_API registerMetadataClasses();
983     };
984 };
985
986 #endif /* __saml2_metadata_h__ */