Method to add protocol to a role.
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / Metadata.h
1 /*
2  *  Copyright 2001-2007 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
30 #define DECL_SAML2MDOBJECTBUILDER(cname) \
31     DECL_XMLOBJECTBUILDER(SAML_API,cname,samlconstants::SAML20MD_NS,samlconstants::SAML20MD_PREFIX)
32
33 namespace opensaml {
34
35     /**
36      * @namespace opensaml::saml2md
37      * SAML 2.0 metadata namespace
38      */
39     namespace saml2md {
40         
41         /**
42          * Base class for metadata objects that feature a cacheDuration attribute.
43          */
44         class SAML_API CacheableSAMLObject : public virtual xmltooling::XMLObject
45         {
46         protected:
47             CacheableSAMLObject() {}
48         public:
49             ~CacheableSAMLObject() {}
50             DECL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION);
51         };
52
53         /**
54          * Base class for metadata objects that feature a validUntil attribute.
55          */
56         class SAML_API TimeBoundSAMLObject : public virtual xmltooling::XMLObject
57         {
58         protected:
59             TimeBoundSAMLObject() {}
60         public:
61             ~TimeBoundSAMLObject() {}
62             DECL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL);
63             /** Returns true iff the object is valid at the current time. */
64             bool isValid() const {
65                 return time(NULL) <= getValidUntilEpoch();
66             }
67         };
68
69         DECL_XMLOBJECT_SIMPLE(SAML_API,AffiliateMember,ID,SAML 2.0 AffiliateMember element);
70         DECL_XMLOBJECT_SIMPLE(SAML_API,AttributeProfile,ProfileURI,SAML 2.0 AttributeProfile element);
71         DECL_XMLOBJECT_SIMPLE(SAML_API,Company,Name,SAML 2.0 Company element);
72         DECL_XMLOBJECT_SIMPLE(SAML_API,EmailAddress,Address,SAML 2.0 EmailAddress element);
73         DECL_XMLOBJECT_SIMPLE(SAML_API,GivenName,Name,SAML 2.0 GivenName element);
74         DECL_XMLOBJECT_SIMPLE(SAML_API,NameIDFormat,Format,SAML 2.0 NameIDFormat element);
75         DECL_XMLOBJECT_SIMPLE(SAML_API,SurName,Name,SAML 2.0 SurName element);
76         DECL_XMLOBJECT_SIMPLE(SAML_API,TelephoneNumber,Number,SAML 2.0 TelephoneNumber element);
77         
78         DECL_XMLOBJECT_SIMPLE(SAML_API,ActionNamespace,Namespace,SAML 2.0 Metadata Extension ActionNamespace element);
79         DECL_XMLOBJECT_SIMPLE(SAML_API,SourceID,ID,SAML 1.x Metadata Profile SourceID element);
80
81         BEGIN_XMLOBJECT(SAML_API,localizedNameType,xmltooling::XMLObject,SAML 2.0 localizedNameType type);
82             DECL_STRING_ATTRIB(Lang,LANG);
83             /** localizedNameType local name */
84             static const XMLCh TYPE_NAME[];
85         END_XMLOBJECT;
86
87         BEGIN_XMLOBJECT(SAML_API,localizedURIType,xmltooling::XMLObject,SAML 2.0 localizedURIType type);
88             DECL_STRING_ATTRIB(Lang,LANG);
89             /** localizedURIType local name */
90             static const XMLCh TYPE_NAME[];
91         END_XMLOBJECT;
92
93         BEGIN_XMLOBJECT(SAML_API,OrganizationName,localizedNameType,SAML 2.0 OrganizationName element);
94             DECL_SIMPLE_CONTENT(Name);
95         END_XMLOBJECT;
96
97         BEGIN_XMLOBJECT(SAML_API,OrganizationDisplayName,localizedNameType,SAML 2.0 OrganizationDisplayName element);
98             DECL_SIMPLE_CONTENT(Name);
99         END_XMLOBJECT;
100
101         BEGIN_XMLOBJECT(SAML_API,OrganizationURL,localizedURIType,SAML 2.0 OrganizationURL element);
102             DECL_SIMPLE_CONTENT(URL);
103         END_XMLOBJECT;
104         
105         BEGIN_XMLOBJECT(SAML_API,Extensions,xmltooling::ElementExtensibleXMLObject,SAML 2.0 Extensions element);
106             /** ExtensionsType local name */
107             static const XMLCh TYPE_NAME[];
108         END_XMLOBJECT;
109
110         BEGIN_XMLOBJECT(SAML_API,Organization,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 Organization element);
111             DECL_TYPED_CHILD(Extensions);
112             DECL_TYPED_CHILDREN(OrganizationName);
113             DECL_TYPED_CHILDREN(OrganizationDisplayName);
114             DECL_TYPED_CHILDREN(OrganizationURL);
115             /** OrganizationType local name */
116             static const XMLCh TYPE_NAME[];
117         END_XMLOBJECT;
118
119         BEGIN_XMLOBJECT(SAML_API,ContactPerson,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 ContactPerson element);
120             DECL_STRING_ATTRIB(ContactType,CONTACTTYPE);
121             DECL_TYPED_CHILD(Extensions);
122             DECL_TYPED_CHILD(Company);
123             DECL_TYPED_CHILD(GivenName);
124             DECL_TYPED_CHILD(SurName);
125             DECL_TYPED_CHILDREN(EmailAddress);
126             DECL_TYPED_CHILDREN(TelephoneNumber);
127             /** ContactType local name */
128             static const XMLCh TYPE_NAME[];
129             /** technical Contact Type */
130             static const XMLCh CONTACT_TECHNICAL[];
131             /** support Contact Type */
132             static const XMLCh CONTACT_SUPPORT[];
133             /** administrative Contact Type */
134             static const XMLCh CONTACT_ADMINISTRATIVE[];
135             /** billing Contact Type */
136             static const XMLCh CONTACT_BILLING[];
137             /** other Contact Type */
138             static const XMLCh CONTACT_OTHER[];
139         END_XMLOBJECT;
140
141         BEGIN_XMLOBJECT(SAML_API,AdditionalMetadataLocation,xmltooling::XMLObject,SAML 2.0 AdditionalMetadataLocation element);
142             DECL_STRING_ATTRIB(Namespace,NAMESPACE);
143             DECL_SIMPLE_CONTENT(Location);
144             /** AdditionalMetadataLocationType local name */
145             static const XMLCh TYPE_NAME[];
146         END_XMLOBJECT;
147
148         BEGIN_XMLOBJECT(SAML_API,KeyDescriptor,xmltooling::XMLObject,SAML 2.0 KeyDescriptor element);
149             DECL_STRING_ATTRIB(Use,USE);
150             DECL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
151             DECL_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption);
152             /** KeyDescriptorType local name */
153             static const XMLCh TYPE_NAME[];
154             /** encryption Key Type */
155             static const XMLCh KEYTYPE_ENCRYPTION[];
156             /** signing Key Type */
157             static const XMLCh KEYTYPE_SIGNING[];
158         END_XMLOBJECT;
159
160         BEGIN_XMLOBJECT4(SAML_API,RoleDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
161                 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 RoleDescriptor abstract element);
162             DECL_STRING_ATTRIB(ID,ID);
163             DECL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION);
164             /** Searches the ProtocolSupportEnumeration attribute for the indicated protocol. */
165             virtual bool hasSupport(const XMLCh* protocol) const=0;
166             /** Adds the indicated protocol to the ProtocolSupportEnumeration attribute. */
167             virtual void addSupport(const XMLCh* protocol)=0;
168             DECL_STRING_ATTRIB(ErrorURL,ERRORURL);
169             DECL_TYPED_CHILD(Extensions);
170             DECL_TYPED_CHILDREN(KeyDescriptor);
171             DECL_TYPED_CHILD(Organization);
172             DECL_TYPED_CHILDREN(ContactPerson);
173         END_XMLOBJECT;
174
175         BEGIN_XMLOBJECT(SAML_API,EndpointType,xmltooling::ElementProxy,SAML 2.0 EndpointType type);
176             DECL_STRING_ATTRIB(Binding,BINDING);
177             DECL_STRING_ATTRIB(Location,LOCATION);
178             DECL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION);
179             /** EndpointType local name */
180             static const XMLCh TYPE_NAME[];
181         END_XMLOBJECT;
182
183         BEGIN_XMLOBJECT(SAML_API,IndexedEndpointType,EndpointType,SAML 2.0 IndexedEndpointType type);
184             DECL_INTEGER_ATTRIB(Index,INDEX);
185             DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
186             /** IndexedEndpointType local name */
187             static const XMLCh TYPE_NAME[];
188         END_XMLOBJECT;
189
190         BEGIN_XMLOBJECT(SAML_API,ArtifactResolutionService,IndexedEndpointType,SAML 2.0 ArtifactResolutionService element);
191         END_XMLOBJECT;
192
193         BEGIN_XMLOBJECT(SAML_API,SingleLogoutService,EndpointType,SAML 2.0 SingleLogoutService element);
194         END_XMLOBJECT;
195
196         BEGIN_XMLOBJECT(SAML_API,ManageNameIDService,EndpointType,SAML 2.0 ManageNameIDService element);
197         END_XMLOBJECT;
198
199         BEGIN_XMLOBJECT(SAML_API,SSODescriptorType,RoleDescriptor,SAML 2.0 SSODescriptorType abstract type);
200             DECL_TYPED_CHILDREN(ArtifactResolutionService);
201             DECL_TYPED_CHILDREN(SingleLogoutService);
202             DECL_TYPED_CHILDREN(ManageNameIDService);
203             DECL_TYPED_CHILDREN(NameIDFormat);
204             /** SSODescriptorType local name */
205             static const XMLCh TYPE_NAME[];
206         END_XMLOBJECT;
207
208         BEGIN_XMLOBJECT(SAML_API,SingleSignOnService,EndpointType,SAML 2.0 SingleSignOnService element);
209         END_XMLOBJECT;
210
211         BEGIN_XMLOBJECT(SAML_API,NameIDMappingService,EndpointType,SAML 2.0 NameIDMappingService element);
212         END_XMLOBJECT;
213
214         BEGIN_XMLOBJECT(SAML_API,AssertionIDRequestService,EndpointType,SAML 2.0 AssertionIDRequestService element);
215         END_XMLOBJECT;
216
217         BEGIN_XMLOBJECT(SAML_API,IDPSSODescriptor,SSODescriptorType,SAML 2.0 IDPSSODescriptor element);
218             DECL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,false);
219             DECL_TYPED_CHILDREN(SingleSignOnService);
220             DECL_TYPED_CHILDREN(NameIDMappingService);
221             DECL_TYPED_CHILDREN(AssertionIDRequestService);
222             DECL_TYPED_CHILDREN(AttributeProfile);
223             DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
224             /** IDPSSODescriptorType local name */
225             static const XMLCh TYPE_NAME[];
226         END_XMLOBJECT;
227
228         BEGIN_XMLOBJECT(SAML_API,ServiceName,localizedNameType,SAML 2.0 ServiceName element);
229             DECL_SIMPLE_CONTENT(Name);
230         END_XMLOBJECT;
231
232         BEGIN_XMLOBJECT(SAML_API,ServiceDescription,localizedNameType,SAML 2.0 ServiceDescription element);
233             DECL_SIMPLE_CONTENT(Description);
234         END_XMLOBJECT;
235
236         BEGIN_XMLOBJECT(SAML_API,RequestedAttribute,saml2::Attribute,SAML 2.0 RequestedAttribute element);
237             DECL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,false);
238             /** RequestedAttributeType local name */
239             static const XMLCh TYPE_NAME[];
240         END_XMLOBJECT;
241
242         BEGIN_XMLOBJECT(SAML_API,AttributeConsumingService,xmltooling::XMLObject,SAML 2.0 AttributeConsumingService element);
243             DECL_INTEGER_ATTRIB(Index,INDEX);
244             DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
245             DECL_TYPED_CHILDREN(ServiceName);
246             DECL_TYPED_CHILDREN(ServiceDescription);
247             DECL_TYPED_CHILDREN(RequestedAttribute);
248             /** AttributeConsumingServiceType local name */
249             static const XMLCh TYPE_NAME[];
250         END_XMLOBJECT;
251
252         BEGIN_XMLOBJECT(SAML_API,AssertionConsumerService,IndexedEndpointType,SAML 2.0 AssertionConsumerService element);
253         END_XMLOBJECT;
254
255         BEGIN_XMLOBJECT(SAML_API,SPSSODescriptor,SSODescriptorType,SAML 2.0 SPSSODescriptor element);
256             DECL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,false);
257             DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
258             DECL_TYPED_CHILDREN(AssertionConsumerService);
259             DECL_TYPED_CHILDREN(AttributeConsumingService);
260             /** SPSSODescriptorType local name */
261             static const XMLCh TYPE_NAME[];
262         END_XMLOBJECT;
263
264         BEGIN_XMLOBJECT(SAML_API,AuthnQueryService,EndpointType,SAML 2.0 AuthnQueryService element);
265         END_XMLOBJECT;
266
267         BEGIN_XMLOBJECT(SAML_API,AuthnAuthorityDescriptor,RoleDescriptor,SAML 2.0 AuthnAuthorityDescriptor element);
268             DECL_TYPED_CHILDREN(AuthnQueryService);
269             DECL_TYPED_CHILDREN(AssertionIDRequestService);
270             DECL_TYPED_CHILDREN(NameIDFormat);
271             /** AuthnAuthorityDescriptorType local name */
272             static const XMLCh TYPE_NAME[];
273         END_XMLOBJECT;
274
275         BEGIN_XMLOBJECT(SAML_API,AuthzService,EndpointType,SAML 2.0 AuthzService element);
276         END_XMLOBJECT;
277
278         BEGIN_XMLOBJECT(SAML_API,PDPDescriptor,RoleDescriptor,SAML 2.0 PDPDescriptor element);
279             DECL_TYPED_CHILDREN(AuthzService);
280             DECL_TYPED_CHILDREN(AssertionIDRequestService);
281             DECL_TYPED_CHILDREN(NameIDFormat);
282             /** PDPDescriptorType local name */
283             static const XMLCh TYPE_NAME[];
284         END_XMLOBJECT;
285
286         BEGIN_XMLOBJECT(SAML_API,AttributeService,EndpointType,SAML 2.0 AttributeService element);
287         END_XMLOBJECT;
288
289         BEGIN_XMLOBJECT(SAML_API,AttributeAuthorityDescriptor,RoleDescriptor,SAML 2.0 AttributeAuthorityDescriptor element);
290             DECL_TYPED_CHILDREN(AttributeService);
291             DECL_TYPED_CHILDREN(AssertionIDRequestService);
292             DECL_TYPED_CHILDREN(NameIDFormat);
293             DECL_TYPED_CHILDREN(AttributeProfile);
294             DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
295             /** AttributeAuthorityDescriptorType local name */
296             static const XMLCh TYPE_NAME[];
297         END_XMLOBJECT;
298
299         BEGIN_XMLOBJECT(SAML_API,QueryDescriptorType,RoleDescriptor,SAML 2.0 QueryDescriptorType abstract type);
300             DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
301             DECL_TYPED_CHILDREN(NameIDFormat);
302             /** QueryDescriptorType local name */
303             static const XMLCh TYPE_NAME[];
304         END_XMLOBJECT;
305
306         BEGIN_XMLOBJECT(SAML_API,AuthnQueryDescriptorType,QueryDescriptorType,SAML 2.0 AuthnQueryDescriptorType extension type);
307             /** AuthnQueryDescriptorType local name */
308             static const XMLCh TYPE_NAME[];
309         END_XMLOBJECT;
310
311         BEGIN_XMLOBJECT(SAML_API,AttributeQueryDescriptorType,QueryDescriptorType,SAML 2.0 AttributeQueryDescriptorType extension type);
312             DECL_TYPED_CHILDREN(AttributeConsumingService);
313             /** AttributeQueryDescriptorType local name */
314             static const XMLCh TYPE_NAME[];
315         END_XMLOBJECT;
316
317         BEGIN_XMLOBJECT(SAML_API,AuthzDecisionQueryDescriptorType,QueryDescriptorType,SAML 2.0 AuthzDecisionQueryDescriptorType extension type);
318             DECL_TYPED_CHILDREN(ActionNamespace);
319             /** AuthzDecisionQueryDescriptorType local name */
320             static const XMLCh TYPE_NAME[];
321         END_XMLOBJECT;
322
323         BEGIN_XMLOBJECT4(SAML_API,AffiliationDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
324                 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 AffiliationDescriptor element);
325             DECL_STRING_ATTRIB(ID,ID);
326             DECL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID);
327             DECL_TYPED_CHILD(Extensions);
328             DECL_TYPED_CHILDREN(AffiliateMember);
329             DECL_TYPED_CHILDREN(KeyDescriptor);
330             /** AffiliationDescriptorType local name */
331             static const XMLCh TYPE_NAME[];
332         END_XMLOBJECT;
333
334         BEGIN_XMLOBJECT4(SAML_API,EntityDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
335                 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 EntityDescriptor element);
336             DECL_STRING_ATTRIB(ID,ID);
337             DECL_STRING_ATTRIB(EntityID,ENTITYID);
338             DECL_TYPED_CHILD(Extensions);
339             DECL_TYPED_CHILD(AffiliationDescriptor);
340             DECL_TYPED_CHILDREN(RoleDescriptor);
341             DECL_TYPED_CHILDREN(IDPSSODescriptor);
342             DECL_TYPED_CHILDREN(SPSSODescriptor);
343             DECL_TYPED_CHILDREN(AuthnAuthorityDescriptor);
344             DECL_TYPED_CHILDREN(AttributeAuthorityDescriptor);
345             DECL_TYPED_CHILDREN(PDPDescriptor);
346             DECL_TYPED_CHILDREN(AuthnQueryDescriptorType);
347             DECL_TYPED_CHILDREN(AttributeQueryDescriptorType);
348             DECL_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType);
349             DECL_TYPED_CHILD(Organization);
350             DECL_TYPED_CHILDREN(ContactPerson);
351             DECL_TYPED_CHILDREN(AdditionalMetadataLocation);
352             /** Finds an IDP role supporting a given protocol. */
353             virtual const IDPSSODescriptor* getIDPSSODescriptor(const XMLCh* protocol) const=0;
354             /** Finds an SP role supporting a given protocol. */
355             virtual const SPSSODescriptor* getSPSSODescriptor(const XMLCh* protocol) const=0;
356             /** Finds an Authn Authority role supporting a given protocol. */
357             virtual const AuthnAuthorityDescriptor* getAuthnAuthorityDescriptor(const XMLCh* protocol) const=0;
358             /** Finds an Attribute Authority role supporting a given protocol. */
359             virtual const AttributeAuthorityDescriptor* getAttributeAuthorityDescriptor(const XMLCh* protocol) const=0;
360             /** Finds a PDP role supporting a given protocol. */
361             virtual const PDPDescriptor* getPDPDescriptor(const XMLCh* protocol) const=0;
362             /** Finds an AuthnQuery role supporting a given protocol. */
363             virtual const AuthnQueryDescriptorType* getAuthnQueryDescriptorType(const XMLCh* protocol) const=0;
364             /** Finds an AttributeQuery role supporting a given protocol. */
365             virtual const AttributeQueryDescriptorType* getAttributeQueryDescriptorType(const XMLCh* protocol) const=0;
366             /** Finds an AuthzDecisionQuery role supporting a given protocol. */
367             virtual const AuthzDecisionQueryDescriptorType* getAuthzDecisionQueryDescriptorType(const XMLCh* protocol) const=0;
368             /** Finds an extension role supporting a given protocol. */
369             virtual const RoleDescriptor* getRoleDescriptor(const xmltooling::QName& qname, const XMLCh* protocol) const=0;
370             /** EntityDescriptorType local name */
371             static const XMLCh TYPE_NAME[];
372         END_XMLOBJECT;
373
374         BEGIN_XMLOBJECT3(SAML_API,EntitiesDescriptor,SignableObject,CacheableSAMLObject,
375                 TimeBoundSAMLObject,SAML 2.0 EntitiesDescriptor element);
376             DECL_STRING_ATTRIB(ID,ID);
377             DECL_STRING_ATTRIB(Name,NAME);
378             DECL_TYPED_CHILD(Extensions);
379             DECL_TYPED_CHILDREN(EntityDescriptor);
380             DECL_TYPED_CHILDREN(EntitiesDescriptor);
381             /** EntitiesDescriptorType local name */
382             static const XMLCh TYPE_NAME[];
383         END_XMLOBJECT;
384
385         DECL_SAML2MDOBJECTBUILDER(AdditionalMetadataLocation);
386         DECL_SAML2MDOBJECTBUILDER(AffiliateMember);
387         DECL_SAML2MDOBJECTBUILDER(AffiliationDescriptor);
388         DECL_SAML2MDOBJECTBUILDER(ArtifactResolutionService);
389         DECL_SAML2MDOBJECTBUILDER(AssertionConsumerService);
390         DECL_SAML2MDOBJECTBUILDER(AssertionIDRequestService);
391         DECL_SAML2MDOBJECTBUILDER(AttributeAuthorityDescriptor);
392         DECL_SAML2MDOBJECTBUILDER(AttributeConsumingService);
393         DECL_SAML2MDOBJECTBUILDER(AttributeProfile);
394         DECL_SAML2MDOBJECTBUILDER(AttributeService);
395         DECL_SAML2MDOBJECTBUILDER(AuthnAuthorityDescriptor);
396         DECL_SAML2MDOBJECTBUILDER(AuthnQueryService);
397         DECL_SAML2MDOBJECTBUILDER(AuthzService);
398         DECL_SAML2MDOBJECTBUILDER(Company);
399         DECL_SAML2MDOBJECTBUILDER(ContactPerson);
400         DECL_SAML2MDOBJECTBUILDER(EmailAddress);
401         DECL_SAML2MDOBJECTBUILDER(EntitiesDescriptor);
402         DECL_SAML2MDOBJECTBUILDER(EntityDescriptor);
403         DECL_SAML2MDOBJECTBUILDER(Extensions);
404         DECL_SAML2MDOBJECTBUILDER(GivenName);
405         DECL_SAML2MDOBJECTBUILDER(IDPSSODescriptor);
406         DECL_SAML2MDOBJECTBUILDER(KeyDescriptor);
407         DECL_SAML2MDOBJECTBUILDER(ManageNameIDService);
408         DECL_SAML2MDOBJECTBUILDER(NameIDFormat);
409         DECL_SAML2MDOBJECTBUILDER(NameIDMappingService);
410         DECL_SAML2MDOBJECTBUILDER(Organization);
411         DECL_SAML2MDOBJECTBUILDER(OrganizationName);
412         DECL_SAML2MDOBJECTBUILDER(OrganizationDisplayName);
413         DECL_SAML2MDOBJECTBUILDER(OrganizationURL);
414         DECL_SAML2MDOBJECTBUILDER(PDPDescriptor);
415         DECL_SAML2MDOBJECTBUILDER(RequestedAttribute);
416         DECL_SAML2MDOBJECTBUILDER(ServiceDescription);
417         DECL_SAML2MDOBJECTBUILDER(ServiceName);
418         DECL_SAML2MDOBJECTBUILDER(SingleLogoutService);
419         DECL_SAML2MDOBJECTBUILDER(SingleSignOnService);
420         DECL_SAML2MDOBJECTBUILDER(SPSSODescriptor);
421         DECL_SAML2MDOBJECTBUILDER(SurName);
422         DECL_SAML2MDOBJECTBUILDER(TelephoneNumber);
423         
424         DECL_XMLOBJECTBUILDER(SAML_API,ActionNamespace,samlconstants::SAML20MD_QUERY_EXT_NS,samlconstants::SAML20MD_QUERY_EXT_PREFIX);
425         DECL_XMLOBJECTBUILDER(SAML_API,SourceID,samlconstants::SAML1MD_NS,samlconstants::SAML1MD_PREFIX);
426
427         /**
428          * Builder for localizedNameType objects.
429          * 
430          * This is customized to force the element name to be specified.
431          */
432         class SAML_API localizedNameTypeBuilder : public xmltooling::XMLObjectBuilder {
433         public:
434             virtual ~localizedNameTypeBuilder() {}
435             /** Builder that allows element/type override. */
436 #ifdef HAVE_COVARIANT_RETURNS
437             virtual localizedNameType* buildObject(
438 #else
439             virtual xmltooling::XMLObject* buildObject(
440 #endif
441                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
442                 ) const;
443         
444             /** Singleton builder. */
445             static localizedNameType* buildlocalizedNameType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
446                 const localizedNameTypeBuilder* b = dynamic_cast<const localizedNameTypeBuilder*>(
447                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME))
448                     );
449                 if (b) {
450                     xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
451 #ifdef HAVE_COVARIANT_RETURNS
452                     return b->buildObject(nsURI, localName, prefix, &schemaType);
453 #else
454                     return dynamic_cast<localizedNameType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
455 #endif
456                 }
457                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedNameType.");
458             }
459         };
460
461         /**
462          * Builder for localizedURIType objects.
463          * 
464          * This is customized to force the element name to be specified.
465          */
466         class SAML_API localizedURITypeBuilder : public xmltooling::XMLObjectBuilder {
467         public:
468             virtual ~localizedURITypeBuilder() {}
469             /** Builder that allows element/type override. */
470 #ifdef HAVE_COVARIANT_RETURNS
471             virtual localizedURIType* buildObject(
472 #else
473             virtual xmltooling::XMLObject* buildObject(
474 #endif
475                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
476                 ) const;
477         
478             /** Singleton builder. */
479             static localizedURIType* buildlocalizedURIType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
480                 const localizedURITypeBuilder* b = dynamic_cast<const localizedURITypeBuilder*>(
481                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME))
482                     );
483                 if (b) {
484                     xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
485 #ifdef HAVE_COVARIANT_RETURNS
486                     return b->buildObject(nsURI, localName, prefix, &schemaType);
487 #else
488                     return dynamic_cast<localizedURIType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
489 #endif
490                 }
491                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedURIType.");
492             }
493         };
494
495         /**
496          * Builder for EndpointType objects.
497          * 
498          * This is customized to force the element name to be specified.
499          */
500         class SAML_API EndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
501         public:
502             virtual ~EndpointTypeBuilder() {}
503             /** Builder that allows element/type override. */
504 #ifdef HAVE_COVARIANT_RETURNS
505             virtual EndpointType* buildObject(
506 #else
507             virtual xmltooling::XMLObject* buildObject(
508 #endif
509                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
510                 ) const;
511         
512             /** Singleton builder. */
513             static EndpointType* buildEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
514                 const EndpointTypeBuilder* b = dynamic_cast<const EndpointTypeBuilder*>(
515                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME))
516                     );
517                 if (b) {
518                     xmltooling::QName schemaType(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
519 #ifdef HAVE_COVARIANT_RETURNS
520                     return b->buildObject(nsURI, localName, prefix, &schemaType);
521 #else
522                     return dynamic_cast<EndpointType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
523 #endif
524                 }
525                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for EndpointType.");
526             }
527         };
528
529         /**
530          * Builder for IndexedEndpointType objects.
531          * 
532          * This is customized to force the element name to be specified.
533          */
534         class SAML_API IndexedEndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
535         public:
536             virtual ~IndexedEndpointTypeBuilder() {}
537             /** Builder that allows element/type override. */
538 #ifdef HAVE_COVARIANT_RETURNS
539             virtual IndexedEndpointType* buildObject(
540 #else
541             virtual xmltooling::XMLObject* buildObject(
542 #endif
543                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
544                 ) const;
545         
546             /** Singleton builder. */
547             static IndexedEndpointType* buildIndexedEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
548                 const IndexedEndpointTypeBuilder* b = dynamic_cast<const IndexedEndpointTypeBuilder*>(
549                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME))
550                     );
551                 if (b) {
552                     xmltooling::QName schemaType(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
553 #ifdef HAVE_COVARIANT_RETURNS
554                     return b->buildObject(nsURI, localName, prefix, &schemaType);
555 #else
556                     return dynamic_cast<IndexedEndpointType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
557 #endif
558                 }
559                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for IndexedEndpointType.");
560             }
561         };
562
563         /**
564          * Builder for AuthnQueryDescriptorType objects.
565          * 
566          * This is customized to return a RoleDescriptor element with an
567          * xsi:type of AuthnQueryDescriptorType.
568          */
569         class SAML_API AuthnQueryDescriptorTypeBuilder : public xmltooling::XMLObjectBuilder {
570         public:
571             virtual ~AuthnQueryDescriptorTypeBuilder() {}
572             /** Default builder. */
573 #ifdef HAVE_COVARIANT_RETURNS
574             virtual AuthnQueryDescriptorType* buildObject() const {
575 #else
576             virtual xmltooling::XMLObject* buildObject() const {
577 #endif
578                 xmltooling::QName schemaType(
579                     samlconstants::SAML20_NS,AuthnQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
580                     );
581                 return buildObject(
582                     samlconstants::SAML20_NS,AuthnQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20_PREFIX,&schemaType
583                     );
584             }
585             /** Builder that allows element/type override. */
586 #ifdef HAVE_COVARIANT_RETURNS
587             virtual AuthnQueryDescriptorType* buildObject(
588 #else
589             virtual xmltooling::XMLObject* buildObject(
590 #endif
591                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
592                 ) const;
593         
594             /** Singleton builder. */
595             static AuthnQueryDescriptorType* buildAuthnQueryDescriptorType() {
596                 const AuthnQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthnQueryDescriptorTypeBuilder*>(
597                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthnQueryDescriptorType::TYPE_NAME))
598                     );
599                 if (b) {
600 #ifdef HAVE_COVARIANT_RETURNS
601                     return b->buildObject();
602 #else
603                     return dynamic_cast<AuthnQueryDescriptorType*>(b->buildObject());
604 #endif
605                 }
606                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthnQueryDescriptorType.");
607             }
608         };
609
610         /**
611          * Builder for AttributeQueryDescriptorType objects.
612          * 
613          * This is customized to return a RoleDescriptor element with an
614          * xsi:type of AttributeQueryDescriptorType.
615          */
616         class SAML_API AttributeQueryDescriptorTypeBuilder : public xmltooling::XMLObjectBuilder {
617         public:
618             virtual ~AttributeQueryDescriptorTypeBuilder() {}
619             /** Default builder. */
620 #ifdef HAVE_COVARIANT_RETURNS
621             virtual AttributeQueryDescriptorType* buildObject() const {
622 #else
623             virtual xmltooling::XMLObject* buildObject() const {
624 #endif
625                 xmltooling::QName schemaType(
626                     samlconstants::SAML20_NS,AttributeQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
627                     );
628                 return buildObject(
629                     samlconstants::SAML20_NS,AttributeQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20_PREFIX,&schemaType
630                     );
631             }
632             /** Builder that allows element/type override. */
633 #ifdef HAVE_COVARIANT_RETURNS
634             virtual AttributeQueryDescriptorType* buildObject(
635 #else
636             virtual xmltooling::XMLObject* buildObject(
637 #endif
638                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
639                 ) const;
640         
641             /** Singleton builder. */
642             static AttributeQueryDescriptorType* buildAttributeQueryDescriptorType() {
643                 const AttributeQueryDescriptorTypeBuilder* b = dynamic_cast<const AttributeQueryDescriptorTypeBuilder*>(
644                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AttributeQueryDescriptorType::TYPE_NAME))
645                     );
646                 if (b) {
647 #ifdef HAVE_COVARIANT_RETURNS
648                     return b->buildObject();
649 #else
650                     return dynamic_cast<AttributeQueryDescriptorType*>(b->buildObject());
651 #endif
652                 }
653                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AttributeQueryDescriptorType.");
654             }
655         };
656
657         /**
658          * Builder for AuthzDecisionQueryDescriptorType objects.
659          * 
660          * This is customized to return a RoleDescriptor element with an
661          * xsi:type of AuthzDecisionQueryDescriptorType.
662          */
663         class SAML_API AuthzDecisionQueryDescriptorTypeBuilder : public xmltooling::XMLObjectBuilder {
664         public:
665             virtual ~AuthzDecisionQueryDescriptorTypeBuilder() {}
666             /** Default builder. */
667 #ifdef HAVE_COVARIANT_RETURNS
668             virtual AuthzDecisionQueryDescriptorType* buildObject() const {
669 #else
670             virtual xmltooling::XMLObject* buildObject() const {
671 #endif
672                 xmltooling::QName schemaType(
673                     samlconstants::SAML20_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
674                     );
675                 return buildObject(
676                     samlconstants::SAML20_NS,AuthzDecisionQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20_PREFIX,&schemaType
677                     );
678             }
679             /** Builder that allows element/type override. */
680 #ifdef HAVE_COVARIANT_RETURNS
681             virtual AuthzDecisionQueryDescriptorType* buildObject(
682 #else
683             virtual xmltooling::XMLObject* buildObject(
684 #endif
685                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
686                 ) const;
687         
688             /** Singleton builder. */
689             static AuthzDecisionQueryDescriptorType* buildAuthzDecisionQueryDescriptorType() {
690                 const AuthzDecisionQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthzDecisionQueryDescriptorTypeBuilder*>(
691                     XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME))
692                     );
693                 if (b) {
694 #ifdef HAVE_COVARIANT_RETURNS
695                     return b->buildObject();
696 #else
697                     return dynamic_cast<AuthzDecisionQueryDescriptorType*>(b->buildObject());
698 #endif
699                 }
700                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthzDecisionQueryDescriptorType.");
701             }
702         };
703
704         /**
705          * Registers builders and validators for SAML 2.0 Metadata classes into the runtime.
706          */
707         void SAML_API registerMetadataClasses();
708     };
709 };
710
711 #endif /* __saml2_metadata_h__ */