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