2 * Licensed to the University Corporation for Advanced Internet
3 * Development, Inc. (UCAID) under one or more contributor license
4 * agreements. See the NOTICE file distributed with this work for
5 * additional information regarding copyright ownership.
7 * UCAID licenses this file to you under the Apache License,
8 * Version 2.0 (the "License"); you may not use this file except
9 * in compliance with the License. You may obtain a copy of the
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17 * either express or implied. See the License for the specific
18 * language governing permissions and limitations under the License.
22 * @file saml/saml2/metadata/Metadata.h
24 * XMLObjects representing the SAML 2.0 Metadata schema.
27 #ifndef __saml2_metadata_h__
28 #define __saml2_metadata_h__
30 #include <saml/saml2/core/Assertions.h>
33 #include <xercesc/util/XMLUniDefs.hpp>
34 #include <xmltooling/util/Predicates.h>
37 #define DECL_SAML2MDOBJECTBUILDER(cname) \
38 DECL_XMLOBJECTBUILDER(SAML_API,cname,samlconstants::SAML20MD_NS,samlconstants::SAML20MD_PREFIX)
40 namespace xmltooling {
41 class XMLTOOL_API Credential;
42 class XMLTOOL_API CredentialResolver;
45 namespace xmlencryption {
46 class XMLTOOL_API EncryptionMethod;
52 * @namespace opensaml::saml2md
53 * SAML 2.0 metadata namespace
57 class SAML_API DigestMethod;
58 class SAML_API SigningMethod;
61 * Base class for metadata objects that feature a cacheDuration attribute.
63 class SAML_API CacheableSAMLObject : public virtual xmltooling::XMLObject
66 CacheableSAMLObject() {}
68 ~CacheableSAMLObject() {}
69 DECL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION);
73 * Base class for metadata objects that feature a validUntil attribute.
75 class SAML_API TimeBoundSAMLObject : public virtual xmltooling::XMLObject
78 TimeBoundSAMLObject() {}
80 ~TimeBoundSAMLObject() {}
81 DECL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL);
82 /** Returns true iff the object is valid at the current time. */
83 bool isValid() const {
84 return time(nullptr) <= getValidUntilEpoch();
86 /** Returns true iff the object is valid at the supplied time. */
87 bool isValid(time_t t) const {
88 return t <= getValidUntilEpoch();
92 DECL_XMLOBJECT_SIMPLE(SAML_API,AffiliateMember,ID,SAML 2.0 AffiliateMember element);
93 DECL_XMLOBJECT_SIMPLE(SAML_API,AttributeProfile,ProfileURI,SAML 2.0 AttributeProfile element);
94 DECL_XMLOBJECT_SIMPLE(SAML_API,Company,Name,SAML 2.0 Company element);
95 DECL_XMLOBJECT_SIMPLE(SAML_API,EmailAddress,Address,SAML 2.0 EmailAddress element);
96 DECL_XMLOBJECT_SIMPLE(SAML_API,GivenName,Name,SAML 2.0 GivenName element);
97 DECL_XMLOBJECT_SIMPLE(SAML_API,NameIDFormat,Format,SAML 2.0 NameIDFormat element);
98 DECL_XMLOBJECT_SIMPLE(SAML_API,SurName,Name,SAML 2.0 SurName element);
99 DECL_XMLOBJECT_SIMPLE(SAML_API,TelephoneNumber,Number,SAML 2.0 TelephoneNumber element);
101 DECL_XMLOBJECT_SIMPLE(SAML_API,ActionNamespace,Namespace,SAML 2.0 Metadata Extension ActionNamespace element);
103 BEGIN_XMLOBJECT(SAML_API,localizedNameType,xmltooling::XMLObject,SAML 2.0 localizedNameType type);
104 DECL_STRING_ATTRIB(Lang,LANG);
105 /** localizedNameType local name */
106 static const XMLCh TYPE_NAME[];
109 BEGIN_XMLOBJECT(SAML_API,localizedURIType,xmltooling::XMLObject,SAML 2.0 localizedURIType type);
110 DECL_STRING_ATTRIB(Lang,LANG);
111 /** localizedURIType local name */
112 static const XMLCh TYPE_NAME[];
115 BEGIN_XMLOBJECT(SAML_API,OrganizationName,localizedNameType,SAML 2.0 OrganizationName element);
116 DECL_SIMPLE_CONTENT(Name);
119 BEGIN_XMLOBJECT(SAML_API,OrganizationDisplayName,localizedNameType,SAML 2.0 OrganizationDisplayName element);
120 DECL_SIMPLE_CONTENT(Name);
123 BEGIN_XMLOBJECT(SAML_API,OrganizationURL,localizedURIType,SAML 2.0 OrganizationURL element);
124 DECL_SIMPLE_CONTENT(URL);
127 BEGIN_XMLOBJECT(SAML_API,Extensions,xmltooling::ElementExtensibleXMLObject,SAML 2.0 Extensions element);
128 /** ExtensionsType local name */
129 static const XMLCh TYPE_NAME[];
132 BEGIN_XMLOBJECT(SAML_API,Organization,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 Organization element);
133 DECL_TYPED_CHILD(Extensions);
134 DECL_TYPED_CHILDREN(OrganizationName);
135 DECL_TYPED_CHILDREN(OrganizationDisplayName);
136 DECL_TYPED_CHILDREN(OrganizationURL);
137 /** OrganizationType local name */
138 static const XMLCh TYPE_NAME[];
141 BEGIN_XMLOBJECT(SAML_API,ContactPerson,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 ContactPerson element);
142 DECL_STRING_ATTRIB(ContactType,CONTACTTYPE);
143 DECL_TYPED_CHILD(Extensions);
144 DECL_TYPED_CHILD(Company);
145 DECL_TYPED_CHILD(GivenName);
146 DECL_TYPED_CHILD(SurName);
147 DECL_TYPED_CHILDREN(EmailAddress);
148 DECL_TYPED_CHILDREN(TelephoneNumber);
149 /** ContactType local name */
150 static const XMLCh TYPE_NAME[];
151 /** technical Contact Type */
152 static const XMLCh CONTACT_TECHNICAL[];
153 /** support Contact Type */
154 static const XMLCh CONTACT_SUPPORT[];
155 /** administrative Contact Type */
156 static const XMLCh CONTACT_ADMINISTRATIVE[];
157 /** billing Contact Type */
158 static const XMLCh CONTACT_BILLING[];
159 /** other Contact Type */
160 static const XMLCh CONTACT_OTHER[];
163 BEGIN_XMLOBJECT(SAML_API,AdditionalMetadataLocation,xmltooling::XMLObject,SAML 2.0 AdditionalMetadataLocation element);
164 DECL_STRING_ATTRIB(Namespace,NAMESPACE);
165 DECL_SIMPLE_CONTENT(Location);
166 /** AdditionalMetadataLocationType local name */
167 static const XMLCh TYPE_NAME[];
170 BEGIN_XMLOBJECT(SAML_API,KeyDescriptor,xmltooling::XMLObject,SAML 2.0 KeyDescriptor element);
171 DECL_STRING_ATTRIB(Use,USE);
172 DECL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
173 DECL_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption);
174 /** KeyDescriptorType local name */
175 static const XMLCh TYPE_NAME[];
176 /** encryption Key Type */
177 static const XMLCh KEYTYPE_ENCRYPTION[];
178 /** signing Key Type */
179 static const XMLCh KEYTYPE_SIGNING[];
182 BEGIN_XMLOBJECT4(SAML_API,RoleDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
183 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 RoleDescriptor abstract element);
184 DECL_STRING_ATTRIB(ID,ID);
185 DECL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION);
186 /** Searches the ProtocolSupportEnumeration attribute for the indicated protocol. */
187 virtual bool hasSupport(const XMLCh* protocol) const=0;
188 /** Adds the indicated protocol to the ProtocolSupportEnumeration attribute. */
189 virtual void addSupport(const XMLCh* protocol)=0;
190 DECL_STRING_ATTRIB(ErrorURL,ERRORURL);
191 DECL_TYPED_CHILD(Extensions);
192 DECL_TYPED_CHILDREN(KeyDescriptor);
193 DECL_TYPED_CHILD(Organization);
194 DECL_TYPED_CHILDREN(ContactPerson);
195 /** Returns the first digest method supported by the role and the underlying implementation, if any. */
196 virtual const DigestMethod* getDigestMethod() const;
197 /** Returns the first signing method supported by the role and the underlying implementation, if any, along with a matching credential. */
198 virtual std::pair<const SigningMethod*,const xmltooling::Credential*> getSigningMethod(
199 const xmltooling::CredentialResolver& resolver, xmltooling::CredentialCriteria& cc
203 BEGIN_XMLOBJECT2(SAML_API,RoleDescriptorType,RoleDescriptor,xmltooling::ElementExtensibleXMLObject,SAML 2.0 RoleDescriptor extension);
206 BEGIN_XMLOBJECT(SAML_API,EndpointType,xmltooling::ElementProxy,SAML 2.0 EndpointType type);
207 DECL_STRING_ATTRIB(Binding,BINDING);
208 DECL_STRING_ATTRIB(Location,LOCATION);
209 DECL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION);
210 /** EndpointType local name */
211 static const XMLCh TYPE_NAME[];
214 BEGIN_XMLOBJECT(SAML_API,IndexedEndpointType,EndpointType,SAML 2.0 IndexedEndpointType type);
215 DECL_INTEGER_ATTRIB(Index,INDEX);
216 DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
217 /** IndexedEndpointType local name */
218 static const XMLCh TYPE_NAME[];
221 BEGIN_XMLOBJECT(SAML_API,ArtifactResolutionService,IndexedEndpointType,SAML 2.0 ArtifactResolutionService element);
224 BEGIN_XMLOBJECT(SAML_API,SingleLogoutService,EndpointType,SAML 2.0 SingleLogoutService element);
227 BEGIN_XMLOBJECT(SAML_API,ManageNameIDService,EndpointType,SAML 2.0 ManageNameIDService element);
230 BEGIN_XMLOBJECT(SAML_API,SSODescriptorType,RoleDescriptor,SAML 2.0 SSODescriptorType abstract type);
231 DECL_TYPED_CHILDREN(ArtifactResolutionService);
232 DECL_TYPED_CHILDREN(SingleLogoutService);
233 DECL_TYPED_CHILDREN(ManageNameIDService);
234 DECL_TYPED_CHILDREN(NameIDFormat);
235 /** SSODescriptorType local name */
236 static const XMLCh TYPE_NAME[];
239 BEGIN_XMLOBJECT(SAML_API,SingleSignOnService,EndpointType,SAML 2.0 SingleSignOnService element);
242 BEGIN_XMLOBJECT(SAML_API,NameIDMappingService,EndpointType,SAML 2.0 NameIDMappingService element);
245 BEGIN_XMLOBJECT(SAML_API,AssertionIDRequestService,EndpointType,SAML 2.0 AssertionIDRequestService element);
248 BEGIN_XMLOBJECT(SAML_API,IDPSSODescriptor,SSODescriptorType,SAML 2.0 IDPSSODescriptor element);
249 DECL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,false);
250 DECL_TYPED_CHILDREN(SingleSignOnService);
251 DECL_TYPED_CHILDREN(NameIDMappingService);
252 DECL_TYPED_CHILDREN(AssertionIDRequestService);
253 DECL_TYPED_CHILDREN(AttributeProfile);
254 DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
255 /** IDPSSODescriptorType local name */
256 static const XMLCh TYPE_NAME[];
260 BEGIN_XMLOBJECT(SAML_API,ServiceName,localizedNameType,SAML 2.0 ServiceName element);
261 DECL_SIMPLE_CONTENT(Name);
264 BEGIN_XMLOBJECT(SAML_API,ServiceDescription,localizedNameType,SAML 2.0 ServiceDescription element);
265 DECL_SIMPLE_CONTENT(Description);
268 BEGIN_XMLOBJECT(SAML_API,RequestedAttribute,saml2::Attribute,SAML 2.0 RequestedAttribute element);
269 DECL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,false);
270 /** RequestedAttributeType local name */
271 static const XMLCh TYPE_NAME[];
274 BEGIN_XMLOBJECT(SAML_API,AttributeConsumingService,xmltooling::XMLObject,SAML 2.0 AttributeConsumingService element);
275 DECL_INTEGER_ATTRIB(Index,INDEX);
276 DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
277 DECL_TYPED_CHILDREN(ServiceName);
278 DECL_TYPED_CHILDREN(ServiceDescription);
279 DECL_TYPED_CHILDREN(RequestedAttribute);
280 /** AttributeConsumingServiceType local name */
281 static const XMLCh TYPE_NAME[];
284 BEGIN_XMLOBJECT(SAML_API,AssertionConsumerService,IndexedEndpointType,SAML 2.0 AssertionConsumerService element);
287 BEGIN_XMLOBJECT(SAML_API,SPSSODescriptor,SSODescriptorType,SAML 2.0 SPSSODescriptor element);
288 DECL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,false);
289 DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
290 DECL_TYPED_CHILDREN(AssertionConsumerService);
291 DECL_TYPED_CHILDREN(AttributeConsumingService);
292 /** SPSSODescriptorType local name */
293 static const XMLCh TYPE_NAME[];
297 BEGIN_XMLOBJECT(SAML_API,AuthnQueryService,EndpointType,SAML 2.0 AuthnQueryService element);
300 BEGIN_XMLOBJECT(SAML_API,AuthnAuthorityDescriptor,RoleDescriptor,SAML 2.0 AuthnAuthorityDescriptor element);
301 DECL_TYPED_CHILDREN(AuthnQueryService);
302 DECL_TYPED_CHILDREN(AssertionIDRequestService);
303 DECL_TYPED_CHILDREN(NameIDFormat);
304 /** AuthnAuthorityDescriptorType local name */
305 static const XMLCh TYPE_NAME[];
309 BEGIN_XMLOBJECT(SAML_API,AuthzService,EndpointType,SAML 2.0 AuthzService element);
312 BEGIN_XMLOBJECT(SAML_API,PDPDescriptor,RoleDescriptor,SAML 2.0 PDPDescriptor element);
313 DECL_TYPED_CHILDREN(AuthzService);
314 DECL_TYPED_CHILDREN(AssertionIDRequestService);
315 DECL_TYPED_CHILDREN(NameIDFormat);
316 /** PDPDescriptorType local name */
317 static const XMLCh TYPE_NAME[];
321 BEGIN_XMLOBJECT(SAML_API,AttributeService,EndpointType,SAML 2.0 AttributeService element);
324 BEGIN_XMLOBJECT(SAML_API,AttributeAuthorityDescriptor,RoleDescriptor,SAML 2.0 AttributeAuthorityDescriptor element);
325 DECL_TYPED_CHILDREN(AttributeService);
326 DECL_TYPED_CHILDREN(AssertionIDRequestService);
327 DECL_TYPED_CHILDREN(NameIDFormat);
328 DECL_TYPED_CHILDREN(AttributeProfile);
329 DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
330 /** AttributeAuthorityDescriptorType local name */
331 static const XMLCh TYPE_NAME[];
335 BEGIN_XMLOBJECT(SAML_API,QueryDescriptorType,RoleDescriptor,SAML 2.0 QueryDescriptorType abstract type);
336 DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
337 DECL_TYPED_CHILDREN(NameIDFormat);
338 /** QueryDescriptorType local name */
339 static const XMLCh TYPE_NAME[];
342 BEGIN_XMLOBJECT(SAML_API,AuthnQueryDescriptorType,QueryDescriptorType,SAML 2.0 AuthnQueryDescriptorType extension type);
343 /** AuthnQueryDescriptorType local name */
344 static const XMLCh TYPE_NAME[];
348 BEGIN_XMLOBJECT(SAML_API,AttributeQueryDescriptorType,QueryDescriptorType,SAML 2.0 AttributeQueryDescriptorType extension type);
349 DECL_TYPED_CHILDREN(AttributeConsumingService);
350 /** AttributeQueryDescriptorType local name */
351 static const XMLCh TYPE_NAME[];
355 BEGIN_XMLOBJECT(SAML_API,AuthzDecisionQueryDescriptorType,QueryDescriptorType,SAML 2.0 AuthzDecisionQueryDescriptorType extension type);
356 DECL_TYPED_CHILDREN(ActionNamespace);
357 /** AuthzDecisionQueryDescriptorType local name */
358 static const XMLCh TYPE_NAME[];
362 BEGIN_XMLOBJECT4(SAML_API,AffiliationDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
363 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 AffiliationDescriptor element);
364 DECL_STRING_ATTRIB(ID,ID);
365 DECL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID);
366 DECL_TYPED_CHILD(Extensions);
367 DECL_TYPED_CHILDREN(AffiliateMember);
368 DECL_TYPED_CHILDREN(KeyDescriptor);
369 /** AffiliationDescriptorType local name */
370 static const XMLCh TYPE_NAME[];
373 BEGIN_XMLOBJECT4(SAML_API,EntityDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
374 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 EntityDescriptor element);
375 DECL_STRING_ATTRIB(ID,ID);
376 DECL_STRING_ATTRIB(EntityID,ENTITYID);
377 DECL_TYPED_CHILD(Extensions);
378 DECL_TYPED_CHILD(AffiliationDescriptor);
379 DECL_TYPED_CHILDREN(RoleDescriptor);
380 DECL_TYPED_CHILDREN(IDPSSODescriptor);
381 DECL_TYPED_CHILDREN(SPSSODescriptor);
382 DECL_TYPED_CHILDREN(AuthnAuthorityDescriptor);
383 DECL_TYPED_CHILDREN(AttributeAuthorityDescriptor);
384 DECL_TYPED_CHILDREN(PDPDescriptor);
385 DECL_TYPED_CHILDREN(AuthnQueryDescriptorType);
386 DECL_TYPED_CHILDREN(AttributeQueryDescriptorType);
387 DECL_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType);
388 DECL_TYPED_CHILD(Organization);
389 DECL_TYPED_CHILDREN(ContactPerson);
390 DECL_TYPED_CHILDREN(AdditionalMetadataLocation);
391 /** Finds an arbitrary role type supporting a given protocol. */
392 virtual const RoleDescriptor* getRoleDescriptor(const xmltooling::QName& qname, const XMLCh* protocol) const=0;
393 /** EntityDescriptorType local name */
394 static const XMLCh TYPE_NAME[];
397 BEGIN_XMLOBJECT3(SAML_API,EntitiesDescriptor,SignableObject,CacheableSAMLObject,
398 TimeBoundSAMLObject,SAML 2.0 EntitiesDescriptor element);
399 DECL_STRING_ATTRIB(ID,ID);
400 DECL_STRING_ATTRIB(Name,NAME);
401 DECL_TYPED_CHILD(Extensions);
402 DECL_TYPED_CHILDREN(EntityDescriptor);
403 DECL_TYPED_CHILDREN(EntitiesDescriptor);
404 /** EntitiesDescriptorType local name */
405 static const XMLCh TYPE_NAME[];
408 // Known Metadata Extensions
410 DECL_XMLOBJECT_SIMPLE(SAML_API,SourceID,ID,SAML 1.x Metadata Profile SourceID element);
412 BEGIN_XMLOBJECT(SAML_API,DiscoveryResponse,IndexedEndpointType,Identity Provider Discovery Protocol DiscoveryResponse element);
415 BEGIN_XMLOBJECT(SAML_API,RequestInitiator,EndpointType,Service Provider Request Initiation RequestInitiator element);
418 BEGIN_XMLOBJECT(SAML_API,EntityAttributes,xmltooling::XMLObject,SAML Metadata Extension for Entity Attributes element);
419 DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
420 DECL_TYPED_FOREIGN_CHILDREN(Assertion,saml2);
421 /** EntityAttributesType local name */
422 static const XMLCh TYPE_NAME[];
425 BEGIN_XMLOBJECT(SAML_API,DigestMethod,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Algorithm Support DigestMethod element);
426 DECL_STRING_ATTRIB(Algorithm,ALGORITHM);
427 /** DigestMethodType local name */
428 static const XMLCh TYPE_NAME[];
431 BEGIN_XMLOBJECT(SAML_API,SigningMethod,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Algorithm Support SigningMethod element);
432 DECL_STRING_ATTRIB(Algorithm,ALGORITHM);
433 DECL_INTEGER_ATTRIB(MinKeySize,MINKEYSIZE);
434 DECL_INTEGER_ATTRIB(MaxKeySize,MAXKEYSIZE);
435 /** SigningMethodType local name */
436 static const XMLCh TYPE_NAME[];
439 BEGIN_XMLOBJECT(SAML_API,DisplayName,localizedNameType,SAML Metadata Extension for Login UI DisplayName element);
440 DECL_SIMPLE_CONTENT(Name);
443 BEGIN_XMLOBJECT(SAML_API,Description,localizedNameType,SAML Metadata Extension for Login UI Description element);
444 DECL_SIMPLE_CONTENT(Description);
447 BEGIN_XMLOBJECT(SAML_API,Keywords,xmltooling::XMLObject,SAML Metadata Extension for Login UI Keywords element);
448 DECL_STRING_ATTRIB(Lang,LANG);
449 DECL_SIMPLE_CONTENT(Values);
450 /** KeywordsType local name */
451 static const XMLCh TYPE_NAME[];
454 BEGIN_XMLOBJECT(SAML_API,Logo,xmltooling::XMLObject,SAML Metadata Extension for Login UI Logo element);
455 DECL_STRING_ATTRIB(Lang,LANG);
456 DECL_INTEGER_ATTRIB(Height,HEIGHT);
457 DECL_INTEGER_ATTRIB(Width,WIDTH);
458 DECL_SIMPLE_CONTENT(URL);
459 /** LogoType local name */
460 static const XMLCh TYPE_NAME[];
463 BEGIN_XMLOBJECT(SAML_API,InformationURL,localizedURIType,SAML Metadata Extension for Login UI InformationURL element);
464 DECL_SIMPLE_CONTENT(URL);
467 BEGIN_XMLOBJECT(SAML_API,PrivacyStatementURL,localizedURIType,SAML Metadata Extension for Login UI PrivacyStatementURL element);
468 DECL_SIMPLE_CONTENT(URL);
471 BEGIN_XMLOBJECT(SAML_API,UIInfo,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Login UI UIInfo element);
472 DECL_TYPED_CHILDREN(DisplayName);
473 DECL_TYPED_CHILDREN(Description);
474 DECL_TYPED_CHILDREN(Keywords);
475 DECL_TYPED_CHILDREN(Logo);
476 DECL_TYPED_CHILDREN(InformationURL);
477 DECL_TYPED_CHILDREN(PrivacyStatementURL);
478 /** UIInfoType local name */
479 static const XMLCh TYPE_NAME[];
482 DECL_XMLOBJECT_SIMPLE(SAML_API,IPHint,Hint,SAML Metadata Extension for Login UI IPHint element);
483 DECL_XMLOBJECT_SIMPLE(SAML_API,DomainHint,Hint,SAML Metadata Extension for Login UI DomainHint element);
484 DECL_XMLOBJECT_SIMPLE(SAML_API,GeolocationHint,Hint,SAML Metadata Extension for Login UI GeolocationHint element);
486 BEGIN_XMLOBJECT(SAML_API,DiscoHints,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Login UI DiscoHints element);
487 DECL_TYPED_CHILDREN(IPHint);
488 DECL_TYPED_CHILDREN(DomainHint);
489 DECL_TYPED_CHILDREN(GeolocationHint);
490 /** DiscoHintsType local name */
491 static const XMLCh TYPE_NAME[];
495 * Predicate to test a role for validity and protocol support.
497 class isValidForProtocol
503 * @param protocol support constant to test for
505 isValidForProtocol(const XMLCh* protocol) : m_time(time(nullptr)), m_protocol(protocol) {
509 * Returns true iff the supplied role is valid now and supports the right protocol.
511 * @param role role to test
512 * @return result of predicate
514 bool operator()(const RoleDescriptor* role) const {
515 return role ? (role->isValid(m_time) && role->hasSupport(m_protocol)) : false;
520 const XMLCh* m_protocol;
524 * Predicate to test a role for type equivalence, validity, and protocol support.
526 class ofTypeValidForProtocol : public isValidForProtocol, public xmltooling::hasSchemaType
532 * @param q schema type to test for
533 * @param protocol support constant to test for
535 ofTypeValidForProtocol(const xmltooling::QName& q, const XMLCh* protocol)
536 : isValidForProtocol(protocol), xmltooling::hasSchemaType(q) {
540 * Returns true iff the supplied role is of the right type, valid now, and supports the right protocol.
542 * @param role role to test
543 * @return result of predicate
545 bool operator()(const RoleDescriptor* role) const {
546 return xmltooling::hasSchemaType::operator()(role) && isValidForProtocol::operator()(role);
550 DECL_SAML2MDOBJECTBUILDER(AdditionalMetadataLocation);
551 DECL_SAML2MDOBJECTBUILDER(AffiliateMember);
552 DECL_SAML2MDOBJECTBUILDER(AffiliationDescriptor);
553 DECL_SAML2MDOBJECTBUILDER(ArtifactResolutionService);
554 DECL_SAML2MDOBJECTBUILDER(AssertionConsumerService);
555 DECL_SAML2MDOBJECTBUILDER(AssertionIDRequestService);
556 DECL_SAML2MDOBJECTBUILDER(AttributeAuthorityDescriptor);
557 DECL_SAML2MDOBJECTBUILDER(AttributeConsumingService);
558 DECL_SAML2MDOBJECTBUILDER(AttributeProfile);
559 DECL_SAML2MDOBJECTBUILDER(AttributeService);
560 DECL_SAML2MDOBJECTBUILDER(AuthnAuthorityDescriptor);
561 DECL_SAML2MDOBJECTBUILDER(AuthnQueryService);
562 DECL_SAML2MDOBJECTBUILDER(AuthzService);
563 DECL_SAML2MDOBJECTBUILDER(Company);
564 DECL_SAML2MDOBJECTBUILDER(ContactPerson);
565 DECL_SAML2MDOBJECTBUILDER(EmailAddress);
566 DECL_SAML2MDOBJECTBUILDER(EntitiesDescriptor);
567 DECL_SAML2MDOBJECTBUILDER(EntityDescriptor);
568 DECL_SAML2MDOBJECTBUILDER(Extensions);
569 DECL_SAML2MDOBJECTBUILDER(GivenName);
570 DECL_SAML2MDOBJECTBUILDER(IDPSSODescriptor);
571 DECL_SAML2MDOBJECTBUILDER(KeyDescriptor);
572 DECL_SAML2MDOBJECTBUILDER(ManageNameIDService);
573 DECL_SAML2MDOBJECTBUILDER(NameIDFormat);
574 DECL_SAML2MDOBJECTBUILDER(NameIDMappingService);
575 DECL_SAML2MDOBJECTBUILDER(Organization);
576 DECL_SAML2MDOBJECTBUILDER(OrganizationName);
577 DECL_SAML2MDOBJECTBUILDER(OrganizationDisplayName);
578 DECL_SAML2MDOBJECTBUILDER(OrganizationURL);
579 DECL_SAML2MDOBJECTBUILDER(PDPDescriptor);
580 DECL_SAML2MDOBJECTBUILDER(RequestedAttribute);
581 DECL_SAML2MDOBJECTBUILDER(ServiceDescription);
582 DECL_SAML2MDOBJECTBUILDER(ServiceName);
583 DECL_SAML2MDOBJECTBUILDER(SingleLogoutService);
584 DECL_SAML2MDOBJECTBUILDER(SingleSignOnService);
585 DECL_SAML2MDOBJECTBUILDER(SPSSODescriptor);
586 DECL_SAML2MDOBJECTBUILDER(SurName);
587 DECL_SAML2MDOBJECTBUILDER(TelephoneNumber);
589 DECL_XMLOBJECTBUILDER(SAML_API,ActionNamespace,samlconstants::SAML20MD_QUERY_EXT_NS,samlconstants::SAML20MD_QUERY_EXT_PREFIX);
590 DECL_XMLOBJECTBUILDER(SAML_API,SourceID,samlconstants::SAML1MD_NS,samlconstants::SAML1MD_PREFIX);
591 DECL_XMLOBJECTBUILDER(SAML_API,DiscoveryResponse,samlconstants::IDP_DISCOVERY_PROTOCOL_NS,samlconstants::IDP_DISCOVERY_PROTOCOL_PREFIX);
592 DECL_XMLOBJECTBUILDER(SAML_API,RequestInitiator,samlconstants::SP_REQUEST_INIT_NS,samlconstants::SP_REQUEST_INIT_PREFIX);
593 DECL_XMLOBJECTBUILDER(SAML_API,EntityAttributes,samlconstants::SAML20MD_ENTITY_ATTRIBUTE_NS,samlconstants::SAML20MD_ENTITY_ATTRIBUTE_PREFIX);
594 DECL_XMLOBJECTBUILDER(SAML_API,DigestMethod,samlconstants::SAML20MD_ALGSUPPORT_NS,samlconstants::SAML20MD_ALGSUPPORT_PREFIX);
595 DECL_XMLOBJECTBUILDER(SAML_API,SigningMethod,samlconstants::SAML20MD_ALGSUPPORT_NS,samlconstants::SAML20MD_ALGSUPPORT_PREFIX);
597 DECL_XMLOBJECTBUILDER(SAML_API,UIInfo,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
598 DECL_XMLOBJECTBUILDER(SAML_API,DisplayName,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
599 DECL_XMLOBJECTBUILDER(SAML_API,Description,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
600 DECL_XMLOBJECTBUILDER(SAML_API,Keywords,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
601 DECL_XMLOBJECTBUILDER(SAML_API,Logo,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
602 DECL_XMLOBJECTBUILDER(SAML_API,InformationURL,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
603 DECL_XMLOBJECTBUILDER(SAML_API,PrivacyStatementURL,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
604 DECL_XMLOBJECTBUILDER(SAML_API,DiscoHints,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
605 DECL_XMLOBJECTBUILDER(SAML_API,IPHint,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
606 DECL_XMLOBJECTBUILDER(SAML_API,DomainHint,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
607 DECL_XMLOBJECTBUILDER(SAML_API,GeolocationHint,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
610 * Builder for localizedNameType objects.
612 * This is customized to force the element name to be specified.
614 class SAML_API localizedNameTypeBuilder : public xmltooling::XMLObjectBuilder {
616 virtual ~localizedNameTypeBuilder() {}
617 /** Builder that allows element/type override. */
618 #ifdef HAVE_COVARIANT_RETURNS
619 virtual localizedNameType* buildObject(
621 virtual xmltooling::XMLObject* buildObject(
623 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
626 /** Singleton builder. */
627 static localizedNameType* buildlocalizedNameType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
628 const localizedNameTypeBuilder* b = dynamic_cast<const localizedNameTypeBuilder*>(
629 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME))
632 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
633 #ifdef HAVE_COVARIANT_RETURNS
634 return b->buildObject(nsURI, localName, prefix, &schemaType);
636 return dynamic_cast<localizedNameType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
639 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedNameType.");
644 * Builder for localizedURIType objects.
646 * This is customized to force the element name to be specified.
648 class SAML_API localizedURITypeBuilder : public xmltooling::XMLObjectBuilder {
650 virtual ~localizedURITypeBuilder() {}
651 /** Builder that allows element/type override. */
652 #ifdef HAVE_COVARIANT_RETURNS
653 virtual localizedURIType* buildObject(
655 virtual xmltooling::XMLObject* buildObject(
657 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
660 /** Singleton builder. */
661 static localizedURIType* buildlocalizedURIType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
662 const localizedURITypeBuilder* b = dynamic_cast<const localizedURITypeBuilder*>(
663 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME))
666 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
667 #ifdef HAVE_COVARIANT_RETURNS
668 return b->buildObject(nsURI, localName, prefix, &schemaType);
670 return dynamic_cast<localizedURIType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
673 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedURIType.");
678 * Builder for EndpointType objects.
680 * This is customized to force the element name to be specified.
682 class SAML_API EndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
684 virtual ~EndpointTypeBuilder() {}
685 /** Builder that allows element/type override. */
686 #ifdef HAVE_COVARIANT_RETURNS
687 virtual EndpointType* buildObject(
689 virtual xmltooling::XMLObject* buildObject(
691 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
694 /** Singleton builder. */
695 static EndpointType* buildEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
696 const EndpointTypeBuilder* b = dynamic_cast<const EndpointTypeBuilder*>(
697 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME))
700 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
701 #ifdef HAVE_COVARIANT_RETURNS
702 return b->buildObject(nsURI, localName, prefix, &schemaType);
704 return dynamic_cast<EndpointType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
707 throw xmltooling::XMLObjectException("Unable to obtain typed builder for EndpointType.");
712 * Builder for IndexedEndpointType objects.
714 * This is customized to force the element name to be specified.
716 class SAML_API IndexedEndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
718 virtual ~IndexedEndpointTypeBuilder() {}
719 /** Builder that allows element/type override. */
720 #ifdef HAVE_COVARIANT_RETURNS
721 virtual IndexedEndpointType* buildObject(
723 virtual xmltooling::XMLObject* buildObject(
725 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
728 /** Singleton builder. */
729 static IndexedEndpointType* buildIndexedEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
730 const IndexedEndpointTypeBuilder* b = dynamic_cast<const IndexedEndpointTypeBuilder*>(
731 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME))
734 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
735 #ifdef HAVE_COVARIANT_RETURNS
736 return b->buildObject(nsURI, localName, prefix, &schemaType);
738 return dynamic_cast<IndexedEndpointType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
741 throw xmltooling::XMLObjectException("Unable to obtain typed builder for IndexedEndpointType.");
746 * Builder for RoleDescriptor extension objects.
748 * This is customized to force the schema type to be specified.
750 class SAML_API RoleDescriptorBuilder : public xmltooling::XMLObjectBuilder {
752 virtual ~RoleDescriptorBuilder() {}
753 /** Builder that allows element/type override. */
754 #ifdef HAVE_COVARIANT_RETURNS
755 virtual RoleDescriptor* buildObject(
757 virtual xmltooling::XMLObject* buildObject(
759 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
762 /** Singleton builder. */
763 static RoleDescriptor* buildRoleDescriptor(const xmltooling::QName& schemaType) {
764 const RoleDescriptorBuilder* b = dynamic_cast<const RoleDescriptorBuilder*>(
765 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,RoleDescriptor::LOCAL_NAME))
768 #ifdef HAVE_COVARIANT_RETURNS
769 return b->buildObject(samlconstants::SAML20MD_NS, RoleDescriptor::LOCAL_NAME, samlconstants::SAML20MD_PREFIX, &schemaType);
771 return dynamic_cast<RoleDescriptor*>(b->buildObject(samlconstants::SAML20MD_NS, RoleDescriptor::LOCAL_NAME, samlconstants::SAML20MD_PREFIX, &schemaType));
774 throw xmltooling::XMLObjectException("Unable to obtain typed builder for RoleDescriptor.");
779 * Builder for AuthnQueryDescriptorType objects.
781 * This is customized to return a RoleDescriptor element with an
782 * xsi:type of AuthnQueryDescriptorType.
784 class SAML_API AuthnQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
786 virtual ~AuthnQueryDescriptorTypeBuilder() {}
787 /** Default builder. */
788 #ifdef HAVE_COVARIANT_RETURNS
789 virtual AuthnQueryDescriptorType* buildObject() const {
791 virtual xmltooling::XMLObject* buildObject() const {
793 xmltooling::QName schemaType(
794 samlconstants::SAML20MD_QUERY_EXT_NS,AuthnQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
797 samlconstants::SAML20MD_NS,AuthnQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
800 /** Builder that allows element/type override. */
801 #ifdef HAVE_COVARIANT_RETURNS
802 virtual AuthnQueryDescriptorType* buildObject(
804 virtual xmltooling::XMLObject* buildObject(
806 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
809 /** Singleton builder. */
810 static AuthnQueryDescriptorType* buildAuthnQueryDescriptorType() {
811 const AuthnQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthnQueryDescriptorTypeBuilder*>(
812 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthnQueryDescriptorType::TYPE_NAME))
815 #ifdef HAVE_COVARIANT_RETURNS
816 return b->buildObject();
818 return dynamic_cast<AuthnQueryDescriptorType*>(b->buildObject());
821 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthnQueryDescriptorType.");
826 * Builder for AttributeQueryDescriptorType objects.
828 * This is customized to return a RoleDescriptor element with an
829 * xsi:type of AttributeQueryDescriptorType.
831 class SAML_API AttributeQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
833 virtual ~AttributeQueryDescriptorTypeBuilder() {}
834 /** Default builder. */
835 #ifdef HAVE_COVARIANT_RETURNS
836 virtual AttributeQueryDescriptorType* buildObject() const {
838 virtual xmltooling::XMLObject* buildObject() const {
840 xmltooling::QName schemaType(
841 samlconstants::SAML20MD_QUERY_EXT_NS,AttributeQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
844 samlconstants::SAML20MD_NS,AttributeQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
847 /** Builder that allows element/type override. */
848 #ifdef HAVE_COVARIANT_RETURNS
849 virtual AttributeQueryDescriptorType* buildObject(
851 virtual xmltooling::XMLObject* buildObject(
853 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
856 /** Singleton builder. */
857 static AttributeQueryDescriptorType* buildAttributeQueryDescriptorType() {
858 const AttributeQueryDescriptorTypeBuilder* b = dynamic_cast<const AttributeQueryDescriptorTypeBuilder*>(
859 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AttributeQueryDescriptorType::TYPE_NAME))
862 #ifdef HAVE_COVARIANT_RETURNS
863 return b->buildObject();
865 return dynamic_cast<AttributeQueryDescriptorType*>(b->buildObject());
868 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AttributeQueryDescriptorType.");
873 * Builder for AuthzDecisionQueryDescriptorType objects.
875 * This is customized to return a RoleDescriptor element with an
876 * xsi:type of AuthzDecisionQueryDescriptorType.
878 class SAML_API AuthzDecisionQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
880 virtual ~AuthzDecisionQueryDescriptorTypeBuilder() {}
881 /** Default builder. */
882 #ifdef HAVE_COVARIANT_RETURNS
883 virtual AuthzDecisionQueryDescriptorType* buildObject() const {
885 virtual xmltooling::XMLObject* buildObject() const {
887 xmltooling::QName schemaType(
888 samlconstants::SAML20MD_QUERY_EXT_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
891 samlconstants::SAML20MD_NS,AuthzDecisionQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
894 /** Builder that allows element/type override. */
895 #ifdef HAVE_COVARIANT_RETURNS
896 virtual AuthzDecisionQueryDescriptorType* buildObject(
898 virtual xmltooling::XMLObject* buildObject(
900 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
903 /** Singleton builder. */
904 static AuthzDecisionQueryDescriptorType* buildAuthzDecisionQueryDescriptorType() {
905 const AuthzDecisionQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthzDecisionQueryDescriptorTypeBuilder*>(
906 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME))
909 #ifdef HAVE_COVARIANT_RETURNS
910 return b->buildObject();
912 return dynamic_cast<AuthzDecisionQueryDescriptorType*>(b->buildObject());
915 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthzDecisionQueryDescriptorType.");
920 * Registers builders and validators for SAML 2.0 Metadata classes into the runtime.
922 void SAML_API registerMetadataClasses();
926 #endif /* __saml2_metadata_h__ */