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