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