Add schemas, metadata extension code for discovery and request initiator endpoints.
[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,DiscoveryResponse,IndexedEndpointType,Identity Provider Discovery Protocol DiscoveryResponse element);
409         END_XMLOBJECT;
410
411         BEGIN_XMLOBJECT(SAML_API,RequestInitiator,EndpointType,Service Provider Request Initiation RequestInitiator element);
412         END_XMLOBJECT;
413
414         BEGIN_XMLOBJECT(SAML_API,EntityAttributes,xmltooling::XMLObject,SAML Metadata Extension for Entity Attributes element);
415             DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
416             DECL_TYPED_FOREIGN_CHILDREN(Assertion,saml2);
417             /** EntityAttributesType local name */
418             static const XMLCh TYPE_NAME[];
419         END_XMLOBJECT;
420
421         BEGIN_XMLOBJECT(SAML_API,DigestMethod,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Algorithm Support DigestMethod element);
422             DECL_STRING_ATTRIB(Algorithm,ALGORITHM);
423             /** DigestMethodType local name */
424             static const XMLCh TYPE_NAME[];
425         END_XMLOBJECT;
426
427         BEGIN_XMLOBJECT(SAML_API,SigningMethod,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Algorithm Support SigningMethod element);
428             DECL_STRING_ATTRIB(Algorithm,ALGORITHM);
429             DECL_INTEGER_ATTRIB(MinKeySize,MINKEYSIZE);
430             DECL_INTEGER_ATTRIB(MaxKeySize,MAXKEYSIZE);
431             /** SigningMethodType local name */
432             static const XMLCh TYPE_NAME[];
433         END_XMLOBJECT;
434
435         BEGIN_XMLOBJECT(SAML_API,DisplayName,localizedNameType,SAML Metadata Extension for Login UI DisplayName element);
436             DECL_SIMPLE_CONTENT(Name);
437         END_XMLOBJECT;
438
439         BEGIN_XMLOBJECT(SAML_API,Description,localizedNameType,SAML Metadata Extension for Login UI Description element);
440             DECL_SIMPLE_CONTENT(Description);
441         END_XMLOBJECT;
442
443         BEGIN_XMLOBJECT(SAML_API,Logo,xmltooling::XMLObject,SAML Metadata Extension for Login UI Logo element);
444             DECL_STRING_ATTRIB(Lang,LANG);
445             DECL_INTEGER_ATTRIB(Height,HEIGHT);
446             DECL_INTEGER_ATTRIB(Width,WIDTH);
447             DECL_SIMPLE_CONTENT(URL);
448             /** LogoType local name */
449             static const XMLCh TYPE_NAME[];
450         END_XMLOBJECT;
451
452         BEGIN_XMLOBJECT(SAML_API,InformationURL,localizedURIType,SAML Metadata Extension for Login UI InformationURL element);
453             DECL_SIMPLE_CONTENT(URL);
454         END_XMLOBJECT;
455
456         BEGIN_XMLOBJECT(SAML_API,PrivacyStatementURL,localizedURIType,SAML Metadata Extension for Login UI PrivacyStatementURL element);
457             DECL_SIMPLE_CONTENT(URL);
458         END_XMLOBJECT;
459
460         BEGIN_XMLOBJECT(SAML_API,UIInfo,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Login UI UIInfo element);
461             DECL_TYPED_CHILDREN(DisplayName);
462             DECL_TYPED_CHILDREN(Description);
463             DECL_TYPED_CHILDREN(Logo);
464             DECL_TYPED_CHILDREN(InformationURL);
465             DECL_TYPED_CHILDREN(PrivacyStatementURL);
466             /** UIInfoType local name */
467             static const XMLCh TYPE_NAME[];
468         END_XMLOBJECT;
469
470         DECL_XMLOBJECT_SIMPLE(SAML_API,IPHint,Hint,SAML Metadata Extension for Login UI IPHint element);
471         DECL_XMLOBJECT_SIMPLE(SAML_API,DomainHint,Hint,SAML Metadata Extension for Login UI DomainHint element);
472         DECL_XMLOBJECT_SIMPLE(SAML_API,GeolocationHint,Hint,SAML Metadata Extension for Login UI GeolocationHint element);
473
474         BEGIN_XMLOBJECT(SAML_API,DiscoHints,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Login UI DiscoHints element);
475             DECL_TYPED_CHILDREN(IPHint);
476             DECL_TYPED_CHILDREN(DomainHint);
477             DECL_TYPED_CHILDREN(GeolocationHint);
478             /** DiscoHintsType local name */
479             static const XMLCh TYPE_NAME[];
480         END_XMLOBJECT;
481
482         /**
483          * Predicate to test a role for validity and protocol support.
484          */
485         class isValidForProtocol
486         {
487         public:
488             /**
489              * Constructor.
490              *
491              * @param protocol  support constant to test for
492              */
493             isValidForProtocol(const XMLCh* protocol) : m_time(time(nullptr)), m_protocol(protocol) {
494             }
495
496             /**
497              * Returns true iff the supplied role is valid now and supports the right protocol.
498              *
499              * @param role  role to test
500              * @return  result of predicate
501              */
502             bool operator()(const RoleDescriptor* role) const {
503                 return role ? (role->isValid(m_time) && role->hasSupport(m_protocol)) : false;
504             }
505
506         private:
507             time_t m_time;
508             const XMLCh* m_protocol;
509         };
510
511         /**
512          * Predicate to test a role for type equivalence, validity, and protocol support.
513          */
514         class ofTypeValidForProtocol : public isValidForProtocol, public xmltooling::hasSchemaType
515         {
516         public:
517             /**
518              * Constructor.
519              *
520              * @param q         schema type to test for
521              * @param protocol  support constant to test for
522              */
523             ofTypeValidForProtocol(const xmltooling::QName& q, const XMLCh* protocol)
524                 : isValidForProtocol(protocol), xmltooling::hasSchemaType(q)  {
525             }
526
527             /**
528              * Returns true iff the supplied role is of the right type, valid now, and supports the right protocol.
529              *
530              * @param role  role to test
531              * @return  result of predicate
532              */
533             bool operator()(const RoleDescriptor* role) const {
534                 return xmltooling::hasSchemaType::operator()(role) && isValidForProtocol::operator()(role);
535             }
536         };
537
538         DECL_SAML2MDOBJECTBUILDER(AdditionalMetadataLocation);
539         DECL_SAML2MDOBJECTBUILDER(AffiliateMember);
540         DECL_SAML2MDOBJECTBUILDER(AffiliationDescriptor);
541         DECL_SAML2MDOBJECTBUILDER(ArtifactResolutionService);
542         DECL_SAML2MDOBJECTBUILDER(AssertionConsumerService);
543         DECL_SAML2MDOBJECTBUILDER(AssertionIDRequestService);
544         DECL_SAML2MDOBJECTBUILDER(AttributeAuthorityDescriptor);
545         DECL_SAML2MDOBJECTBUILDER(AttributeConsumingService);
546         DECL_SAML2MDOBJECTBUILDER(AttributeProfile);
547         DECL_SAML2MDOBJECTBUILDER(AttributeService);
548         DECL_SAML2MDOBJECTBUILDER(AuthnAuthorityDescriptor);
549         DECL_SAML2MDOBJECTBUILDER(AuthnQueryService);
550         DECL_SAML2MDOBJECTBUILDER(AuthzService);
551         DECL_SAML2MDOBJECTBUILDER(Company);
552         DECL_SAML2MDOBJECTBUILDER(ContactPerson);
553         DECL_SAML2MDOBJECTBUILDER(EmailAddress);
554         DECL_SAML2MDOBJECTBUILDER(EntitiesDescriptor);
555         DECL_SAML2MDOBJECTBUILDER(EntityDescriptor);
556         DECL_SAML2MDOBJECTBUILDER(Extensions);
557         DECL_SAML2MDOBJECTBUILDER(GivenName);
558         DECL_SAML2MDOBJECTBUILDER(IDPSSODescriptor);
559         DECL_SAML2MDOBJECTBUILDER(KeyDescriptor);
560         DECL_SAML2MDOBJECTBUILDER(ManageNameIDService);
561         DECL_SAML2MDOBJECTBUILDER(NameIDFormat);
562         DECL_SAML2MDOBJECTBUILDER(NameIDMappingService);
563         DECL_SAML2MDOBJECTBUILDER(Organization);
564         DECL_SAML2MDOBJECTBUILDER(OrganizationName);
565         DECL_SAML2MDOBJECTBUILDER(OrganizationDisplayName);
566         DECL_SAML2MDOBJECTBUILDER(OrganizationURL);
567         DECL_SAML2MDOBJECTBUILDER(PDPDescriptor);
568         DECL_SAML2MDOBJECTBUILDER(RequestedAttribute);
569         DECL_SAML2MDOBJECTBUILDER(ServiceDescription);
570         DECL_SAML2MDOBJECTBUILDER(ServiceName);
571         DECL_SAML2MDOBJECTBUILDER(SingleLogoutService);
572         DECL_SAML2MDOBJECTBUILDER(SingleSignOnService);
573         DECL_SAML2MDOBJECTBUILDER(SPSSODescriptor);
574         DECL_SAML2MDOBJECTBUILDER(SurName);
575         DECL_SAML2MDOBJECTBUILDER(TelephoneNumber);
576
577         DECL_XMLOBJECTBUILDER(SAML_API,ActionNamespace,samlconstants::SAML20MD_QUERY_EXT_NS,samlconstants::SAML20MD_QUERY_EXT_PREFIX);
578         DECL_XMLOBJECTBUILDER(SAML_API,SourceID,samlconstants::SAML1MD_NS,samlconstants::SAML1MD_PREFIX);
579         DECL_XMLOBJECTBUILDER(SAML_API,DiscoveryResponse,samlconstants::SP_REQUEST_INIT_NS,samlconstants::SP_REQUEST_INIT_PREFIX);
580         DECL_XMLOBJECTBUILDER(SAML_API,RequestInitiator,samlconstants::IDP_DISCOVERY_PROTOCOL_NS,samlconstants::IDP_DISCOVERY_PROTOCOL_PREFIX);
581         DECL_XMLOBJECTBUILDER(SAML_API,EntityAttributes,samlconstants::SAML20MD_ENTITY_ATTRIBUTE_NS,samlconstants::SAML20MD_ENTITY_ATTRIBUTE_PREFIX);
582         DECL_XMLOBJECTBUILDER(SAML_API,DigestMethod,samlconstants::SAML20MD_ALGSUPPORT_NS,samlconstants::SAML20MD_ALGSUPPORT_PREFIX);
583         DECL_XMLOBJECTBUILDER(SAML_API,SigningMethod,samlconstants::SAML20MD_ALGSUPPORT_NS,samlconstants::SAML20MD_ALGSUPPORT_PREFIX);
584
585         DECL_XMLOBJECTBUILDER(SAML_API,UIInfo,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
586         DECL_XMLOBJECTBUILDER(SAML_API,DisplayName,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
587         DECL_XMLOBJECTBUILDER(SAML_API,Description,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
588         DECL_XMLOBJECTBUILDER(SAML_API,Logo,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
589         DECL_XMLOBJECTBUILDER(SAML_API,InformationURL,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
590         DECL_XMLOBJECTBUILDER(SAML_API,PrivacyStatementURL,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
591         DECL_XMLOBJECTBUILDER(SAML_API,DiscoHints,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
592         DECL_XMLOBJECTBUILDER(SAML_API,IPHint,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
593         DECL_XMLOBJECTBUILDER(SAML_API,DomainHint,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
594         DECL_XMLOBJECTBUILDER(SAML_API,GeolocationHint,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
595
596         /**
597          * Builder for localizedNameType objects.
598          *
599          * This is customized to force the element name to be specified.
600          */
601         class SAML_API localizedNameTypeBuilder : public xmltooling::XMLObjectBuilder {
602         public:
603             virtual ~localizedNameTypeBuilder() {}
604             /** Builder that allows element/type override. */
605 #ifdef HAVE_COVARIANT_RETURNS
606             virtual localizedNameType* buildObject(
607 #else
608             virtual xmltooling::XMLObject* buildObject(
609 #endif
610                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
611                 ) const;
612
613             /** Singleton builder. */
614             static localizedNameType* buildlocalizedNameType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
615                 const localizedNameTypeBuilder* b = dynamic_cast<const localizedNameTypeBuilder*>(
616                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME))
617                     );
618                 if (b) {
619                     xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
620 #ifdef HAVE_COVARIANT_RETURNS
621                     return b->buildObject(nsURI, localName, prefix, &schemaType);
622 #else
623                     return dynamic_cast<localizedNameType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
624 #endif
625                 }
626                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedNameType.");
627             }
628         };
629
630         /**
631          * Builder for localizedURIType objects.
632          *
633          * This is customized to force the element name to be specified.
634          */
635         class SAML_API localizedURITypeBuilder : public xmltooling::XMLObjectBuilder {
636         public:
637             virtual ~localizedURITypeBuilder() {}
638             /** Builder that allows element/type override. */
639 #ifdef HAVE_COVARIANT_RETURNS
640             virtual localizedURIType* buildObject(
641 #else
642             virtual xmltooling::XMLObject* buildObject(
643 #endif
644                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
645                 ) const;
646
647             /** Singleton builder. */
648             static localizedURIType* buildlocalizedURIType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
649                 const localizedURITypeBuilder* b = dynamic_cast<const localizedURITypeBuilder*>(
650                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME))
651                     );
652                 if (b) {
653                     xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
654 #ifdef HAVE_COVARIANT_RETURNS
655                     return b->buildObject(nsURI, localName, prefix, &schemaType);
656 #else
657                     return dynamic_cast<localizedURIType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
658 #endif
659                 }
660                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedURIType.");
661             }
662         };
663
664         /**
665          * Builder for EndpointType objects.
666          *
667          * This is customized to force the element name to be specified.
668          */
669         class SAML_API EndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
670         public:
671             virtual ~EndpointTypeBuilder() {}
672             /** Builder that allows element/type override. */
673 #ifdef HAVE_COVARIANT_RETURNS
674             virtual EndpointType* buildObject(
675 #else
676             virtual xmltooling::XMLObject* buildObject(
677 #endif
678                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
679                 ) const;
680
681             /** Singleton builder. */
682             static EndpointType* buildEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
683                 const EndpointTypeBuilder* b = dynamic_cast<const EndpointTypeBuilder*>(
684                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME))
685                     );
686                 if (b) {
687                     xmltooling::QName schemaType(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
688 #ifdef HAVE_COVARIANT_RETURNS
689                     return b->buildObject(nsURI, localName, prefix, &schemaType);
690 #else
691                     return dynamic_cast<EndpointType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
692 #endif
693                 }
694                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for EndpointType.");
695             }
696         };
697
698         /**
699          * Builder for IndexedEndpointType objects.
700          *
701          * This is customized to force the element name to be specified.
702          */
703         class SAML_API IndexedEndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
704         public:
705             virtual ~IndexedEndpointTypeBuilder() {}
706             /** Builder that allows element/type override. */
707 #ifdef HAVE_COVARIANT_RETURNS
708             virtual IndexedEndpointType* buildObject(
709 #else
710             virtual xmltooling::XMLObject* buildObject(
711 #endif
712                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
713                 ) const;
714
715             /** Singleton builder. */
716             static IndexedEndpointType* buildIndexedEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
717                 const IndexedEndpointTypeBuilder* b = dynamic_cast<const IndexedEndpointTypeBuilder*>(
718                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME))
719                     );
720                 if (b) {
721                     xmltooling::QName schemaType(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
722 #ifdef HAVE_COVARIANT_RETURNS
723                     return b->buildObject(nsURI, localName, prefix, &schemaType);
724 #else
725                     return dynamic_cast<IndexedEndpointType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
726 #endif
727                 }
728                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for IndexedEndpointType.");
729             }
730         };
731
732         /**
733          * Builder for RoleDescriptor extension objects.
734          *
735          * This is customized to force the schema type to be specified.
736          */
737         class SAML_API RoleDescriptorBuilder : public xmltooling::XMLObjectBuilder {
738         public:
739             virtual ~RoleDescriptorBuilder() {}
740             /** Builder that allows element/type override. */
741 #ifdef HAVE_COVARIANT_RETURNS
742             virtual RoleDescriptor* buildObject(
743 #else
744             virtual xmltooling::XMLObject* buildObject(
745 #endif
746                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
747                 ) const;
748
749             /** Singleton builder. */
750             static RoleDescriptor* buildRoleDescriptor(const xmltooling::QName& schemaType) {
751                 const RoleDescriptorBuilder* b = dynamic_cast<const RoleDescriptorBuilder*>(
752                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,RoleDescriptor::LOCAL_NAME))
753                     );
754                 if (b) {
755 #ifdef HAVE_COVARIANT_RETURNS
756                     return b->buildObject(samlconstants::SAML20MD_NS, RoleDescriptor::LOCAL_NAME, samlconstants::SAML20MD_PREFIX, &schemaType);
757 #else
758                     return dynamic_cast<RoleDescriptor*>(b->buildObject(samlconstants::SAML20MD_NS, RoleDescriptor::LOCAL_NAME, samlconstants::SAML20MD_PREFIX, &schemaType));
759 #endif
760                 }
761                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for RoleDescriptor.");
762             }
763         };
764
765         /**
766          * Builder for AuthnQueryDescriptorType objects.
767          *
768          * This is customized to return a RoleDescriptor element with an
769          * xsi:type of AuthnQueryDescriptorType.
770          */
771         class SAML_API AuthnQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
772         public:
773             virtual ~AuthnQueryDescriptorTypeBuilder() {}
774             /** Default builder. */
775 #ifdef HAVE_COVARIANT_RETURNS
776             virtual AuthnQueryDescriptorType* buildObject() const {
777 #else
778             virtual xmltooling::XMLObject* buildObject() const {
779 #endif
780                 xmltooling::QName schemaType(
781                     samlconstants::SAML20MD_QUERY_EXT_NS,AuthnQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
782                     );
783                 return buildObject(
784                     samlconstants::SAML20MD_NS,AuthnQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
785                     );
786             }
787             /** Builder that allows element/type override. */
788 #ifdef HAVE_COVARIANT_RETURNS
789             virtual AuthnQueryDescriptorType* buildObject(
790 #else
791             virtual xmltooling::XMLObject* buildObject(
792 #endif
793                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
794                 ) const;
795
796             /** Singleton builder. */
797             static AuthnQueryDescriptorType* buildAuthnQueryDescriptorType() {
798                 const AuthnQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthnQueryDescriptorTypeBuilder*>(
799                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthnQueryDescriptorType::TYPE_NAME))
800                     );
801                 if (b) {
802 #ifdef HAVE_COVARIANT_RETURNS
803                     return b->buildObject();
804 #else
805                     return dynamic_cast<AuthnQueryDescriptorType*>(b->buildObject());
806 #endif
807                 }
808                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthnQueryDescriptorType.");
809             }
810         };
811
812         /**
813          * Builder for AttributeQueryDescriptorType objects.
814          *
815          * This is customized to return a RoleDescriptor element with an
816          * xsi:type of AttributeQueryDescriptorType.
817          */
818         class SAML_API AttributeQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
819         public:
820             virtual ~AttributeQueryDescriptorTypeBuilder() {}
821             /** Default builder. */
822 #ifdef HAVE_COVARIANT_RETURNS
823             virtual AttributeQueryDescriptorType* buildObject() const {
824 #else
825             virtual xmltooling::XMLObject* buildObject() const {
826 #endif
827                 xmltooling::QName schemaType(
828                     samlconstants::SAML20MD_QUERY_EXT_NS,AttributeQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
829                     );
830                 return buildObject(
831                     samlconstants::SAML20MD_NS,AttributeQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
832                     );
833             }
834             /** Builder that allows element/type override. */
835 #ifdef HAVE_COVARIANT_RETURNS
836             virtual AttributeQueryDescriptorType* buildObject(
837 #else
838             virtual xmltooling::XMLObject* buildObject(
839 #endif
840                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
841                 ) const;
842
843             /** Singleton builder. */
844             static AttributeQueryDescriptorType* buildAttributeQueryDescriptorType() {
845                 const AttributeQueryDescriptorTypeBuilder* b = dynamic_cast<const AttributeQueryDescriptorTypeBuilder*>(
846                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AttributeQueryDescriptorType::TYPE_NAME))
847                     );
848                 if (b) {
849 #ifdef HAVE_COVARIANT_RETURNS
850                     return b->buildObject();
851 #else
852                     return dynamic_cast<AttributeQueryDescriptorType*>(b->buildObject());
853 #endif
854                 }
855                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AttributeQueryDescriptorType.");
856             }
857         };
858
859         /**
860          * Builder for AuthzDecisionQueryDescriptorType objects.
861          *
862          * This is customized to return a RoleDescriptor element with an
863          * xsi:type of AuthzDecisionQueryDescriptorType.
864          */
865         class SAML_API AuthzDecisionQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
866         public:
867             virtual ~AuthzDecisionQueryDescriptorTypeBuilder() {}
868             /** Default builder. */
869 #ifdef HAVE_COVARIANT_RETURNS
870             virtual AuthzDecisionQueryDescriptorType* buildObject() const {
871 #else
872             virtual xmltooling::XMLObject* buildObject() const {
873 #endif
874                 xmltooling::QName schemaType(
875                     samlconstants::SAML20MD_QUERY_EXT_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
876                     );
877                 return buildObject(
878                     samlconstants::SAML20MD_NS,AuthzDecisionQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
879                     );
880             }
881             /** Builder that allows element/type override. */
882 #ifdef HAVE_COVARIANT_RETURNS
883             virtual AuthzDecisionQueryDescriptorType* buildObject(
884 #else
885             virtual xmltooling::XMLObject* buildObject(
886 #endif
887                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
888                 ) const;
889
890             /** Singleton builder. */
891             static AuthzDecisionQueryDescriptorType* buildAuthzDecisionQueryDescriptorType() {
892                 const AuthzDecisionQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthzDecisionQueryDescriptorTypeBuilder*>(
893                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME))
894                     );
895                 if (b) {
896 #ifdef HAVE_COVARIANT_RETURNS
897                     return b->buildObject();
898 #else
899                     return dynamic_cast<AuthzDecisionQueryDescriptorType*>(b->buildObject());
900 #endif
901                 }
902                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthzDecisionQueryDescriptorType.");
903             }
904         };
905
906         /**
907          * Registers builders and validators for SAML 2.0 Metadata classes into the runtime.
908          */
909         void SAML_API registerMetadataClasses();
910     };
911 };
912
913 #endif /* __saml2_metadata_h__ */