2 * Copyright 2001-2009 Internet2
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file saml/saml2/metadata/Metadata.h
20 * XMLObjects representing the SAML 2.0 Metadata schema.
23 #ifndef __saml2_metadata_h__
24 #define __saml2_metadata_h__
26 #include <saml/saml2/core/Assertions.h>
27 #include <xmltooling/util/Predicates.h>
31 #define DECL_SAML2MDOBJECTBUILDER(cname) \
32 DECL_XMLOBJECTBUILDER(SAML_API,cname,samlconstants::SAML20MD_NS,samlconstants::SAML20MD_PREFIX)
34 namespace xmlencryption {
35 class XMLTOOL_API EncryptionMethod;
41 * @namespace opensaml::saml2md
42 * SAML 2.0 metadata namespace
47 * Base class for metadata objects that feature a cacheDuration attribute.
49 class SAML_API CacheableSAMLObject : public virtual xmltooling::XMLObject
52 CacheableSAMLObject() {}
54 ~CacheableSAMLObject() {}
55 DECL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION);
59 * Base class for metadata objects that feature a validUntil attribute.
61 class SAML_API TimeBoundSAMLObject : public virtual xmltooling::XMLObject
64 TimeBoundSAMLObject() {}
66 ~TimeBoundSAMLObject() {}
67 DECL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL);
68 /** Returns true iff the object is valid at the current time. */
69 bool isValid() const {
70 return time(NULL) <= getValidUntilEpoch();
72 /** Returns true iff the object is valid at the supplied time. */
73 bool isValid(time_t t) const {
74 return t <= getValidUntilEpoch();
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);
87 DECL_XMLOBJECT_SIMPLE(SAML_API,ActionNamespace,Namespace,SAML 2.0 Metadata Extension ActionNamespace element);
88 DECL_XMLOBJECT_SIMPLE(SAML_API,SourceID,ID,SAML 1.x Metadata Profile SourceID element);
90 BEGIN_XMLOBJECT(SAML_API,localizedNameType,xmltooling::XMLObject,SAML 2.0 localizedNameType type);
91 DECL_STRING_ATTRIB(Lang,LANG);
92 /** localizedNameType local name */
93 static const XMLCh TYPE_NAME[];
96 BEGIN_XMLOBJECT(SAML_API,localizedURIType,xmltooling::XMLObject,SAML 2.0 localizedURIType type);
97 DECL_STRING_ATTRIB(Lang,LANG);
98 /** localizedURIType local name */
99 static const XMLCh TYPE_NAME[];
102 BEGIN_XMLOBJECT(SAML_API,OrganizationName,localizedNameType,SAML 2.0 OrganizationName element);
103 DECL_SIMPLE_CONTENT(Name);
106 BEGIN_XMLOBJECT(SAML_API,OrganizationDisplayName,localizedNameType,SAML 2.0 OrganizationDisplayName element);
107 DECL_SIMPLE_CONTENT(Name);
110 BEGIN_XMLOBJECT(SAML_API,OrganizationURL,localizedURIType,SAML 2.0 OrganizationURL element);
111 DECL_SIMPLE_CONTENT(URL);
114 BEGIN_XMLOBJECT(SAML_API,Extensions,xmltooling::ElementExtensibleXMLObject,SAML 2.0 Extensions element);
115 /** ExtensionsType local name */
116 static const XMLCh TYPE_NAME[];
119 BEGIN_XMLOBJECT(SAML_API,Organization,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 Organization element);
120 DECL_TYPED_CHILD(Extensions);
121 DECL_TYPED_CHILDREN(OrganizationName);
122 DECL_TYPED_CHILDREN(OrganizationDisplayName);
123 DECL_TYPED_CHILDREN(OrganizationURL);
124 /** OrganizationType local name */
125 static const XMLCh TYPE_NAME[];
128 BEGIN_XMLOBJECT(SAML_API,ContactPerson,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 ContactPerson element);
129 DECL_STRING_ATTRIB(ContactType,CONTACTTYPE);
130 DECL_TYPED_CHILD(Extensions);
131 DECL_TYPED_CHILD(Company);
132 DECL_TYPED_CHILD(GivenName);
133 DECL_TYPED_CHILD(SurName);
134 DECL_TYPED_CHILDREN(EmailAddress);
135 DECL_TYPED_CHILDREN(TelephoneNumber);
136 /** ContactType local name */
137 static const XMLCh TYPE_NAME[];
138 /** technical Contact Type */
139 static const XMLCh CONTACT_TECHNICAL[];
140 /** support Contact Type */
141 static const XMLCh CONTACT_SUPPORT[];
142 /** administrative Contact Type */
143 static const XMLCh CONTACT_ADMINISTRATIVE[];
144 /** billing Contact Type */
145 static const XMLCh CONTACT_BILLING[];
146 /** other Contact Type */
147 static const XMLCh CONTACT_OTHER[];
150 BEGIN_XMLOBJECT(SAML_API,AdditionalMetadataLocation,xmltooling::XMLObject,SAML 2.0 AdditionalMetadataLocation element);
151 DECL_STRING_ATTRIB(Namespace,NAMESPACE);
152 DECL_SIMPLE_CONTENT(Location);
153 /** AdditionalMetadataLocationType local name */
154 static const XMLCh TYPE_NAME[];
157 BEGIN_XMLOBJECT(SAML_API,KeyDescriptor,xmltooling::XMLObject,SAML 2.0 KeyDescriptor element);
158 DECL_STRING_ATTRIB(Use,USE);
159 DECL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
160 DECL_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption);
161 /** KeyDescriptorType local name */
162 static const XMLCh TYPE_NAME[];
163 /** encryption Key Type */
164 static const XMLCh KEYTYPE_ENCRYPTION[];
165 /** signing Key Type */
166 static const XMLCh KEYTYPE_SIGNING[];
169 BEGIN_XMLOBJECT4(SAML_API,RoleDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
170 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 RoleDescriptor abstract element);
171 DECL_STRING_ATTRIB(ID,ID);
172 DECL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION);
173 /** Searches the ProtocolSupportEnumeration attribute for the indicated protocol. */
174 virtual bool hasSupport(const XMLCh* protocol) const=0;
175 /** Adds the indicated protocol to the ProtocolSupportEnumeration attribute. */
176 virtual void addSupport(const XMLCh* protocol)=0;
177 DECL_STRING_ATTRIB(ErrorURL,ERRORURL);
178 DECL_TYPED_CHILD(Extensions);
179 DECL_TYPED_CHILDREN(KeyDescriptor);
180 DECL_TYPED_CHILD(Organization);
181 DECL_TYPED_CHILDREN(ContactPerson);
184 BEGIN_XMLOBJECT2(SAML_API,RoleDescriptorType,RoleDescriptor,xmltooling::ElementExtensibleXMLObject,SAML 2.0 RoleDescriptor extension);
187 BEGIN_XMLOBJECT(SAML_API,EndpointType,xmltooling::ElementProxy,SAML 2.0 EndpointType type);
188 DECL_STRING_ATTRIB(Binding,BINDING);
189 DECL_STRING_ATTRIB(Location,LOCATION);
190 DECL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION);
191 /** EndpointType local name */
192 static const XMLCh TYPE_NAME[];
195 BEGIN_XMLOBJECT(SAML_API,IndexedEndpointType,EndpointType,SAML 2.0 IndexedEndpointType type);
196 DECL_INTEGER_ATTRIB(Index,INDEX);
197 DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
198 /** IndexedEndpointType local name */
199 static const XMLCh TYPE_NAME[];
202 BEGIN_XMLOBJECT(SAML_API,ArtifactResolutionService,IndexedEndpointType,SAML 2.0 ArtifactResolutionService element);
205 BEGIN_XMLOBJECT(SAML_API,SingleLogoutService,EndpointType,SAML 2.0 SingleLogoutService element);
208 BEGIN_XMLOBJECT(SAML_API,ManageNameIDService,EndpointType,SAML 2.0 ManageNameIDService element);
211 BEGIN_XMLOBJECT(SAML_API,SSODescriptorType,RoleDescriptor,SAML 2.0 SSODescriptorType abstract type);
212 DECL_TYPED_CHILDREN(ArtifactResolutionService);
213 DECL_TYPED_CHILDREN(SingleLogoutService);
214 DECL_TYPED_CHILDREN(ManageNameIDService);
215 DECL_TYPED_CHILDREN(NameIDFormat);
216 /** SSODescriptorType local name */
217 static const XMLCh TYPE_NAME[];
220 BEGIN_XMLOBJECT(SAML_API,SingleSignOnService,EndpointType,SAML 2.0 SingleSignOnService element);
223 BEGIN_XMLOBJECT(SAML_API,NameIDMappingService,EndpointType,SAML 2.0 NameIDMappingService element);
226 BEGIN_XMLOBJECT(SAML_API,AssertionIDRequestService,EndpointType,SAML 2.0 AssertionIDRequestService element);
229 BEGIN_XMLOBJECT(SAML_API,IDPSSODescriptor,SSODescriptorType,SAML 2.0 IDPSSODescriptor element);
230 DECL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,false);
231 DECL_TYPED_CHILDREN(SingleSignOnService);
232 DECL_TYPED_CHILDREN(NameIDMappingService);
233 DECL_TYPED_CHILDREN(AssertionIDRequestService);
234 DECL_TYPED_CHILDREN(AttributeProfile);
235 DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
236 /** IDPSSODescriptorType local name */
237 static const XMLCh TYPE_NAME[];
241 BEGIN_XMLOBJECT(SAML_API,ServiceName,localizedNameType,SAML 2.0 ServiceName element);
242 DECL_SIMPLE_CONTENT(Name);
245 BEGIN_XMLOBJECT(SAML_API,ServiceDescription,localizedNameType,SAML 2.0 ServiceDescription element);
246 DECL_SIMPLE_CONTENT(Description);
249 BEGIN_XMLOBJECT(SAML_API,RequestedAttribute,saml2::Attribute,SAML 2.0 RequestedAttribute element);
250 DECL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,false);
251 /** RequestedAttributeType local name */
252 static const XMLCh TYPE_NAME[];
255 BEGIN_XMLOBJECT(SAML_API,AttributeConsumingService,xmltooling::XMLObject,SAML 2.0 AttributeConsumingService element);
256 DECL_INTEGER_ATTRIB(Index,INDEX);
257 DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
258 DECL_TYPED_CHILDREN(ServiceName);
259 DECL_TYPED_CHILDREN(ServiceDescription);
260 DECL_TYPED_CHILDREN(RequestedAttribute);
261 /** AttributeConsumingServiceType local name */
262 static const XMLCh TYPE_NAME[];
265 BEGIN_XMLOBJECT(SAML_API,AssertionConsumerService,IndexedEndpointType,SAML 2.0 AssertionConsumerService element);
268 BEGIN_XMLOBJECT(SAML_API,SPSSODescriptor,SSODescriptorType,SAML 2.0 SPSSODescriptor element);
269 DECL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,false);
270 DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
271 DECL_TYPED_CHILDREN(AssertionConsumerService);
272 DECL_TYPED_CHILDREN(AttributeConsumingService);
273 /** SPSSODescriptorType local name */
274 static const XMLCh TYPE_NAME[];
278 BEGIN_XMLOBJECT(SAML_API,AuthnQueryService,EndpointType,SAML 2.0 AuthnQueryService element);
281 BEGIN_XMLOBJECT(SAML_API,AuthnAuthorityDescriptor,RoleDescriptor,SAML 2.0 AuthnAuthorityDescriptor element);
282 DECL_TYPED_CHILDREN(AuthnQueryService);
283 DECL_TYPED_CHILDREN(AssertionIDRequestService);
284 DECL_TYPED_CHILDREN(NameIDFormat);
285 /** AuthnAuthorityDescriptorType local name */
286 static const XMLCh TYPE_NAME[];
290 BEGIN_XMLOBJECT(SAML_API,AuthzService,EndpointType,SAML 2.0 AuthzService element);
293 BEGIN_XMLOBJECT(SAML_API,PDPDescriptor,RoleDescriptor,SAML 2.0 PDPDescriptor element);
294 DECL_TYPED_CHILDREN(AuthzService);
295 DECL_TYPED_CHILDREN(AssertionIDRequestService);
296 DECL_TYPED_CHILDREN(NameIDFormat);
297 /** PDPDescriptorType local name */
298 static const XMLCh TYPE_NAME[];
302 BEGIN_XMLOBJECT(SAML_API,AttributeService,EndpointType,SAML 2.0 AttributeService element);
305 BEGIN_XMLOBJECT(SAML_API,AttributeAuthorityDescriptor,RoleDescriptor,SAML 2.0 AttributeAuthorityDescriptor element);
306 DECL_TYPED_CHILDREN(AttributeService);
307 DECL_TYPED_CHILDREN(AssertionIDRequestService);
308 DECL_TYPED_CHILDREN(NameIDFormat);
309 DECL_TYPED_CHILDREN(AttributeProfile);
310 DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
311 /** AttributeAuthorityDescriptorType local name */
312 static const XMLCh TYPE_NAME[];
316 BEGIN_XMLOBJECT(SAML_API,QueryDescriptorType,RoleDescriptor,SAML 2.0 QueryDescriptorType abstract type);
317 DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
318 DECL_TYPED_CHILDREN(NameIDFormat);
319 /** QueryDescriptorType local name */
320 static const XMLCh TYPE_NAME[];
323 BEGIN_XMLOBJECT(SAML_API,AuthnQueryDescriptorType,QueryDescriptorType,SAML 2.0 AuthnQueryDescriptorType extension type);
324 /** AuthnQueryDescriptorType local name */
325 static const XMLCh TYPE_NAME[];
329 BEGIN_XMLOBJECT(SAML_API,AttributeQueryDescriptorType,QueryDescriptorType,SAML 2.0 AttributeQueryDescriptorType extension type);
330 DECL_TYPED_CHILDREN(AttributeConsumingService);
331 /** AttributeQueryDescriptorType local name */
332 static const XMLCh TYPE_NAME[];
336 BEGIN_XMLOBJECT(SAML_API,AuthzDecisionQueryDescriptorType,QueryDescriptorType,SAML 2.0 AuthzDecisionQueryDescriptorType extension type);
337 DECL_TYPED_CHILDREN(ActionNamespace);
338 /** AuthzDecisionQueryDescriptorType local name */
339 static const XMLCh TYPE_NAME[];
343 BEGIN_XMLOBJECT4(SAML_API,AffiliationDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
344 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 AffiliationDescriptor element);
345 DECL_STRING_ATTRIB(ID,ID);
346 DECL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID);
347 DECL_TYPED_CHILD(Extensions);
348 DECL_TYPED_CHILDREN(AffiliateMember);
349 DECL_TYPED_CHILDREN(KeyDescriptor);
350 /** AffiliationDescriptorType local name */
351 static const XMLCh TYPE_NAME[];
354 BEGIN_XMLOBJECT4(SAML_API,EntityDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
355 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 EntityDescriptor element);
356 DECL_STRING_ATTRIB(ID,ID);
357 DECL_STRING_ATTRIB(EntityID,ENTITYID);
358 DECL_TYPED_CHILD(Extensions);
359 DECL_TYPED_CHILD(AffiliationDescriptor);
360 DECL_TYPED_CHILDREN(RoleDescriptor);
361 DECL_TYPED_CHILDREN(IDPSSODescriptor);
362 DECL_TYPED_CHILDREN(SPSSODescriptor);
363 DECL_TYPED_CHILDREN(AuthnAuthorityDescriptor);
364 DECL_TYPED_CHILDREN(AttributeAuthorityDescriptor);
365 DECL_TYPED_CHILDREN(PDPDescriptor);
366 DECL_TYPED_CHILDREN(AuthnQueryDescriptorType);
367 DECL_TYPED_CHILDREN(AttributeQueryDescriptorType);
368 DECL_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType);
369 DECL_TYPED_CHILD(Organization);
370 DECL_TYPED_CHILDREN(ContactPerson);
371 DECL_TYPED_CHILDREN(AdditionalMetadataLocation);
372 /** Finds an arbitrary role type supporting a given protocol. */
373 virtual const RoleDescriptor* getRoleDescriptor(const xmltooling::QName& qname, const XMLCh* protocol) const=0;
374 /** EntityDescriptorType local name */
375 static const XMLCh TYPE_NAME[];
378 BEGIN_XMLOBJECT3(SAML_API,EntitiesDescriptor,SignableObject,CacheableSAMLObject,
379 TimeBoundSAMLObject,SAML 2.0 EntitiesDescriptor element);
380 DECL_STRING_ATTRIB(ID,ID);
381 DECL_STRING_ATTRIB(Name,NAME);
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[];
389 BEGIN_XMLOBJECT(SAML_API,EntityAttributes,xmltooling::XMLObject,SAML Metadata Extension for Entity Attributes element);
390 DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
391 DECL_TYPED_FOREIGN_CHILDREN(Assertion,saml2);
392 /** EntityAttributesType local name */
393 static const XMLCh TYPE_NAME[];
397 * Predicate to test a role for validity and protocol support.
399 class isValidForProtocol
405 * @param protocol support constant to test for
407 isValidForProtocol(const XMLCh* protocol) : m_time(time(NULL)), m_protocol(protocol) {
411 * Returns true iff the supplied role is valid now and supports the right protocol.
413 * @param role role to test
414 * @return result of predicate
416 bool operator()(const RoleDescriptor* role) const {
417 return role ? (role->isValid(m_time) && role->hasSupport(m_protocol)) : false;
422 const XMLCh* m_protocol;
426 * Predicate to test a role for type equivalence, validity, and protocol support.
428 class ofTypeValidForProtocol : public isValidForProtocol, public xmltooling::hasSchemaType
434 * @param q schema type to test for
435 * @param protocol support constant to test for
437 ofTypeValidForProtocol(const xmltooling::QName& q, const XMLCh* protocol)
438 : isValidForProtocol(protocol), xmltooling::hasSchemaType(q) {
442 * Returns true iff the supplied role is of the right type, valid now, and supports the right protocol.
444 * @param role role to test
445 * @return result of predicate
447 bool operator()(const RoleDescriptor* role) const {
448 return xmltooling::hasSchemaType::operator()(role) && isValidForProtocol::operator()(role);
452 DECL_SAML2MDOBJECTBUILDER(AdditionalMetadataLocation);
453 DECL_SAML2MDOBJECTBUILDER(AffiliateMember);
454 DECL_SAML2MDOBJECTBUILDER(AffiliationDescriptor);
455 DECL_SAML2MDOBJECTBUILDER(ArtifactResolutionService);
456 DECL_SAML2MDOBJECTBUILDER(AssertionConsumerService);
457 DECL_SAML2MDOBJECTBUILDER(AssertionIDRequestService);
458 DECL_SAML2MDOBJECTBUILDER(AttributeAuthorityDescriptor);
459 DECL_SAML2MDOBJECTBUILDER(AttributeConsumingService);
460 DECL_SAML2MDOBJECTBUILDER(AttributeProfile);
461 DECL_SAML2MDOBJECTBUILDER(AttributeService);
462 DECL_SAML2MDOBJECTBUILDER(AuthnAuthorityDescriptor);
463 DECL_SAML2MDOBJECTBUILDER(AuthnQueryService);
464 DECL_SAML2MDOBJECTBUILDER(AuthzService);
465 DECL_SAML2MDOBJECTBUILDER(Company);
466 DECL_SAML2MDOBJECTBUILDER(ContactPerson);
467 DECL_SAML2MDOBJECTBUILDER(EmailAddress);
468 DECL_SAML2MDOBJECTBUILDER(EntitiesDescriptor);
469 DECL_SAML2MDOBJECTBUILDER(EntityDescriptor);
470 DECL_SAML2MDOBJECTBUILDER(Extensions);
471 DECL_SAML2MDOBJECTBUILDER(GivenName);
472 DECL_SAML2MDOBJECTBUILDER(IDPSSODescriptor);
473 DECL_SAML2MDOBJECTBUILDER(KeyDescriptor);
474 DECL_SAML2MDOBJECTBUILDER(ManageNameIDService);
475 DECL_SAML2MDOBJECTBUILDER(NameIDFormat);
476 DECL_SAML2MDOBJECTBUILDER(NameIDMappingService);
477 DECL_SAML2MDOBJECTBUILDER(Organization);
478 DECL_SAML2MDOBJECTBUILDER(OrganizationName);
479 DECL_SAML2MDOBJECTBUILDER(OrganizationDisplayName);
480 DECL_SAML2MDOBJECTBUILDER(OrganizationURL);
481 DECL_SAML2MDOBJECTBUILDER(PDPDescriptor);
482 DECL_SAML2MDOBJECTBUILDER(RequestedAttribute);
483 DECL_SAML2MDOBJECTBUILDER(ServiceDescription);
484 DECL_SAML2MDOBJECTBUILDER(ServiceName);
485 DECL_SAML2MDOBJECTBUILDER(SingleLogoutService);
486 DECL_SAML2MDOBJECTBUILDER(SingleSignOnService);
487 DECL_SAML2MDOBJECTBUILDER(SPSSODescriptor);
488 DECL_SAML2MDOBJECTBUILDER(SurName);
489 DECL_SAML2MDOBJECTBUILDER(TelephoneNumber);
491 DECL_XMLOBJECTBUILDER(SAML_API,ActionNamespace,samlconstants::SAML20MD_QUERY_EXT_NS,samlconstants::SAML20MD_QUERY_EXT_PREFIX);
492 DECL_XMLOBJECTBUILDER(SAML_API,SourceID,samlconstants::SAML1MD_NS,samlconstants::SAML1MD_PREFIX);
493 DECL_XMLOBJECTBUILDER(SAML_API,EntityAttributes,samlconstants::SAML20MD_ENTITY_ATTRIBUTE_NS,samlconstants::SAML20MD_ENTITY_ATTRIBUTE_PREFIX);
496 * Builder for localizedNameType objects.
498 * This is customized to force the element name to be specified.
500 class SAML_API localizedNameTypeBuilder : public xmltooling::XMLObjectBuilder {
502 virtual ~localizedNameTypeBuilder() {}
503 /** Builder that allows element/type override. */
504 #ifdef HAVE_COVARIANT_RETURNS
505 virtual localizedNameType* buildObject(
507 virtual xmltooling::XMLObject* buildObject(
509 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
512 /** Singleton builder. */
513 static localizedNameType* buildlocalizedNameType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
514 const localizedNameTypeBuilder* b = dynamic_cast<const localizedNameTypeBuilder*>(
515 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME))
518 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
519 #ifdef HAVE_COVARIANT_RETURNS
520 return b->buildObject(nsURI, localName, prefix, &schemaType);
522 return dynamic_cast<localizedNameType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
525 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedNameType.");
530 * Builder for localizedURIType objects.
532 * This is customized to force the element name to be specified.
534 class SAML_API localizedURITypeBuilder : public xmltooling::XMLObjectBuilder {
536 virtual ~localizedURITypeBuilder() {}
537 /** Builder that allows element/type override. */
538 #ifdef HAVE_COVARIANT_RETURNS
539 virtual localizedURIType* buildObject(
541 virtual xmltooling::XMLObject* buildObject(
543 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
546 /** Singleton builder. */
547 static localizedURIType* buildlocalizedURIType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
548 const localizedURITypeBuilder* b = dynamic_cast<const localizedURITypeBuilder*>(
549 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME))
552 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
553 #ifdef HAVE_COVARIANT_RETURNS
554 return b->buildObject(nsURI, localName, prefix, &schemaType);
556 return dynamic_cast<localizedURIType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
559 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedURIType.");
564 * Builder for EndpointType objects.
566 * This is customized to force the element name to be specified.
568 class SAML_API EndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
570 virtual ~EndpointTypeBuilder() {}
571 /** Builder that allows element/type override. */
572 #ifdef HAVE_COVARIANT_RETURNS
573 virtual EndpointType* buildObject(
575 virtual xmltooling::XMLObject* buildObject(
577 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
580 /** Singleton builder. */
581 static EndpointType* buildEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
582 const EndpointTypeBuilder* b = dynamic_cast<const EndpointTypeBuilder*>(
583 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME))
586 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
587 #ifdef HAVE_COVARIANT_RETURNS
588 return b->buildObject(nsURI, localName, prefix, &schemaType);
590 return dynamic_cast<EndpointType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
593 throw xmltooling::XMLObjectException("Unable to obtain typed builder for EndpointType.");
598 * Builder for IndexedEndpointType objects.
600 * This is customized to force the element name to be specified.
602 class SAML_API IndexedEndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
604 virtual ~IndexedEndpointTypeBuilder() {}
605 /** Builder that allows element/type override. */
606 #ifdef HAVE_COVARIANT_RETURNS
607 virtual IndexedEndpointType* buildObject(
609 virtual xmltooling::XMLObject* buildObject(
611 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
614 /** Singleton builder. */
615 static IndexedEndpointType* buildIndexedEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
616 const IndexedEndpointTypeBuilder* b = dynamic_cast<const IndexedEndpointTypeBuilder*>(
617 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME))
620 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
621 #ifdef HAVE_COVARIANT_RETURNS
622 return b->buildObject(nsURI, localName, prefix, &schemaType);
624 return dynamic_cast<IndexedEndpointType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
627 throw xmltooling::XMLObjectException("Unable to obtain typed builder for IndexedEndpointType.");
632 * Builder for RoleDescriptor extension objects.
634 * This is customized to force the schema type to be specified.
636 class SAML_API RoleDescriptorBuilder : public xmltooling::XMLObjectBuilder {
638 virtual ~RoleDescriptorBuilder() {}
639 /** Builder that allows element/type override. */
640 #ifdef HAVE_COVARIANT_RETURNS
641 virtual RoleDescriptor* buildObject(
643 virtual xmltooling::XMLObject* buildObject(
645 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
648 /** Singleton builder. */
649 static RoleDescriptor* buildRoleDescriptor(const xmltooling::QName& schemaType) {
650 const RoleDescriptorBuilder* b = dynamic_cast<const RoleDescriptorBuilder*>(
651 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,RoleDescriptor::LOCAL_NAME))
654 #ifdef HAVE_COVARIANT_RETURNS
655 return b->buildObject(samlconstants::SAML20MD_NS, RoleDescriptor::LOCAL_NAME, samlconstants::SAML20MD_PREFIX, &schemaType);
657 return dynamic_cast<RoleDescriptor*>(b->buildObject(samlconstants::SAML20MD_NS, RoleDescriptor::LOCAL_NAME, samlconstants::SAML20MD_PREFIX, &schemaType));
660 throw xmltooling::XMLObjectException("Unable to obtain typed builder for RoleDescriptor.");
665 * Builder for AuthnQueryDescriptorType objects.
667 * This is customized to return a RoleDescriptor element with an
668 * xsi:type of AuthnQueryDescriptorType.
670 class SAML_API AuthnQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
672 virtual ~AuthnQueryDescriptorTypeBuilder() {}
673 /** Default builder. */
674 #ifdef HAVE_COVARIANT_RETURNS
675 virtual AuthnQueryDescriptorType* buildObject() const {
677 virtual xmltooling::XMLObject* buildObject() const {
679 xmltooling::QName schemaType(
680 samlconstants::SAML20MD_QUERY_EXT_NS,AuthnQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
683 samlconstants::SAML20MD_NS,AuthnQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
686 /** Builder that allows element/type override. */
687 #ifdef HAVE_COVARIANT_RETURNS
688 virtual AuthnQueryDescriptorType* buildObject(
690 virtual xmltooling::XMLObject* buildObject(
692 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
695 /** Singleton builder. */
696 static AuthnQueryDescriptorType* buildAuthnQueryDescriptorType() {
697 const AuthnQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthnQueryDescriptorTypeBuilder*>(
698 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthnQueryDescriptorType::TYPE_NAME))
701 #ifdef HAVE_COVARIANT_RETURNS
702 return b->buildObject();
704 return dynamic_cast<AuthnQueryDescriptorType*>(b->buildObject());
707 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthnQueryDescriptorType.");
712 * Builder for AttributeQueryDescriptorType objects.
714 * This is customized to return a RoleDescriptor element with an
715 * xsi:type of AttributeQueryDescriptorType.
717 class SAML_API AttributeQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
719 virtual ~AttributeQueryDescriptorTypeBuilder() {}
720 /** Default builder. */
721 #ifdef HAVE_COVARIANT_RETURNS
722 virtual AttributeQueryDescriptorType* buildObject() const {
724 virtual xmltooling::XMLObject* buildObject() const {
726 xmltooling::QName schemaType(
727 samlconstants::SAML20MD_QUERY_EXT_NS,AttributeQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
730 samlconstants::SAML20MD_NS,AttributeQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
733 /** Builder that allows element/type override. */
734 #ifdef HAVE_COVARIANT_RETURNS
735 virtual AttributeQueryDescriptorType* buildObject(
737 virtual xmltooling::XMLObject* buildObject(
739 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
742 /** Singleton builder. */
743 static AttributeQueryDescriptorType* buildAttributeQueryDescriptorType() {
744 const AttributeQueryDescriptorTypeBuilder* b = dynamic_cast<const AttributeQueryDescriptorTypeBuilder*>(
745 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AttributeQueryDescriptorType::TYPE_NAME))
748 #ifdef HAVE_COVARIANT_RETURNS
749 return b->buildObject();
751 return dynamic_cast<AttributeQueryDescriptorType*>(b->buildObject());
754 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AttributeQueryDescriptorType.");
759 * Builder for AuthzDecisionQueryDescriptorType objects.
761 * This is customized to return a RoleDescriptor element with an
762 * xsi:type of AuthzDecisionQueryDescriptorType.
764 class SAML_API AuthzDecisionQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
766 virtual ~AuthzDecisionQueryDescriptorTypeBuilder() {}
767 /** Default builder. */
768 #ifdef HAVE_COVARIANT_RETURNS
769 virtual AuthzDecisionQueryDescriptorType* buildObject() const {
771 virtual xmltooling::XMLObject* buildObject() const {
773 xmltooling::QName schemaType(
774 samlconstants::SAML20MD_QUERY_EXT_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
777 samlconstants::SAML20MD_NS,AuthzDecisionQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
780 /** Builder that allows element/type override. */
781 #ifdef HAVE_COVARIANT_RETURNS
782 virtual AuthzDecisionQueryDescriptorType* buildObject(
784 virtual xmltooling::XMLObject* buildObject(
786 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
789 /** Singleton builder. */
790 static AuthzDecisionQueryDescriptorType* buildAuthzDecisionQueryDescriptorType() {
791 const AuthzDecisionQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthzDecisionQueryDescriptorTypeBuilder*>(
792 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME))
795 #ifdef HAVE_COVARIANT_RETURNS
796 return b->buildObject();
798 return dynamic_cast<AuthzDecisionQueryDescriptorType*>(b->buildObject());
801 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthzDecisionQueryDescriptorType.");
806 * Registers builders and validators for SAML 2.0 Metadata classes into the runtime.
808 void SAML_API registerMetadataClasses();
812 #endif /* __saml2_metadata_h__ */