2 * Copyright 2001-2010 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>
29 #include <xercesc/util/XMLUniDefs.hpp>
30 #include <xmltooling/util/Predicates.h>
33 #define DECL_SAML2MDOBJECTBUILDER(cname) \
34 DECL_XMLOBJECTBUILDER(SAML_API,cname,samlconstants::SAML20MD_NS,samlconstants::SAML20MD_PREFIX)
36 namespace xmltooling {
37 class XMLTOOL_API Credential;
38 class XMLTOOL_API CredentialResolver;
41 namespace xmlencryption {
42 class XMLTOOL_API EncryptionMethod;
48 * @namespace opensaml::saml2md
49 * SAML 2.0 metadata namespace
53 class SAML_API DigestMethod;
54 class SAML_API SigningMethod;
57 * Base class for metadata objects that feature a cacheDuration attribute.
59 class SAML_API CacheableSAMLObject : public virtual xmltooling::XMLObject
62 CacheableSAMLObject() {}
64 ~CacheableSAMLObject() {}
65 DECL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION);
69 * Base class for metadata objects that feature a validUntil attribute.
71 class SAML_API TimeBoundSAMLObject : public virtual xmltooling::XMLObject
74 TimeBoundSAMLObject() {}
76 ~TimeBoundSAMLObject() {}
77 DECL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL);
78 /** Returns true iff the object is valid at the current time. */
79 bool isValid() const {
80 return time(nullptr) <= getValidUntilEpoch();
82 /** Returns true iff the object is valid at the supplied time. */
83 bool isValid(time_t t) const {
84 return t <= getValidUntilEpoch();
88 DECL_XMLOBJECT_SIMPLE(SAML_API,AffiliateMember,ID,SAML 2.0 AffiliateMember element);
89 DECL_XMLOBJECT_SIMPLE(SAML_API,AttributeProfile,ProfileURI,SAML 2.0 AttributeProfile element);
90 DECL_XMLOBJECT_SIMPLE(SAML_API,Company,Name,SAML 2.0 Company element);
91 DECL_XMLOBJECT_SIMPLE(SAML_API,EmailAddress,Address,SAML 2.0 EmailAddress element);
92 DECL_XMLOBJECT_SIMPLE(SAML_API,GivenName,Name,SAML 2.0 GivenName element);
93 DECL_XMLOBJECT_SIMPLE(SAML_API,NameIDFormat,Format,SAML 2.0 NameIDFormat element);
94 DECL_XMLOBJECT_SIMPLE(SAML_API,SurName,Name,SAML 2.0 SurName element);
95 DECL_XMLOBJECT_SIMPLE(SAML_API,TelephoneNumber,Number,SAML 2.0 TelephoneNumber element);
97 DECL_XMLOBJECT_SIMPLE(SAML_API,ActionNamespace,Namespace,SAML 2.0 Metadata Extension ActionNamespace element);
98 DECL_XMLOBJECT_SIMPLE(SAML_API,SourceID,ID,SAML 1.x Metadata Profile SourceID element);
100 BEGIN_XMLOBJECT(SAML_API,localizedNameType,xmltooling::XMLObject,SAML 2.0 localizedNameType type);
101 DECL_STRING_ATTRIB(Lang,LANG);
102 /** localizedNameType local name */
103 static const XMLCh TYPE_NAME[];
106 BEGIN_XMLOBJECT(SAML_API,localizedURIType,xmltooling::XMLObject,SAML 2.0 localizedURIType type);
107 DECL_STRING_ATTRIB(Lang,LANG);
108 /** localizedURIType local name */
109 static const XMLCh TYPE_NAME[];
112 BEGIN_XMLOBJECT(SAML_API,OrganizationName,localizedNameType,SAML 2.0 OrganizationName element);
113 DECL_SIMPLE_CONTENT(Name);
116 BEGIN_XMLOBJECT(SAML_API,OrganizationDisplayName,localizedNameType,SAML 2.0 OrganizationDisplayName element);
117 DECL_SIMPLE_CONTENT(Name);
120 BEGIN_XMLOBJECT(SAML_API,OrganizationURL,localizedURIType,SAML 2.0 OrganizationURL element);
121 DECL_SIMPLE_CONTENT(URL);
124 BEGIN_XMLOBJECT(SAML_API,Extensions,xmltooling::ElementExtensibleXMLObject,SAML 2.0 Extensions element);
125 /** ExtensionsType local name */
126 static const XMLCh TYPE_NAME[];
129 BEGIN_XMLOBJECT(SAML_API,Organization,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 Organization element);
130 DECL_TYPED_CHILD(Extensions);
131 DECL_TYPED_CHILDREN(OrganizationName);
132 DECL_TYPED_CHILDREN(OrganizationDisplayName);
133 DECL_TYPED_CHILDREN(OrganizationURL);
134 /** OrganizationType local name */
135 static const XMLCh TYPE_NAME[];
138 BEGIN_XMLOBJECT(SAML_API,ContactPerson,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 ContactPerson element);
139 DECL_STRING_ATTRIB(ContactType,CONTACTTYPE);
140 DECL_TYPED_CHILD(Extensions);
141 DECL_TYPED_CHILD(Company);
142 DECL_TYPED_CHILD(GivenName);
143 DECL_TYPED_CHILD(SurName);
144 DECL_TYPED_CHILDREN(EmailAddress);
145 DECL_TYPED_CHILDREN(TelephoneNumber);
146 /** ContactType local name */
147 static const XMLCh TYPE_NAME[];
148 /** technical Contact Type */
149 static const XMLCh CONTACT_TECHNICAL[];
150 /** support Contact Type */
151 static const XMLCh CONTACT_SUPPORT[];
152 /** administrative Contact Type */
153 static const XMLCh CONTACT_ADMINISTRATIVE[];
154 /** billing Contact Type */
155 static const XMLCh CONTACT_BILLING[];
156 /** other Contact Type */
157 static const XMLCh CONTACT_OTHER[];
160 BEGIN_XMLOBJECT(SAML_API,AdditionalMetadataLocation,xmltooling::XMLObject,SAML 2.0 AdditionalMetadataLocation element);
161 DECL_STRING_ATTRIB(Namespace,NAMESPACE);
162 DECL_SIMPLE_CONTENT(Location);
163 /** AdditionalMetadataLocationType local name */
164 static const XMLCh TYPE_NAME[];
167 BEGIN_XMLOBJECT(SAML_API,KeyDescriptor,xmltooling::XMLObject,SAML 2.0 KeyDescriptor element);
168 DECL_STRING_ATTRIB(Use,USE);
169 DECL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
170 DECL_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption);
171 /** KeyDescriptorType local name */
172 static const XMLCh TYPE_NAME[];
173 /** encryption Key Type */
174 static const XMLCh KEYTYPE_ENCRYPTION[];
175 /** signing Key Type */
176 static const XMLCh KEYTYPE_SIGNING[];
179 BEGIN_XMLOBJECT4(SAML_API,RoleDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
180 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 RoleDescriptor abstract element);
181 DECL_STRING_ATTRIB(ID,ID);
182 DECL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION);
183 /** Searches the ProtocolSupportEnumeration attribute for the indicated protocol. */
184 virtual bool hasSupport(const XMLCh* protocol) const=0;
185 /** Adds the indicated protocol to the ProtocolSupportEnumeration attribute. */
186 virtual void addSupport(const XMLCh* protocol)=0;
187 DECL_STRING_ATTRIB(ErrorURL,ERRORURL);
188 DECL_TYPED_CHILD(Extensions);
189 DECL_TYPED_CHILDREN(KeyDescriptor);
190 DECL_TYPED_CHILD(Organization);
191 DECL_TYPED_CHILDREN(ContactPerson);
192 /** Returns the first digest method supported by the role and the underlying implementation, if any. */
193 virtual const DigestMethod* getDigestMethod() const;
194 /** Returns the first signing method supported by the role and the underlying implementation, if any, along with a matching credential. */
195 virtual std::pair<const SigningMethod*,const xmltooling::Credential*> getSigningMethod(
196 const xmltooling::CredentialResolver& resolver, xmltooling::CredentialCriteria& cc
200 BEGIN_XMLOBJECT2(SAML_API,RoleDescriptorType,RoleDescriptor,xmltooling::ElementExtensibleXMLObject,SAML 2.0 RoleDescriptor extension);
203 BEGIN_XMLOBJECT(SAML_API,EndpointType,xmltooling::ElementProxy,SAML 2.0 EndpointType type);
204 DECL_STRING_ATTRIB(Binding,BINDING);
205 DECL_STRING_ATTRIB(Location,LOCATION);
206 DECL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION);
207 /** EndpointType local name */
208 static const XMLCh TYPE_NAME[];
211 BEGIN_XMLOBJECT(SAML_API,IndexedEndpointType,EndpointType,SAML 2.0 IndexedEndpointType type);
212 DECL_INTEGER_ATTRIB(Index,INDEX);
213 DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
214 /** IndexedEndpointType local name */
215 static const XMLCh TYPE_NAME[];
218 BEGIN_XMLOBJECT(SAML_API,ArtifactResolutionService,IndexedEndpointType,SAML 2.0 ArtifactResolutionService element);
221 BEGIN_XMLOBJECT(SAML_API,SingleLogoutService,EndpointType,SAML 2.0 SingleLogoutService element);
224 BEGIN_XMLOBJECT(SAML_API,ManageNameIDService,EndpointType,SAML 2.0 ManageNameIDService element);
227 BEGIN_XMLOBJECT(SAML_API,SSODescriptorType,RoleDescriptor,SAML 2.0 SSODescriptorType abstract type);
228 DECL_TYPED_CHILDREN(ArtifactResolutionService);
229 DECL_TYPED_CHILDREN(SingleLogoutService);
230 DECL_TYPED_CHILDREN(ManageNameIDService);
231 DECL_TYPED_CHILDREN(NameIDFormat);
232 /** SSODescriptorType local name */
233 static const XMLCh TYPE_NAME[];
236 BEGIN_XMLOBJECT(SAML_API,SingleSignOnService,EndpointType,SAML 2.0 SingleSignOnService element);
239 BEGIN_XMLOBJECT(SAML_API,NameIDMappingService,EndpointType,SAML 2.0 NameIDMappingService element);
242 BEGIN_XMLOBJECT(SAML_API,AssertionIDRequestService,EndpointType,SAML 2.0 AssertionIDRequestService element);
245 BEGIN_XMLOBJECT(SAML_API,IDPSSODescriptor,SSODescriptorType,SAML 2.0 IDPSSODescriptor element);
246 DECL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,false);
247 DECL_TYPED_CHILDREN(SingleSignOnService);
248 DECL_TYPED_CHILDREN(NameIDMappingService);
249 DECL_TYPED_CHILDREN(AssertionIDRequestService);
250 DECL_TYPED_CHILDREN(AttributeProfile);
251 DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
252 /** IDPSSODescriptorType local name */
253 static const XMLCh TYPE_NAME[];
257 BEGIN_XMLOBJECT(SAML_API,ServiceName,localizedNameType,SAML 2.0 ServiceName element);
258 DECL_SIMPLE_CONTENT(Name);
261 BEGIN_XMLOBJECT(SAML_API,ServiceDescription,localizedNameType,SAML 2.0 ServiceDescription element);
262 DECL_SIMPLE_CONTENT(Description);
265 BEGIN_XMLOBJECT(SAML_API,RequestedAttribute,saml2::Attribute,SAML 2.0 RequestedAttribute element);
266 DECL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,false);
267 /** RequestedAttributeType local name */
268 static const XMLCh TYPE_NAME[];
271 BEGIN_XMLOBJECT(SAML_API,AttributeConsumingService,xmltooling::XMLObject,SAML 2.0 AttributeConsumingService element);
272 DECL_INTEGER_ATTRIB(Index,INDEX);
273 DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
274 DECL_TYPED_CHILDREN(ServiceName);
275 DECL_TYPED_CHILDREN(ServiceDescription);
276 DECL_TYPED_CHILDREN(RequestedAttribute);
277 /** AttributeConsumingServiceType local name */
278 static const XMLCh TYPE_NAME[];
281 BEGIN_XMLOBJECT(SAML_API,AssertionConsumerService,IndexedEndpointType,SAML 2.0 AssertionConsumerService element);
284 BEGIN_XMLOBJECT(SAML_API,SPSSODescriptor,SSODescriptorType,SAML 2.0 SPSSODescriptor element);
285 DECL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,false);
286 DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
287 DECL_TYPED_CHILDREN(AssertionConsumerService);
288 DECL_TYPED_CHILDREN(AttributeConsumingService);
289 /** SPSSODescriptorType local name */
290 static const XMLCh TYPE_NAME[];
294 BEGIN_XMLOBJECT(SAML_API,AuthnQueryService,EndpointType,SAML 2.0 AuthnQueryService element);
297 BEGIN_XMLOBJECT(SAML_API,AuthnAuthorityDescriptor,RoleDescriptor,SAML 2.0 AuthnAuthorityDescriptor element);
298 DECL_TYPED_CHILDREN(AuthnQueryService);
299 DECL_TYPED_CHILDREN(AssertionIDRequestService);
300 DECL_TYPED_CHILDREN(NameIDFormat);
301 /** AuthnAuthorityDescriptorType local name */
302 static const XMLCh TYPE_NAME[];
306 BEGIN_XMLOBJECT(SAML_API,AuthzService,EndpointType,SAML 2.0 AuthzService element);
309 BEGIN_XMLOBJECT(SAML_API,PDPDescriptor,RoleDescriptor,SAML 2.0 PDPDescriptor element);
310 DECL_TYPED_CHILDREN(AuthzService);
311 DECL_TYPED_CHILDREN(AssertionIDRequestService);
312 DECL_TYPED_CHILDREN(NameIDFormat);
313 /** PDPDescriptorType local name */
314 static const XMLCh TYPE_NAME[];
318 BEGIN_XMLOBJECT(SAML_API,AttributeService,EndpointType,SAML 2.0 AttributeService element);
321 BEGIN_XMLOBJECT(SAML_API,AttributeAuthorityDescriptor,RoleDescriptor,SAML 2.0 AttributeAuthorityDescriptor element);
322 DECL_TYPED_CHILDREN(AttributeService);
323 DECL_TYPED_CHILDREN(AssertionIDRequestService);
324 DECL_TYPED_CHILDREN(NameIDFormat);
325 DECL_TYPED_CHILDREN(AttributeProfile);
326 DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
327 /** AttributeAuthorityDescriptorType local name */
328 static const XMLCh TYPE_NAME[];
332 BEGIN_XMLOBJECT(SAML_API,QueryDescriptorType,RoleDescriptor,SAML 2.0 QueryDescriptorType abstract type);
333 DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
334 DECL_TYPED_CHILDREN(NameIDFormat);
335 /** QueryDescriptorType local name */
336 static const XMLCh TYPE_NAME[];
339 BEGIN_XMLOBJECT(SAML_API,AuthnQueryDescriptorType,QueryDescriptorType,SAML 2.0 AuthnQueryDescriptorType extension type);
340 /** AuthnQueryDescriptorType local name */
341 static const XMLCh TYPE_NAME[];
345 BEGIN_XMLOBJECT(SAML_API,AttributeQueryDescriptorType,QueryDescriptorType,SAML 2.0 AttributeQueryDescriptorType extension type);
346 DECL_TYPED_CHILDREN(AttributeConsumingService);
347 /** AttributeQueryDescriptorType local name */
348 static const XMLCh TYPE_NAME[];
352 BEGIN_XMLOBJECT(SAML_API,AuthzDecisionQueryDescriptorType,QueryDescriptorType,SAML 2.0 AuthzDecisionQueryDescriptorType extension type);
353 DECL_TYPED_CHILDREN(ActionNamespace);
354 /** AuthzDecisionQueryDescriptorType local name */
355 static const XMLCh TYPE_NAME[];
359 BEGIN_XMLOBJECT4(SAML_API,AffiliationDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
360 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 AffiliationDescriptor element);
361 DECL_STRING_ATTRIB(ID,ID);
362 DECL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID);
363 DECL_TYPED_CHILD(Extensions);
364 DECL_TYPED_CHILDREN(AffiliateMember);
365 DECL_TYPED_CHILDREN(KeyDescriptor);
366 /** AffiliationDescriptorType local name */
367 static const XMLCh TYPE_NAME[];
370 BEGIN_XMLOBJECT4(SAML_API,EntityDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
371 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 EntityDescriptor element);
372 DECL_STRING_ATTRIB(ID,ID);
373 DECL_STRING_ATTRIB(EntityID,ENTITYID);
374 DECL_TYPED_CHILD(Extensions);
375 DECL_TYPED_CHILD(AffiliationDescriptor);
376 DECL_TYPED_CHILDREN(RoleDescriptor);
377 DECL_TYPED_CHILDREN(IDPSSODescriptor);
378 DECL_TYPED_CHILDREN(SPSSODescriptor);
379 DECL_TYPED_CHILDREN(AuthnAuthorityDescriptor);
380 DECL_TYPED_CHILDREN(AttributeAuthorityDescriptor);
381 DECL_TYPED_CHILDREN(PDPDescriptor);
382 DECL_TYPED_CHILDREN(AuthnQueryDescriptorType);
383 DECL_TYPED_CHILDREN(AttributeQueryDescriptorType);
384 DECL_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType);
385 DECL_TYPED_CHILD(Organization);
386 DECL_TYPED_CHILDREN(ContactPerson);
387 DECL_TYPED_CHILDREN(AdditionalMetadataLocation);
388 /** Finds an arbitrary role type supporting a given protocol. */
389 virtual const RoleDescriptor* getRoleDescriptor(const xmltooling::QName& qname, const XMLCh* protocol) const=0;
390 /** EntityDescriptorType local name */
391 static const XMLCh TYPE_NAME[];
394 BEGIN_XMLOBJECT3(SAML_API,EntitiesDescriptor,SignableObject,CacheableSAMLObject,
395 TimeBoundSAMLObject,SAML 2.0 EntitiesDescriptor element);
396 DECL_STRING_ATTRIB(ID,ID);
397 DECL_STRING_ATTRIB(Name,NAME);
398 DECL_TYPED_CHILD(Extensions);
399 DECL_TYPED_CHILDREN(EntityDescriptor);
400 DECL_TYPED_CHILDREN(EntitiesDescriptor);
401 /** EntitiesDescriptorType local name */
402 static const XMLCh TYPE_NAME[];
405 BEGIN_XMLOBJECT(SAML_API,EntityAttributes,xmltooling::XMLObject,SAML Metadata Extension for Entity Attributes element);
406 DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
407 DECL_TYPED_FOREIGN_CHILDREN(Assertion,saml2);
408 /** EntityAttributesType local name */
409 static const XMLCh TYPE_NAME[];
412 BEGIN_XMLOBJECT(SAML_API,DigestMethod,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Algorithm Support DigestMethod element);
413 DECL_STRING_ATTRIB(Algorithm,ALGORITHM);
414 /** DigestMethodType local name */
415 static const XMLCh TYPE_NAME[];
418 BEGIN_XMLOBJECT(SAML_API,SigningMethod,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Algorithm Support SigningMethod element);
419 DECL_STRING_ATTRIB(Algorithm,ALGORITHM);
420 DECL_INTEGER_ATTRIB(MinKeySize,MINKEYSIZE);
421 DECL_INTEGER_ATTRIB(MaxKeySize,MAXKEYSIZE);
422 /** SigningMethodType local name */
423 static const XMLCh TYPE_NAME[];
427 * Predicate to test a role for validity and protocol support.
429 class isValidForProtocol
435 * @param protocol support constant to test for
437 isValidForProtocol(const XMLCh* protocol) : m_time(time(nullptr)), m_protocol(protocol) {
441 * Returns true iff the supplied role is valid now and supports the right protocol.
443 * @param role role to test
444 * @return result of predicate
446 bool operator()(const RoleDescriptor* role) const {
447 return role ? (role->isValid(m_time) && role->hasSupport(m_protocol)) : false;
452 const XMLCh* m_protocol;
456 * Predicate to test a role for type equivalence, validity, and protocol support.
458 class ofTypeValidForProtocol : public isValidForProtocol, public xmltooling::hasSchemaType
464 * @param q schema type to test for
465 * @param protocol support constant to test for
467 ofTypeValidForProtocol(const xmltooling::QName& q, const XMLCh* protocol)
468 : isValidForProtocol(protocol), xmltooling::hasSchemaType(q) {
472 * Returns true iff the supplied role is of the right type, valid now, and supports the right protocol.
474 * @param role role to test
475 * @return result of predicate
477 bool operator()(const RoleDescriptor* role) const {
478 return xmltooling::hasSchemaType::operator()(role) && isValidForProtocol::operator()(role);
482 DECL_SAML2MDOBJECTBUILDER(AdditionalMetadataLocation);
483 DECL_SAML2MDOBJECTBUILDER(AffiliateMember);
484 DECL_SAML2MDOBJECTBUILDER(AffiliationDescriptor);
485 DECL_SAML2MDOBJECTBUILDER(ArtifactResolutionService);
486 DECL_SAML2MDOBJECTBUILDER(AssertionConsumerService);
487 DECL_SAML2MDOBJECTBUILDER(AssertionIDRequestService);
488 DECL_SAML2MDOBJECTBUILDER(AttributeAuthorityDescriptor);
489 DECL_SAML2MDOBJECTBUILDER(AttributeConsumingService);
490 DECL_SAML2MDOBJECTBUILDER(AttributeProfile);
491 DECL_SAML2MDOBJECTBUILDER(AttributeService);
492 DECL_SAML2MDOBJECTBUILDER(AuthnAuthorityDescriptor);
493 DECL_SAML2MDOBJECTBUILDER(AuthnQueryService);
494 DECL_SAML2MDOBJECTBUILDER(AuthzService);
495 DECL_SAML2MDOBJECTBUILDER(Company);
496 DECL_SAML2MDOBJECTBUILDER(ContactPerson);
497 DECL_SAML2MDOBJECTBUILDER(EmailAddress);
498 DECL_SAML2MDOBJECTBUILDER(EntitiesDescriptor);
499 DECL_SAML2MDOBJECTBUILDER(EntityDescriptor);
500 DECL_SAML2MDOBJECTBUILDER(Extensions);
501 DECL_SAML2MDOBJECTBUILDER(GivenName);
502 DECL_SAML2MDOBJECTBUILDER(IDPSSODescriptor);
503 DECL_SAML2MDOBJECTBUILDER(KeyDescriptor);
504 DECL_SAML2MDOBJECTBUILDER(ManageNameIDService);
505 DECL_SAML2MDOBJECTBUILDER(NameIDFormat);
506 DECL_SAML2MDOBJECTBUILDER(NameIDMappingService);
507 DECL_SAML2MDOBJECTBUILDER(Organization);
508 DECL_SAML2MDOBJECTBUILDER(OrganizationName);
509 DECL_SAML2MDOBJECTBUILDER(OrganizationDisplayName);
510 DECL_SAML2MDOBJECTBUILDER(OrganizationURL);
511 DECL_SAML2MDOBJECTBUILDER(PDPDescriptor);
512 DECL_SAML2MDOBJECTBUILDER(RequestedAttribute);
513 DECL_SAML2MDOBJECTBUILDER(ServiceDescription);
514 DECL_SAML2MDOBJECTBUILDER(ServiceName);
515 DECL_SAML2MDOBJECTBUILDER(SingleLogoutService);
516 DECL_SAML2MDOBJECTBUILDER(SingleSignOnService);
517 DECL_SAML2MDOBJECTBUILDER(SPSSODescriptor);
518 DECL_SAML2MDOBJECTBUILDER(SurName);
519 DECL_SAML2MDOBJECTBUILDER(TelephoneNumber);
521 DECL_XMLOBJECTBUILDER(SAML_API,ActionNamespace,samlconstants::SAML20MD_QUERY_EXT_NS,samlconstants::SAML20MD_QUERY_EXT_PREFIX);
522 DECL_XMLOBJECTBUILDER(SAML_API,SourceID,samlconstants::SAML1MD_NS,samlconstants::SAML1MD_PREFIX);
523 DECL_XMLOBJECTBUILDER(SAML_API,EntityAttributes,samlconstants::SAML20MD_ENTITY_ATTRIBUTE_NS,samlconstants::SAML20MD_ENTITY_ATTRIBUTE_PREFIX);
524 DECL_XMLOBJECTBUILDER(SAML_API,DigestMethod,samlconstants::SAML20MD_ALGSUPPORT_NS,samlconstants::SAML20MD_ALGSUPPORT_PREFIX);
525 DECL_XMLOBJECTBUILDER(SAML_API,SigningMethod,samlconstants::SAML20MD_ALGSUPPORT_NS,samlconstants::SAML20MD_ALGSUPPORT_PREFIX);
528 * Builder for localizedNameType objects.
530 * This is customized to force the element name to be specified.
532 class SAML_API localizedNameTypeBuilder : public xmltooling::XMLObjectBuilder {
534 virtual ~localizedNameTypeBuilder() {}
535 /** Builder that allows element/type override. */
536 #ifdef HAVE_COVARIANT_RETURNS
537 virtual localizedNameType* buildObject(
539 virtual xmltooling::XMLObject* buildObject(
541 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
544 /** Singleton builder. */
545 static localizedNameType* buildlocalizedNameType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
546 const localizedNameTypeBuilder* b = dynamic_cast<const localizedNameTypeBuilder*>(
547 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME))
550 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
551 #ifdef HAVE_COVARIANT_RETURNS
552 return b->buildObject(nsURI, localName, prefix, &schemaType);
554 return dynamic_cast<localizedNameType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
557 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedNameType.");
562 * Builder for localizedURIType objects.
564 * This is customized to force the element name to be specified.
566 class SAML_API localizedURITypeBuilder : public xmltooling::XMLObjectBuilder {
568 virtual ~localizedURITypeBuilder() {}
569 /** Builder that allows element/type override. */
570 #ifdef HAVE_COVARIANT_RETURNS
571 virtual localizedURIType* buildObject(
573 virtual xmltooling::XMLObject* buildObject(
575 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
578 /** Singleton builder. */
579 static localizedURIType* buildlocalizedURIType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
580 const localizedURITypeBuilder* b = dynamic_cast<const localizedURITypeBuilder*>(
581 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME))
584 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
585 #ifdef HAVE_COVARIANT_RETURNS
586 return b->buildObject(nsURI, localName, prefix, &schemaType);
588 return dynamic_cast<localizedURIType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
591 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedURIType.");
596 * Builder for EndpointType objects.
598 * This is customized to force the element name to be specified.
600 class SAML_API EndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
602 virtual ~EndpointTypeBuilder() {}
603 /** Builder that allows element/type override. */
604 #ifdef HAVE_COVARIANT_RETURNS
605 virtual EndpointType* buildObject(
607 virtual xmltooling::XMLObject* buildObject(
609 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
612 /** Singleton builder. */
613 static EndpointType* buildEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
614 const EndpointTypeBuilder* b = dynamic_cast<const EndpointTypeBuilder*>(
615 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME))
618 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
619 #ifdef HAVE_COVARIANT_RETURNS
620 return b->buildObject(nsURI, localName, prefix, &schemaType);
622 return dynamic_cast<EndpointType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
625 throw xmltooling::XMLObjectException("Unable to obtain typed builder for EndpointType.");
630 * Builder for IndexedEndpointType objects.
632 * This is customized to force the element name to be specified.
634 class SAML_API IndexedEndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
636 virtual ~IndexedEndpointTypeBuilder() {}
637 /** Builder that allows element/type override. */
638 #ifdef HAVE_COVARIANT_RETURNS
639 virtual IndexedEndpointType* buildObject(
641 virtual xmltooling::XMLObject* buildObject(
643 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
646 /** Singleton builder. */
647 static IndexedEndpointType* buildIndexedEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
648 const IndexedEndpointTypeBuilder* b = dynamic_cast<const IndexedEndpointTypeBuilder*>(
649 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME))
652 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
653 #ifdef HAVE_COVARIANT_RETURNS
654 return b->buildObject(nsURI, localName, prefix, &schemaType);
656 return dynamic_cast<IndexedEndpointType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
659 throw xmltooling::XMLObjectException("Unable to obtain typed builder for IndexedEndpointType.");
664 * Builder for RoleDescriptor extension objects.
666 * This is customized to force the schema type to be specified.
668 class SAML_API RoleDescriptorBuilder : public xmltooling::XMLObjectBuilder {
670 virtual ~RoleDescriptorBuilder() {}
671 /** Builder that allows element/type override. */
672 #ifdef HAVE_COVARIANT_RETURNS
673 virtual RoleDescriptor* buildObject(
675 virtual xmltooling::XMLObject* buildObject(
677 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
680 /** Singleton builder. */
681 static RoleDescriptor* buildRoleDescriptor(const xmltooling::QName& schemaType) {
682 const RoleDescriptorBuilder* b = dynamic_cast<const RoleDescriptorBuilder*>(
683 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,RoleDescriptor::LOCAL_NAME))
686 #ifdef HAVE_COVARIANT_RETURNS
687 return b->buildObject(samlconstants::SAML20MD_NS, RoleDescriptor::LOCAL_NAME, samlconstants::SAML20MD_PREFIX, &schemaType);
689 return dynamic_cast<RoleDescriptor*>(b->buildObject(samlconstants::SAML20MD_NS, RoleDescriptor::LOCAL_NAME, samlconstants::SAML20MD_PREFIX, &schemaType));
692 throw xmltooling::XMLObjectException("Unable to obtain typed builder for RoleDescriptor.");
697 * Builder for AuthnQueryDescriptorType objects.
699 * This is customized to return a RoleDescriptor element with an
700 * xsi:type of AuthnQueryDescriptorType.
702 class SAML_API AuthnQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
704 virtual ~AuthnQueryDescriptorTypeBuilder() {}
705 /** Default builder. */
706 #ifdef HAVE_COVARIANT_RETURNS
707 virtual AuthnQueryDescriptorType* buildObject() const {
709 virtual xmltooling::XMLObject* buildObject() const {
711 xmltooling::QName schemaType(
712 samlconstants::SAML20MD_QUERY_EXT_NS,AuthnQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
715 samlconstants::SAML20MD_NS,AuthnQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
718 /** Builder that allows element/type override. */
719 #ifdef HAVE_COVARIANT_RETURNS
720 virtual AuthnQueryDescriptorType* buildObject(
722 virtual xmltooling::XMLObject* buildObject(
724 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
727 /** Singleton builder. */
728 static AuthnQueryDescriptorType* buildAuthnQueryDescriptorType() {
729 const AuthnQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthnQueryDescriptorTypeBuilder*>(
730 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthnQueryDescriptorType::TYPE_NAME))
733 #ifdef HAVE_COVARIANT_RETURNS
734 return b->buildObject();
736 return dynamic_cast<AuthnQueryDescriptorType*>(b->buildObject());
739 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthnQueryDescriptorType.");
744 * Builder for AttributeQueryDescriptorType objects.
746 * This is customized to return a RoleDescriptor element with an
747 * xsi:type of AttributeQueryDescriptorType.
749 class SAML_API AttributeQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
751 virtual ~AttributeQueryDescriptorTypeBuilder() {}
752 /** Default builder. */
753 #ifdef HAVE_COVARIANT_RETURNS
754 virtual AttributeQueryDescriptorType* buildObject() const {
756 virtual xmltooling::XMLObject* buildObject() const {
758 xmltooling::QName schemaType(
759 samlconstants::SAML20MD_QUERY_EXT_NS,AttributeQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
762 samlconstants::SAML20MD_NS,AttributeQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
765 /** Builder that allows element/type override. */
766 #ifdef HAVE_COVARIANT_RETURNS
767 virtual AttributeQueryDescriptorType* buildObject(
769 virtual xmltooling::XMLObject* buildObject(
771 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
774 /** Singleton builder. */
775 static AttributeQueryDescriptorType* buildAttributeQueryDescriptorType() {
776 const AttributeQueryDescriptorTypeBuilder* b = dynamic_cast<const AttributeQueryDescriptorTypeBuilder*>(
777 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AttributeQueryDescriptorType::TYPE_NAME))
780 #ifdef HAVE_COVARIANT_RETURNS
781 return b->buildObject();
783 return dynamic_cast<AttributeQueryDescriptorType*>(b->buildObject());
786 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AttributeQueryDescriptorType.");
791 * Builder for AuthzDecisionQueryDescriptorType objects.
793 * This is customized to return a RoleDescriptor element with an
794 * xsi:type of AuthzDecisionQueryDescriptorType.
796 class SAML_API AuthzDecisionQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
798 virtual ~AuthzDecisionQueryDescriptorTypeBuilder() {}
799 /** Default builder. */
800 #ifdef HAVE_COVARIANT_RETURNS
801 virtual AuthzDecisionQueryDescriptorType* buildObject() const {
803 virtual xmltooling::XMLObject* buildObject() const {
805 xmltooling::QName schemaType(
806 samlconstants::SAML20MD_QUERY_EXT_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
809 samlconstants::SAML20MD_NS,AuthzDecisionQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
812 /** Builder that allows element/type override. */
813 #ifdef HAVE_COVARIANT_RETURNS
814 virtual AuthzDecisionQueryDescriptorType* buildObject(
816 virtual xmltooling::XMLObject* buildObject(
818 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
821 /** Singleton builder. */
822 static AuthzDecisionQueryDescriptorType* buildAuthzDecisionQueryDescriptorType() {
823 const AuthzDecisionQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthzDecisionQueryDescriptorTypeBuilder*>(
824 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME))
827 #ifdef HAVE_COVARIANT_RETURNS
828 return b->buildObject();
830 return dynamic_cast<AuthzDecisionQueryDescriptorType*>(b->buildObject());
833 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthzDecisionQueryDescriptorType.");
838 * Registers builders and validators for SAML 2.0 Metadata classes into the runtime.
840 void SAML_API registerMetadataClasses();
844 #endif /* __saml2_metadata_h__ */