Port Java provider API, fix to protocol support check.
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / Metadata.h
1 /*
2  *  Copyright 2001-2006 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 #include <saml/util/SAMLConstants.h>
28
29 #include <ctime>
30 #include <xmltooling/AttributeExtensibleXMLObject.h>
31 #include <xmltooling/ElementProxy.h>
32 #include <xmltooling/SimpleElement.h>
33 #include <xmltooling/XMLObjectBuilder.h>
34 #include <xmltooling/encryption/Encryption.h>
35 #include <xmltooling/signature/KeyInfo.h>
36 #include <xmltooling/signature/Signature.h>
37 #include <xmltooling/util/DateTime.h>
38
39 #define DECL_SAML2MDOBJECTBUILDER(cname) \
40     DECL_XMLOBJECTBUILDER(SAML_API,cname,opensaml::SAMLConstants::SAML20MD_NS,opensaml::SAMLConstants::SAML20MD_PREFIX)
41
42 namespace opensaml {
43
44     /**
45      * @namespace opensaml::saml2md
46      * SAML 2.0 metadata namespace
47      */
48     namespace saml2md {
49         
50         /**
51          * Base class for metadata objects that feature a cacheDuration attribute.
52          */
53         class SAML_API CacheableSAMLObject : public virtual xmltooling::XMLObject
54         {
55         protected:
56             CacheableSAMLObject() {}
57         public:
58             ~CacheableSAMLObject() {}
59             DECL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION);
60         };
61
62         /**
63          * Base class for metadata objects that feature a validUntil attribute.
64          */
65         class SAML_API TimeBoundSAMLObject : public virtual xmltooling::XMLObject
66         {
67         protected:
68             TimeBoundSAMLObject() {}
69         public:
70             ~TimeBoundSAMLObject() {}
71             DECL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL);
72             /** Returns true iff the object is valid at the current time. */
73             bool isValid() const {
74                 return time(NULL) <= getValidUntilEpoch();
75             }
76         };
77
78         DECL_XMLOBJECT_SIMPLE(SAML_API,AffiliateMember,ID,SAML 2.0 AffiliateMember element);
79         DECL_XMLOBJECT_SIMPLE(SAML_API,AttributeProfile,ProfileURI,SAML 2.0 AttributeProfile element);
80         DECL_XMLOBJECT_SIMPLE(SAML_API,Company,Name,SAML 2.0 Company element);
81         DECL_XMLOBJECT_SIMPLE(SAML_API,EmailAddress,Address,SAML 2.0 EmailAddress element);
82         DECL_XMLOBJECT_SIMPLE(SAML_API,GivenName,Name,SAML 2.0 GivenName element);
83         DECL_XMLOBJECT_SIMPLE(SAML_API,NameIDFormat,Format,SAML 2.0 NameIDFormat element);
84         DECL_XMLOBJECT_SIMPLE(SAML_API,SurName,Name,SAML 2.0 SurName element);
85         DECL_XMLOBJECT_SIMPLE(SAML_API,TelephoneNumber,Number,SAML 2.0 TelephoneNumber element);
86
87         BEGIN_XMLOBJECT(SAML_API,localizedNameType,xmltooling::SimpleElement,SAML 2.0 localizedNameType type);
88             DECL_STRING_ATTRIB(Lang,LANG);
89             /** localizedNameType local name */
90             static const XMLCh TYPE_NAME[];
91         END_XMLOBJECT;
92
93         BEGIN_XMLOBJECT(SAML_API,localizedURIType,xmltooling::SimpleElement,SAML 2.0 localizedURIType type);
94             DECL_STRING_ATTRIB(Lang,LANG);
95             /** localizedURIType local name */
96             static const XMLCh TYPE_NAME[];
97         END_XMLOBJECT;
98
99         BEGIN_XMLOBJECT(SAML_API,OrganizationName,localizedNameType,SAML 2.0 OrganizationName element);
100             DECL_XMLOBJECT_CONTENT(Name);
101         END_XMLOBJECT;
102
103         BEGIN_XMLOBJECT(SAML_API,OrganizationDisplayName,localizedNameType,SAML 2.0 OrganizationDisplayName element);
104             DECL_XMLOBJECT_CONTENT(Name);
105         END_XMLOBJECT;
106
107         BEGIN_XMLOBJECT(SAML_API,OrganizationURL,localizedURIType,SAML 2.0 OrganizationURL element);
108             DECL_XMLOBJECT_CONTENT(URL);
109         END_XMLOBJECT;
110         
111         BEGIN_XMLOBJECT(SAML_API,Extensions,xmltooling::ElementProxy,SAML 2.0 Extensions element);
112             /** ExtensionsType local name */
113             static const XMLCh TYPE_NAME[];
114         END_XMLOBJECT;
115
116         BEGIN_XMLOBJECT(SAML_API,Organization,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 Organization element);
117             DECL_TYPED_CHILD(Extensions);
118             DECL_TYPED_CHILDREN(OrganizationName);
119             DECL_TYPED_CHILDREN(OrganizationDisplayName);
120             DECL_TYPED_CHILDREN(OrganizationURL);
121             /** OrganizationType local name */
122             static const XMLCh TYPE_NAME[];
123         END_XMLOBJECT;
124
125         BEGIN_XMLOBJECT(SAML_API,ContactPerson,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 ContactPerson element);
126             DECL_STRING_ATTRIB(ContactType,CONTACTTYPE);
127             DECL_TYPED_CHILD(Extensions);
128             DECL_TYPED_CHILD(Company);
129             DECL_TYPED_CHILD(GivenName);
130             DECL_TYPED_CHILD(SurName);
131             DECL_TYPED_CHILDREN(EmailAddress);
132             DECL_TYPED_CHILDREN(TelephoneNumber);
133             /** ContactType local name */
134             static const XMLCh TYPE_NAME[];
135             /** technical Contact Type */
136             static const XMLCh CONTACT_TECHNICAL[];
137             /** support Contact Type */
138             static const XMLCh CONTACT_SUPPORT[];
139             /** administrative Contact Type */
140             static const XMLCh CONTACT_ADMINISTRATIVE[];
141             /** billing Contact Type */
142             static const XMLCh CONTACT_BILLING[];
143             /** other Contact Type */
144             static const XMLCh CONTACT_OTHER[];
145         END_XMLOBJECT;
146
147         BEGIN_XMLOBJECT(SAML_API,AdditionalMetadataLocation,xmltooling::SimpleElement,SAML 2.0 AdditionalMetadataLocation element);
148             DECL_STRING_ATTRIB(Namespace,NAMESPACE);
149             DECL_XMLOBJECT_CONTENT(Location);
150             /** AdditionalMetadataLocationType local name */
151             static const XMLCh TYPE_NAME[];
152         END_XMLOBJECT;
153
154         BEGIN_XMLOBJECT(SAML_API,KeyDescriptor,xmltooling::XMLObject,SAML 2.0 KeyDescriptor element);
155             DECL_STRING_ATTRIB(Use,USE);
156             DECL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
157             DECL_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption);
158             /** KeyDescriptorType local name */
159             static const XMLCh TYPE_NAME[];
160             /** encryption Key Type */
161             static const XMLCh KEYTYPE_ENCRYPTION[];
162             /** signing Key Type */
163             static const XMLCh KEYTYPE_SIGNING[];
164         END_XMLOBJECT;
165
166         BEGIN_XMLOBJECT4(SAML_API,RoleDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
167                 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 RoleDescriptor abstract element);
168             DECL_STRING_ATTRIB(ID,ID);
169             DECL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION);
170             /** Searches the ProtocolSupportEnumeration attribute for the indicated protocol. */
171             virtual bool hasSupport(const XMLCh* protocol) const=0;
172             DECL_STRING_ATTRIB(ErrorURL,ERRORURL);
173             DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
174             DECL_TYPED_CHILD(Extensions);
175             DECL_TYPED_CHILDREN(KeyDescriptor);
176             DECL_TYPED_CHILD(Organization);
177             DECL_TYPED_CHILDREN(ContactPerson);
178         END_XMLOBJECT;
179
180         BEGIN_XMLOBJECT2(SAML_API,EndpointType,xmltooling::ElementProxy,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 EndpointType type);
181             DECL_STRING_ATTRIB(Binding,BINDING);
182             DECL_STRING_ATTRIB(Location,LOCATION);
183             DECL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION);
184             /** EndpointType local name */
185             static const XMLCh TYPE_NAME[];
186         END_XMLOBJECT;
187
188         BEGIN_XMLOBJECT(SAML_API,IndexedEndpointType,EndpointType,SAML 2.0 IndexedEndpointType type);
189             DECL_INTEGER_ATTRIB(Index,INDEX);
190             DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT);
191             /** IndexedEndpointType local name */
192             static const XMLCh TYPE_NAME[];
193         END_XMLOBJECT;
194
195         BEGIN_XMLOBJECT(SAML_API,ArtifactResolutionService,IndexedEndpointType,SAML 2.0 ArtifactResolutionService element);
196         END_XMLOBJECT;
197
198         BEGIN_XMLOBJECT(SAML_API,SingleLogoutService,EndpointType,SAML 2.0 SingleLogoutService element);
199         END_XMLOBJECT;
200
201         BEGIN_XMLOBJECT(SAML_API,ManageNameIDService,EndpointType,SAML 2.0 ManageNameIDService element);
202         END_XMLOBJECT;
203
204         BEGIN_XMLOBJECT(SAML_API,SSODescriptorType,RoleDescriptor,SAML 2.0 SSODescriptorType abstract type);
205             DECL_TYPED_CHILDREN(ArtifactResolutionService);
206             DECL_TYPED_CHILDREN(SingleLogoutService);
207             DECL_TYPED_CHILDREN(ManageNameIDService);
208             DECL_TYPED_CHILDREN(NameIDFormat);
209             /** SSODescriptorType local name */
210             static const XMLCh TYPE_NAME[];
211         END_XMLOBJECT;
212
213         BEGIN_XMLOBJECT(SAML_API,SingleSignOnService,EndpointType,SAML 2.0 SingleSignOnService element);
214         END_XMLOBJECT;
215
216         BEGIN_XMLOBJECT(SAML_API,NameIDMappingService,EndpointType,SAML 2.0 NameIDMappingService element);
217         END_XMLOBJECT;
218
219         BEGIN_XMLOBJECT(SAML_API,AssertionIDRequestService,EndpointType,SAML 2.0 AssertionIDRequestService element);
220         END_XMLOBJECT;
221
222         BEGIN_XMLOBJECT(SAML_API,IDPSSODescriptor,SSODescriptorType,SAML 2.0 IDPSSODescriptor element);
223             DECL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED);
224             DECL_TYPED_CHILDREN(SingleSignOnService);
225             DECL_TYPED_CHILDREN(NameIDMappingService);
226             DECL_TYPED_CHILDREN(AssertionIDRequestService);
227             DECL_TYPED_CHILDREN(AttributeProfile);
228             DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
229             /** IDPSSODescriptorType local name */
230             static const XMLCh TYPE_NAME[];
231         END_XMLOBJECT;
232
233         BEGIN_XMLOBJECT(SAML_API,ServiceName,localizedNameType,SAML 2.0 ServiceName element);
234             DECL_XMLOBJECT_CONTENT(Name);
235         END_XMLOBJECT;
236
237         BEGIN_XMLOBJECT(SAML_API,ServiceDescription,localizedNameType,SAML 2.0 ServiceDescription element);
238             DECL_XMLOBJECT_CONTENT(Description);
239         END_XMLOBJECT;
240
241         BEGIN_XMLOBJECT(SAML_API,RequestedAttribute,saml2::Attribute,SAML 2.0 RequestedAttribute element);
242             DECL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED);
243             /** RequestedAttributeType local name */
244             static const XMLCh TYPE_NAME[];
245         END_XMLOBJECT;
246
247         BEGIN_XMLOBJECT(SAML_API,AttributeConsumingService,xmltooling::XMLObject,SAML 2.0 AttributeConsumingService element);
248             DECL_INTEGER_ATTRIB(Index,INDEX);
249             DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT);
250             DECL_TYPED_CHILDREN(ServiceName);
251             DECL_TYPED_CHILDREN(ServiceDescription);
252             DECL_TYPED_CHILDREN(RequestedAttribute);
253             /** AttributeConsumingServiceType local name */
254             static const XMLCh TYPE_NAME[];
255         END_XMLOBJECT;
256
257         BEGIN_XMLOBJECT(SAML_API,AssertionConsumerService,IndexedEndpointType,SAML 2.0 AssertionConsumerService element);
258         END_XMLOBJECT;
259
260         BEGIN_XMLOBJECT(SAML_API,SPSSODescriptor,SSODescriptorType,SAML 2.0 SPSSODescriptor element);
261             DECL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED);
262             DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED);
263             DECL_TYPED_CHILDREN(AssertionConsumerService);
264             DECL_TYPED_CHILDREN(AttributeConsumingService);
265             /** SPSSODescriptorType local name */
266             static const XMLCh TYPE_NAME[];
267         END_XMLOBJECT;
268
269         BEGIN_XMLOBJECT(SAML_API,AuthnQueryService,EndpointType,SAML 2.0 AuthnQueryService element);
270         END_XMLOBJECT;
271
272         BEGIN_XMLOBJECT(SAML_API,AuthnAuthorityDescriptor,RoleDescriptor,SAML 2.0 AuthnAuthorityDescriptor element);
273             DECL_TYPED_CHILDREN(AuthnQueryService);
274             DECL_TYPED_CHILDREN(AssertionIDRequestService);
275             DECL_TYPED_CHILDREN(NameIDFormat);
276             /** AuthnAuthorityDescriptorType local name */
277             static const XMLCh TYPE_NAME[];
278         END_XMLOBJECT;
279
280         BEGIN_XMLOBJECT(SAML_API,AuthzService,EndpointType,SAML 2.0 AuthzService element);
281         END_XMLOBJECT;
282
283         BEGIN_XMLOBJECT(SAML_API,PDPDescriptor,RoleDescriptor,SAML 2.0 PDPDescriptor element);
284             DECL_TYPED_CHILDREN(AuthzService);
285             DECL_TYPED_CHILDREN(AssertionIDRequestService);
286             DECL_TYPED_CHILDREN(NameIDFormat);
287             /** PDPDescriptorType local name */
288             static const XMLCh TYPE_NAME[];
289         END_XMLOBJECT;
290
291         BEGIN_XMLOBJECT(SAML_API,AttributeService,EndpointType,SAML 2.0 AttributeService element);
292         END_XMLOBJECT;
293
294         BEGIN_XMLOBJECT(SAML_API,AttributeAuthorityDescriptor,RoleDescriptor,SAML 2.0 AttributeAuthorityDescriptor element);
295             DECL_TYPED_CHILDREN(AttributeService);
296             DECL_TYPED_CHILDREN(AssertionIDRequestService);
297             DECL_TYPED_CHILDREN(NameIDFormat);
298             DECL_TYPED_CHILDREN(AttributeProfile);
299             DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
300             /** AttributeAuthorityDescriptorType local name */
301             static const XMLCh TYPE_NAME[];
302         END_XMLOBJECT;
303
304         BEGIN_XMLOBJECT4(SAML_API,AffiliationDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
305                 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 AffiliationDescriptor element);
306             DECL_STRING_ATTRIB(ID,ID);
307             DECL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID);
308             DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
309             DECL_TYPED_CHILD(Extensions);
310             DECL_TYPED_CHILDREN(AffiliateMember);
311             DECL_TYPED_CHILDREN(KeyDescriptor);
312             /** AffiliationDescriptorType local name */
313             static const XMLCh TYPE_NAME[];
314         END_XMLOBJECT;
315
316         BEGIN_XMLOBJECT4(SAML_API,EntityDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
317                 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 EntityDescriptor element);
318             DECL_STRING_ATTRIB(ID,ID);
319             DECL_STRING_ATTRIB(EntityID,ENTITYID);
320             DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
321             DECL_TYPED_CHILD(Extensions);
322             DECL_TYPED_CHILD(AffiliationDescriptor);
323             DECL_TYPED_CHILDREN(RoleDescriptor);
324             DECL_TYPED_CHILDREN(IDPSSODescriptor);
325             DECL_TYPED_CHILDREN(SPSSODescriptor);
326             DECL_TYPED_CHILDREN(AuthnAuthorityDescriptor);
327             DECL_TYPED_CHILDREN(AttributeAuthorityDescriptor);
328             DECL_TYPED_CHILDREN(PDPDescriptor);
329             /** Finds an IDP role supporting a given protocol. */
330             virtual const IDPSSODescriptor* getIDPSSODescriptor(const XMLCh* protocol) const=0;
331             /** Finds an SP role supporting a given protocol. */
332             virtual const SPSSODescriptor* getSPSSODescriptor(const XMLCh* protocol) const=0;
333             /** Finds an Authn Authority role supporting a given protocol. */
334             virtual const AuthnAuthorityDescriptor* getAuthnAuthorityDescriptor(const XMLCh* protocol) const=0;
335             /** Finds an Attribute Authority role supporting a given protocol. */
336             virtual const AttributeAuthorityDescriptor* getAttributeAuthorityDescriptor(const XMLCh* protocol) const=0;
337             /** Finds a PDP role supporting a given protocol. */
338             virtual const PDPDescriptor* getPDPDescriptor(const XMLCh* protocol) const=0;
339             /** Finds an extension role supporting a given protocol. */
340             virtual const RoleDescriptor* getRoleDescriptor(xmltooling::QName& qname, const XMLCh* protocol) const=0;
341             /** EntityDescriptorType local name */
342             static const XMLCh TYPE_NAME[];
343         END_XMLOBJECT;
344
345         BEGIN_XMLOBJECT3(SAML_API,EntitiesDescriptor,SignableObject,CacheableSAMLObject,
346                 TimeBoundSAMLObject,SAML 2.0 EntitiesDescriptor element);
347             DECL_STRING_ATTRIB(ID,ID);
348             DECL_STRING_ATTRIB(Name,NAME);
349             DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
350             DECL_TYPED_CHILD(Extensions);
351             DECL_TYPED_CHILDREN(EntityDescriptor);
352             DECL_TYPED_CHILDREN(EntitiesDescriptor);
353             /** EntitiesDescriptorType local name */
354             static const XMLCh TYPE_NAME[];
355         END_XMLOBJECT;
356
357         DECL_SAML2MDOBJECTBUILDER(AdditionalMetadataLocation);
358         DECL_SAML2MDOBJECTBUILDER(AffiliateMember);
359         DECL_SAML2MDOBJECTBUILDER(AffiliationDescriptor);
360         DECL_SAML2MDOBJECTBUILDER(ArtifactResolutionService);
361         DECL_SAML2MDOBJECTBUILDER(AssertionConsumerService);
362         DECL_SAML2MDOBJECTBUILDER(AssertionIDRequestService);
363         DECL_SAML2MDOBJECTBUILDER(AttributeAuthorityDescriptor);
364         DECL_SAML2MDOBJECTBUILDER(AttributeConsumingService);
365         DECL_SAML2MDOBJECTBUILDER(AttributeProfile);
366         DECL_SAML2MDOBJECTBUILDER(AttributeService);
367         DECL_SAML2MDOBJECTBUILDER(AuthnAuthorityDescriptor);
368         DECL_SAML2MDOBJECTBUILDER(AuthnQueryService);
369         DECL_SAML2MDOBJECTBUILDER(AuthzService);
370         DECL_SAML2MDOBJECTBUILDER(Company);
371         DECL_SAML2MDOBJECTBUILDER(ContactPerson);
372         DECL_SAML2MDOBJECTBUILDER(EmailAddress);
373         DECL_SAML2MDOBJECTBUILDER(EntitiesDescriptor);
374         DECL_SAML2MDOBJECTBUILDER(EntityDescriptor);
375         DECL_SAML2MDOBJECTBUILDER(Extensions);
376         DECL_SAML2MDOBJECTBUILDER(GivenName);
377         DECL_SAML2MDOBJECTBUILDER(IDPSSODescriptor);
378         DECL_SAML2MDOBJECTBUILDER(KeyDescriptor);
379         DECL_SAML2MDOBJECTBUILDER(ManageNameIDService);
380         DECL_SAML2MDOBJECTBUILDER(NameIDFormat);
381         DECL_SAML2MDOBJECTBUILDER(NameIDMappingService);
382         DECL_SAML2MDOBJECTBUILDER(Organization);
383         DECL_SAML2MDOBJECTBUILDER(OrganizationName);
384         DECL_SAML2MDOBJECTBUILDER(OrganizationDisplayName);
385         DECL_SAML2MDOBJECTBUILDER(OrganizationURL);
386         DECL_SAML2MDOBJECTBUILDER(PDPDescriptor);
387         DECL_SAML2MDOBJECTBUILDER(RequestedAttribute);
388         DECL_SAML2MDOBJECTBUILDER(ServiceDescription);
389         DECL_SAML2MDOBJECTBUILDER(ServiceName);
390         DECL_SAML2MDOBJECTBUILDER(SingleLogoutService);
391         DECL_SAML2MDOBJECTBUILDER(SingleSignOnService);
392         DECL_SAML2MDOBJECTBUILDER(SPSSODescriptor);
393         DECL_SAML2MDOBJECTBUILDER(SurName);
394         DECL_SAML2MDOBJECTBUILDER(TelephoneNumber);
395
396         /**
397          * Builder for localizedNameType objects.
398          * 
399          * This is customized to force the element name to be specified.
400          */
401         class SAML_API localizedNameTypeBuilder : public xmltooling::XMLObjectBuilder {
402         public:
403             virtual ~localizedNameTypeBuilder() {}
404             /** Builder that allows element/type override. */
405             virtual localizedNameType* buildObject(
406                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
407                 ) const;
408         
409             /** Singleton builder. */
410             static localizedNameType* buildlocalizedNameType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
411                 const localizedNameTypeBuilder* b = dynamic_cast<const localizedNameTypeBuilder*>(
412                     XMLObjectBuilder::getBuilder(xmltooling::QName(SAMLConstants::SAML20MD_NS,localizedNameType::TYPE_NAME))
413                     );
414                 if (b) {
415                     xmltooling::QName schemaType(SAMLConstants::SAML20MD_NS,localizedNameType::TYPE_NAME,SAMLConstants::SAML20MD_PREFIX);
416                     return b->buildObject(nsURI, localName, prefix, &schemaType);
417                 }
418                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedNameType.");
419             }
420         };
421
422         /**
423          * Builder for localizedURIType objects.
424          * 
425          * This is customized to force the element name to be specified.
426          */
427         class SAML_API localizedURITypeBuilder : public xmltooling::XMLObjectBuilder {
428         public:
429             virtual ~localizedURITypeBuilder() {}
430             /** Builder that allows element/type override. */
431             virtual localizedURIType* buildObject(
432                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
433                 ) const;
434         
435             /** Singleton builder. */
436             static localizedURIType* buildlocalizedURIType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
437                 const localizedURITypeBuilder* b = dynamic_cast<const localizedURITypeBuilder*>(
438                     XMLObjectBuilder::getBuilder(xmltooling::QName(SAMLConstants::SAML20MD_NS,localizedURIType::TYPE_NAME))
439                     );
440                 if (b) {
441                     xmltooling::QName schemaType(SAMLConstants::SAML20MD_NS,localizedURIType::TYPE_NAME,SAMLConstants::SAML20MD_PREFIX);
442                     return b->buildObject(nsURI, localName, prefix, &schemaType);
443                 }
444                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedURIType.");
445             }
446         };
447
448         /**
449          * Builder for EndpointType objects.
450          * 
451          * This is customized to force the element name to be specified.
452          */
453         class SAML_API EndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
454         public:
455             virtual ~EndpointTypeBuilder() {}
456             /** Builder that allows element/type override. */
457             virtual EndpointType* buildObject(
458                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
459                 ) const;
460         
461             /** Singleton builder. */
462             static EndpointType* buildEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
463                 const EndpointTypeBuilder* b = dynamic_cast<const EndpointTypeBuilder*>(
464                     XMLObjectBuilder::getBuilder(xmltooling::QName(SAMLConstants::SAML20MD_NS,EndpointType::TYPE_NAME))
465                     );
466                 if (b) {
467                     xmltooling::QName schemaType(SAMLConstants::SAML20MD_NS,EndpointType::TYPE_NAME,SAMLConstants::SAML20MD_PREFIX);
468                     return b->buildObject(nsURI, localName, prefix, &schemaType);
469                 }
470                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for EndpointType.");
471             }
472         };
473
474         /**
475          * Builder for IndexedEndpointType objects.
476          * 
477          * This is customized to force the element name to be specified.
478          */
479         class SAML_API IndexedEndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
480         public:
481             virtual ~IndexedEndpointTypeBuilder() {}
482             /** Builder that allows element/type override. */
483             virtual IndexedEndpointType* buildObject(
484                 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
485                 ) const;
486         
487             /** Singleton builder. */
488             static IndexedEndpointType* buildIndexedEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
489                 const IndexedEndpointTypeBuilder* b = dynamic_cast<const IndexedEndpointTypeBuilder*>(
490                     XMLObjectBuilder::getBuilder(xmltooling::QName(SAMLConstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME))
491                     );
492                 if (b) {
493                     xmltooling::QName schemaType(SAMLConstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME,SAMLConstants::SAML20MD_PREFIX);
494                     return b->buildObject(nsURI, localName, prefix, &schemaType);
495                 }
496                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for IndexedEndpointType.");
497             }
498         };
499
500         /**
501          * Registers builders and validators for SAML 2.0 Metadata classes into the runtime.
502          */
503         void SAML_API registerMetadataClasses();
504
505         /**
506          * Validator suite for SAML 2.0 Metadata schema validation.
507          */
508         extern SAML_API xmltooling::ValidatorSuite MetadataSchemaValidators;
509     };
510 };
511
512 #endif /* __saml2_metadata_h__ */