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);
99 BEGIN_XMLOBJECT(SAML_API,localizedNameType,xmltooling::XMLObject,SAML 2.0 localizedNameType type);
100 DECL_STRING_ATTRIB(Lang,LANG);
101 /** localizedNameType local name */
102 static const XMLCh TYPE_NAME[];
105 BEGIN_XMLOBJECT(SAML_API,localizedURIType,xmltooling::XMLObject,SAML 2.0 localizedURIType type);
106 DECL_STRING_ATTRIB(Lang,LANG);
107 /** localizedURIType local name */
108 static const XMLCh TYPE_NAME[];
111 BEGIN_XMLOBJECT(SAML_API,OrganizationName,localizedNameType,SAML 2.0 OrganizationName element);
112 DECL_SIMPLE_CONTENT(Name);
115 BEGIN_XMLOBJECT(SAML_API,OrganizationDisplayName,localizedNameType,SAML 2.0 OrganizationDisplayName element);
116 DECL_SIMPLE_CONTENT(Name);
119 BEGIN_XMLOBJECT(SAML_API,OrganizationURL,localizedURIType,SAML 2.0 OrganizationURL element);
120 DECL_SIMPLE_CONTENT(URL);
123 BEGIN_XMLOBJECT(SAML_API,Extensions,xmltooling::ElementExtensibleXMLObject,SAML 2.0 Extensions element);
124 /** ExtensionsType local name */
125 static const XMLCh TYPE_NAME[];
128 BEGIN_XMLOBJECT(SAML_API,Organization,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 Organization element);
129 DECL_TYPED_CHILD(Extensions);
130 DECL_TYPED_CHILDREN(OrganizationName);
131 DECL_TYPED_CHILDREN(OrganizationDisplayName);
132 DECL_TYPED_CHILDREN(OrganizationURL);
133 /** OrganizationType local name */
134 static const XMLCh TYPE_NAME[];
137 BEGIN_XMLOBJECT(SAML_API,ContactPerson,xmltooling::AttributeExtensibleXMLObject,SAML 2.0 ContactPerson element);
138 DECL_STRING_ATTRIB(ContactType,CONTACTTYPE);
139 DECL_TYPED_CHILD(Extensions);
140 DECL_TYPED_CHILD(Company);
141 DECL_TYPED_CHILD(GivenName);
142 DECL_TYPED_CHILD(SurName);
143 DECL_TYPED_CHILDREN(EmailAddress);
144 DECL_TYPED_CHILDREN(TelephoneNumber);
145 /** ContactType local name */
146 static const XMLCh TYPE_NAME[];
147 /** technical Contact Type */
148 static const XMLCh CONTACT_TECHNICAL[];
149 /** support Contact Type */
150 static const XMLCh CONTACT_SUPPORT[];
151 /** administrative Contact Type */
152 static const XMLCh CONTACT_ADMINISTRATIVE[];
153 /** billing Contact Type */
154 static const XMLCh CONTACT_BILLING[];
155 /** other Contact Type */
156 static const XMLCh CONTACT_OTHER[];
159 BEGIN_XMLOBJECT(SAML_API,AdditionalMetadataLocation,xmltooling::XMLObject,SAML 2.0 AdditionalMetadataLocation element);
160 DECL_STRING_ATTRIB(Namespace,NAMESPACE);
161 DECL_SIMPLE_CONTENT(Location);
162 /** AdditionalMetadataLocationType local name */
163 static const XMLCh TYPE_NAME[];
166 BEGIN_XMLOBJECT(SAML_API,KeyDescriptor,xmltooling::XMLObject,SAML 2.0 KeyDescriptor element);
167 DECL_STRING_ATTRIB(Use,USE);
168 DECL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
169 DECL_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption);
170 /** KeyDescriptorType local name */
171 static const XMLCh TYPE_NAME[];
172 /** encryption Key Type */
173 static const XMLCh KEYTYPE_ENCRYPTION[];
174 /** signing Key Type */
175 static const XMLCh KEYTYPE_SIGNING[];
178 BEGIN_XMLOBJECT4(SAML_API,RoleDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
179 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 RoleDescriptor abstract element);
180 DECL_STRING_ATTRIB(ID,ID);
181 DECL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION);
182 /** Searches the ProtocolSupportEnumeration attribute for the indicated protocol. */
183 virtual bool hasSupport(const XMLCh* protocol) const=0;
184 /** Adds the indicated protocol to the ProtocolSupportEnumeration attribute. */
185 virtual void addSupport(const XMLCh* protocol)=0;
186 DECL_STRING_ATTRIB(ErrorURL,ERRORURL);
187 DECL_TYPED_CHILD(Extensions);
188 DECL_TYPED_CHILDREN(KeyDescriptor);
189 DECL_TYPED_CHILD(Organization);
190 DECL_TYPED_CHILDREN(ContactPerson);
191 /** Returns the first digest method supported by the role and the underlying implementation, if any. */
192 virtual const DigestMethod* getDigestMethod() const;
193 /** Returns the first signing method supported by the role and the underlying implementation, if any, along with a matching credential. */
194 virtual std::pair<const SigningMethod*,const xmltooling::Credential*> getSigningMethod(
195 const xmltooling::CredentialResolver& resolver, xmltooling::CredentialCriteria& cc
199 BEGIN_XMLOBJECT2(SAML_API,RoleDescriptorType,RoleDescriptor,xmltooling::ElementExtensibleXMLObject,SAML 2.0 RoleDescriptor extension);
202 BEGIN_XMLOBJECT(SAML_API,EndpointType,xmltooling::ElementProxy,SAML 2.0 EndpointType type);
203 DECL_STRING_ATTRIB(Binding,BINDING);
204 DECL_STRING_ATTRIB(Location,LOCATION);
205 DECL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION);
206 /** EndpointType local name */
207 static const XMLCh TYPE_NAME[];
210 BEGIN_XMLOBJECT(SAML_API,IndexedEndpointType,EndpointType,SAML 2.0 IndexedEndpointType type);
211 DECL_INTEGER_ATTRIB(Index,INDEX);
212 DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
213 /** IndexedEndpointType local name */
214 static const XMLCh TYPE_NAME[];
217 BEGIN_XMLOBJECT(SAML_API,ArtifactResolutionService,IndexedEndpointType,SAML 2.0 ArtifactResolutionService element);
220 BEGIN_XMLOBJECT(SAML_API,SingleLogoutService,EndpointType,SAML 2.0 SingleLogoutService element);
223 BEGIN_XMLOBJECT(SAML_API,ManageNameIDService,EndpointType,SAML 2.0 ManageNameIDService element);
226 BEGIN_XMLOBJECT(SAML_API,SSODescriptorType,RoleDescriptor,SAML 2.0 SSODescriptorType abstract type);
227 DECL_TYPED_CHILDREN(ArtifactResolutionService);
228 DECL_TYPED_CHILDREN(SingleLogoutService);
229 DECL_TYPED_CHILDREN(ManageNameIDService);
230 DECL_TYPED_CHILDREN(NameIDFormat);
231 /** SSODescriptorType local name */
232 static const XMLCh TYPE_NAME[];
235 BEGIN_XMLOBJECT(SAML_API,SingleSignOnService,EndpointType,SAML 2.0 SingleSignOnService element);
238 BEGIN_XMLOBJECT(SAML_API,NameIDMappingService,EndpointType,SAML 2.0 NameIDMappingService element);
241 BEGIN_XMLOBJECT(SAML_API,AssertionIDRequestService,EndpointType,SAML 2.0 AssertionIDRequestService element);
244 BEGIN_XMLOBJECT(SAML_API,IDPSSODescriptor,SSODescriptorType,SAML 2.0 IDPSSODescriptor element);
245 DECL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,false);
246 DECL_TYPED_CHILDREN(SingleSignOnService);
247 DECL_TYPED_CHILDREN(NameIDMappingService);
248 DECL_TYPED_CHILDREN(AssertionIDRequestService);
249 DECL_TYPED_CHILDREN(AttributeProfile);
250 DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
251 /** IDPSSODescriptorType local name */
252 static const XMLCh TYPE_NAME[];
256 BEGIN_XMLOBJECT(SAML_API,ServiceName,localizedNameType,SAML 2.0 ServiceName element);
257 DECL_SIMPLE_CONTENT(Name);
260 BEGIN_XMLOBJECT(SAML_API,ServiceDescription,localizedNameType,SAML 2.0 ServiceDescription element);
261 DECL_SIMPLE_CONTENT(Description);
264 BEGIN_XMLOBJECT(SAML_API,RequestedAttribute,saml2::Attribute,SAML 2.0 RequestedAttribute element);
265 DECL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,false);
266 /** RequestedAttributeType local name */
267 static const XMLCh TYPE_NAME[];
270 BEGIN_XMLOBJECT(SAML_API,AttributeConsumingService,xmltooling::XMLObject,SAML 2.0 AttributeConsumingService element);
271 DECL_INTEGER_ATTRIB(Index,INDEX);
272 DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
273 DECL_TYPED_CHILDREN(ServiceName);
274 DECL_TYPED_CHILDREN(ServiceDescription);
275 DECL_TYPED_CHILDREN(RequestedAttribute);
276 /** AttributeConsumingServiceType local name */
277 static const XMLCh TYPE_NAME[];
280 BEGIN_XMLOBJECT(SAML_API,AssertionConsumerService,IndexedEndpointType,SAML 2.0 AssertionConsumerService element);
283 BEGIN_XMLOBJECT(SAML_API,SPSSODescriptor,SSODescriptorType,SAML 2.0 SPSSODescriptor element);
284 DECL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,false);
285 DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
286 DECL_TYPED_CHILDREN(AssertionConsumerService);
287 DECL_TYPED_CHILDREN(AttributeConsumingService);
288 /** SPSSODescriptorType local name */
289 static const XMLCh TYPE_NAME[];
293 BEGIN_XMLOBJECT(SAML_API,AuthnQueryService,EndpointType,SAML 2.0 AuthnQueryService element);
296 BEGIN_XMLOBJECT(SAML_API,AuthnAuthorityDescriptor,RoleDescriptor,SAML 2.0 AuthnAuthorityDescriptor element);
297 DECL_TYPED_CHILDREN(AuthnQueryService);
298 DECL_TYPED_CHILDREN(AssertionIDRequestService);
299 DECL_TYPED_CHILDREN(NameIDFormat);
300 /** AuthnAuthorityDescriptorType local name */
301 static const XMLCh TYPE_NAME[];
305 BEGIN_XMLOBJECT(SAML_API,AuthzService,EndpointType,SAML 2.0 AuthzService element);
308 BEGIN_XMLOBJECT(SAML_API,PDPDescriptor,RoleDescriptor,SAML 2.0 PDPDescriptor element);
309 DECL_TYPED_CHILDREN(AuthzService);
310 DECL_TYPED_CHILDREN(AssertionIDRequestService);
311 DECL_TYPED_CHILDREN(NameIDFormat);
312 /** PDPDescriptorType local name */
313 static const XMLCh TYPE_NAME[];
317 BEGIN_XMLOBJECT(SAML_API,AttributeService,EndpointType,SAML 2.0 AttributeService element);
320 BEGIN_XMLOBJECT(SAML_API,AttributeAuthorityDescriptor,RoleDescriptor,SAML 2.0 AttributeAuthorityDescriptor element);
321 DECL_TYPED_CHILDREN(AttributeService);
322 DECL_TYPED_CHILDREN(AssertionIDRequestService);
323 DECL_TYPED_CHILDREN(NameIDFormat);
324 DECL_TYPED_CHILDREN(AttributeProfile);
325 DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
326 /** AttributeAuthorityDescriptorType local name */
327 static const XMLCh TYPE_NAME[];
331 BEGIN_XMLOBJECT(SAML_API,QueryDescriptorType,RoleDescriptor,SAML 2.0 QueryDescriptorType abstract type);
332 DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
333 DECL_TYPED_CHILDREN(NameIDFormat);
334 /** QueryDescriptorType local name */
335 static const XMLCh TYPE_NAME[];
338 BEGIN_XMLOBJECT(SAML_API,AuthnQueryDescriptorType,QueryDescriptorType,SAML 2.0 AuthnQueryDescriptorType extension type);
339 /** AuthnQueryDescriptorType local name */
340 static const XMLCh TYPE_NAME[];
344 BEGIN_XMLOBJECT(SAML_API,AttributeQueryDescriptorType,QueryDescriptorType,SAML 2.0 AttributeQueryDescriptorType extension type);
345 DECL_TYPED_CHILDREN(AttributeConsumingService);
346 /** AttributeQueryDescriptorType local name */
347 static const XMLCh TYPE_NAME[];
351 BEGIN_XMLOBJECT(SAML_API,AuthzDecisionQueryDescriptorType,QueryDescriptorType,SAML 2.0 AuthzDecisionQueryDescriptorType extension type);
352 DECL_TYPED_CHILDREN(ActionNamespace);
353 /** AuthzDecisionQueryDescriptorType local name */
354 static const XMLCh TYPE_NAME[];
358 BEGIN_XMLOBJECT4(SAML_API,AffiliationDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
359 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 AffiliationDescriptor element);
360 DECL_STRING_ATTRIB(ID,ID);
361 DECL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID);
362 DECL_TYPED_CHILD(Extensions);
363 DECL_TYPED_CHILDREN(AffiliateMember);
364 DECL_TYPED_CHILDREN(KeyDescriptor);
365 /** AffiliationDescriptorType local name */
366 static const XMLCh TYPE_NAME[];
369 BEGIN_XMLOBJECT4(SAML_API,EntityDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
370 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 EntityDescriptor element);
371 DECL_STRING_ATTRIB(ID,ID);
372 DECL_STRING_ATTRIB(EntityID,ENTITYID);
373 DECL_TYPED_CHILD(Extensions);
374 DECL_TYPED_CHILD(AffiliationDescriptor);
375 DECL_TYPED_CHILDREN(RoleDescriptor);
376 DECL_TYPED_CHILDREN(IDPSSODescriptor);
377 DECL_TYPED_CHILDREN(SPSSODescriptor);
378 DECL_TYPED_CHILDREN(AuthnAuthorityDescriptor);
379 DECL_TYPED_CHILDREN(AttributeAuthorityDescriptor);
380 DECL_TYPED_CHILDREN(PDPDescriptor);
381 DECL_TYPED_CHILDREN(AuthnQueryDescriptorType);
382 DECL_TYPED_CHILDREN(AttributeQueryDescriptorType);
383 DECL_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType);
384 DECL_TYPED_CHILD(Organization);
385 DECL_TYPED_CHILDREN(ContactPerson);
386 DECL_TYPED_CHILDREN(AdditionalMetadataLocation);
387 /** Finds an arbitrary role type supporting a given protocol. */
388 virtual const RoleDescriptor* getRoleDescriptor(const xmltooling::QName& qname, const XMLCh* protocol) const=0;
389 /** EntityDescriptorType local name */
390 static const XMLCh TYPE_NAME[];
393 BEGIN_XMLOBJECT3(SAML_API,EntitiesDescriptor,SignableObject,CacheableSAMLObject,
394 TimeBoundSAMLObject,SAML 2.0 EntitiesDescriptor element);
395 DECL_STRING_ATTRIB(ID,ID);
396 DECL_STRING_ATTRIB(Name,NAME);
397 DECL_TYPED_CHILD(Extensions);
398 DECL_TYPED_CHILDREN(EntityDescriptor);
399 DECL_TYPED_CHILDREN(EntitiesDescriptor);
400 /** EntitiesDescriptorType local name */
401 static const XMLCh TYPE_NAME[];
404 // Known Metadata Extensions
406 DECL_XMLOBJECT_SIMPLE(SAML_API,SourceID,ID,SAML 1.x Metadata Profile SourceID element);
408 BEGIN_XMLOBJECT(SAML_API,DiscoveryResponse,IndexedEndpointType,Identity Provider Discovery Protocol DiscoveryResponse element);
411 BEGIN_XMLOBJECT(SAML_API,RequestInitiator,EndpointType,Service Provider Request Initiation RequestInitiator element);
414 BEGIN_XMLOBJECT(SAML_API,EntityAttributes,xmltooling::XMLObject,SAML Metadata Extension for Entity Attributes element);
415 DECL_TYPED_FOREIGN_CHILDREN(Attribute,saml2);
416 DECL_TYPED_FOREIGN_CHILDREN(Assertion,saml2);
417 /** EntityAttributesType local name */
418 static const XMLCh TYPE_NAME[];
421 BEGIN_XMLOBJECT(SAML_API,DigestMethod,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Algorithm Support DigestMethod element);
422 DECL_STRING_ATTRIB(Algorithm,ALGORITHM);
423 /** DigestMethodType local name */
424 static const XMLCh TYPE_NAME[];
427 BEGIN_XMLOBJECT(SAML_API,SigningMethod,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Algorithm Support SigningMethod element);
428 DECL_STRING_ATTRIB(Algorithm,ALGORITHM);
429 DECL_INTEGER_ATTRIB(MinKeySize,MINKEYSIZE);
430 DECL_INTEGER_ATTRIB(MaxKeySize,MAXKEYSIZE);
431 /** SigningMethodType local name */
432 static const XMLCh TYPE_NAME[];
435 BEGIN_XMLOBJECT(SAML_API,DisplayName,localizedNameType,SAML Metadata Extension for Login UI DisplayName element);
436 DECL_SIMPLE_CONTENT(Name);
439 BEGIN_XMLOBJECT(SAML_API,Description,localizedNameType,SAML Metadata Extension for Login UI Description element);
440 DECL_SIMPLE_CONTENT(Description);
443 BEGIN_XMLOBJECT(SAML_API,Logo,xmltooling::XMLObject,SAML Metadata Extension for Login UI Logo element);
444 DECL_STRING_ATTRIB(Lang,LANG);
445 DECL_INTEGER_ATTRIB(Height,HEIGHT);
446 DECL_INTEGER_ATTRIB(Width,WIDTH);
447 DECL_SIMPLE_CONTENT(URL);
448 /** LogoType local name */
449 static const XMLCh TYPE_NAME[];
452 BEGIN_XMLOBJECT(SAML_API,InformationURL,localizedURIType,SAML Metadata Extension for Login UI InformationURL element);
453 DECL_SIMPLE_CONTENT(URL);
456 BEGIN_XMLOBJECT(SAML_API,PrivacyStatementURL,localizedURIType,SAML Metadata Extension for Login UI PrivacyStatementURL element);
457 DECL_SIMPLE_CONTENT(URL);
460 BEGIN_XMLOBJECT(SAML_API,UIInfo,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Login UI UIInfo element);
461 DECL_TYPED_CHILDREN(DisplayName);
462 DECL_TYPED_CHILDREN(Description);
463 DECL_TYPED_CHILDREN(Logo);
464 DECL_TYPED_CHILDREN(InformationURL);
465 DECL_TYPED_CHILDREN(PrivacyStatementURL);
466 /** UIInfoType local name */
467 static const XMLCh TYPE_NAME[];
470 DECL_XMLOBJECT_SIMPLE(SAML_API,IPHint,Hint,SAML Metadata Extension for Login UI IPHint element);
471 DECL_XMLOBJECT_SIMPLE(SAML_API,DomainHint,Hint,SAML Metadata Extension for Login UI DomainHint element);
472 DECL_XMLOBJECT_SIMPLE(SAML_API,GeolocationHint,Hint,SAML Metadata Extension for Login UI GeolocationHint element);
474 BEGIN_XMLOBJECT(SAML_API,DiscoHints,xmltooling::ElementExtensibleXMLObject,SAML Metadata Extension for Login UI DiscoHints element);
475 DECL_TYPED_CHILDREN(IPHint);
476 DECL_TYPED_CHILDREN(DomainHint);
477 DECL_TYPED_CHILDREN(GeolocationHint);
478 /** DiscoHintsType local name */
479 static const XMLCh TYPE_NAME[];
483 * Predicate to test a role for validity and protocol support.
485 class isValidForProtocol
491 * @param protocol support constant to test for
493 isValidForProtocol(const XMLCh* protocol) : m_time(time(nullptr)), m_protocol(protocol) {
497 * Returns true iff the supplied role is valid now and supports the right protocol.
499 * @param role role to test
500 * @return result of predicate
502 bool operator()(const RoleDescriptor* role) const {
503 return role ? (role->isValid(m_time) && role->hasSupport(m_protocol)) : false;
508 const XMLCh* m_protocol;
512 * Predicate to test a role for type equivalence, validity, and protocol support.
514 class ofTypeValidForProtocol : public isValidForProtocol, public xmltooling::hasSchemaType
520 * @param q schema type to test for
521 * @param protocol support constant to test for
523 ofTypeValidForProtocol(const xmltooling::QName& q, const XMLCh* protocol)
524 : isValidForProtocol(protocol), xmltooling::hasSchemaType(q) {
528 * Returns true iff the supplied role is of the right type, valid now, and supports the right protocol.
530 * @param role role to test
531 * @return result of predicate
533 bool operator()(const RoleDescriptor* role) const {
534 return xmltooling::hasSchemaType::operator()(role) && isValidForProtocol::operator()(role);
538 DECL_SAML2MDOBJECTBUILDER(AdditionalMetadataLocation);
539 DECL_SAML2MDOBJECTBUILDER(AffiliateMember);
540 DECL_SAML2MDOBJECTBUILDER(AffiliationDescriptor);
541 DECL_SAML2MDOBJECTBUILDER(ArtifactResolutionService);
542 DECL_SAML2MDOBJECTBUILDER(AssertionConsumerService);
543 DECL_SAML2MDOBJECTBUILDER(AssertionIDRequestService);
544 DECL_SAML2MDOBJECTBUILDER(AttributeAuthorityDescriptor);
545 DECL_SAML2MDOBJECTBUILDER(AttributeConsumingService);
546 DECL_SAML2MDOBJECTBUILDER(AttributeProfile);
547 DECL_SAML2MDOBJECTBUILDER(AttributeService);
548 DECL_SAML2MDOBJECTBUILDER(AuthnAuthorityDescriptor);
549 DECL_SAML2MDOBJECTBUILDER(AuthnQueryService);
550 DECL_SAML2MDOBJECTBUILDER(AuthzService);
551 DECL_SAML2MDOBJECTBUILDER(Company);
552 DECL_SAML2MDOBJECTBUILDER(ContactPerson);
553 DECL_SAML2MDOBJECTBUILDER(EmailAddress);
554 DECL_SAML2MDOBJECTBUILDER(EntitiesDescriptor);
555 DECL_SAML2MDOBJECTBUILDER(EntityDescriptor);
556 DECL_SAML2MDOBJECTBUILDER(Extensions);
557 DECL_SAML2MDOBJECTBUILDER(GivenName);
558 DECL_SAML2MDOBJECTBUILDER(IDPSSODescriptor);
559 DECL_SAML2MDOBJECTBUILDER(KeyDescriptor);
560 DECL_SAML2MDOBJECTBUILDER(ManageNameIDService);
561 DECL_SAML2MDOBJECTBUILDER(NameIDFormat);
562 DECL_SAML2MDOBJECTBUILDER(NameIDMappingService);
563 DECL_SAML2MDOBJECTBUILDER(Organization);
564 DECL_SAML2MDOBJECTBUILDER(OrganizationName);
565 DECL_SAML2MDOBJECTBUILDER(OrganizationDisplayName);
566 DECL_SAML2MDOBJECTBUILDER(OrganizationURL);
567 DECL_SAML2MDOBJECTBUILDER(PDPDescriptor);
568 DECL_SAML2MDOBJECTBUILDER(RequestedAttribute);
569 DECL_SAML2MDOBJECTBUILDER(ServiceDescription);
570 DECL_SAML2MDOBJECTBUILDER(ServiceName);
571 DECL_SAML2MDOBJECTBUILDER(SingleLogoutService);
572 DECL_SAML2MDOBJECTBUILDER(SingleSignOnService);
573 DECL_SAML2MDOBJECTBUILDER(SPSSODescriptor);
574 DECL_SAML2MDOBJECTBUILDER(SurName);
575 DECL_SAML2MDOBJECTBUILDER(TelephoneNumber);
577 DECL_XMLOBJECTBUILDER(SAML_API,ActionNamespace,samlconstants::SAML20MD_QUERY_EXT_NS,samlconstants::SAML20MD_QUERY_EXT_PREFIX);
578 DECL_XMLOBJECTBUILDER(SAML_API,SourceID,samlconstants::SAML1MD_NS,samlconstants::SAML1MD_PREFIX);
579 DECL_XMLOBJECTBUILDER(SAML_API,DiscoveryResponse,samlconstants::IDP_DISCOVERY_PROTOCOL_NS,samlconstants::IDP_DISCOVERY_PROTOCOL_PREFIX);
580 DECL_XMLOBJECTBUILDER(SAML_API,RequestInitiator,samlconstants::SP_REQUEST_INIT_NS,samlconstants::SP_REQUEST_INIT_PREFIX);
581 DECL_XMLOBJECTBUILDER(SAML_API,EntityAttributes,samlconstants::SAML20MD_ENTITY_ATTRIBUTE_NS,samlconstants::SAML20MD_ENTITY_ATTRIBUTE_PREFIX);
582 DECL_XMLOBJECTBUILDER(SAML_API,DigestMethod,samlconstants::SAML20MD_ALGSUPPORT_NS,samlconstants::SAML20MD_ALGSUPPORT_PREFIX);
583 DECL_XMLOBJECTBUILDER(SAML_API,SigningMethod,samlconstants::SAML20MD_ALGSUPPORT_NS,samlconstants::SAML20MD_ALGSUPPORT_PREFIX);
585 DECL_XMLOBJECTBUILDER(SAML_API,UIInfo,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
586 DECL_XMLOBJECTBUILDER(SAML_API,DisplayName,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
587 DECL_XMLOBJECTBUILDER(SAML_API,Description,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
588 DECL_XMLOBJECTBUILDER(SAML_API,Logo,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
589 DECL_XMLOBJECTBUILDER(SAML_API,InformationURL,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
590 DECL_XMLOBJECTBUILDER(SAML_API,PrivacyStatementURL,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
591 DECL_XMLOBJECTBUILDER(SAML_API,DiscoHints,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
592 DECL_XMLOBJECTBUILDER(SAML_API,IPHint,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
593 DECL_XMLOBJECTBUILDER(SAML_API,DomainHint,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
594 DECL_XMLOBJECTBUILDER(SAML_API,GeolocationHint,samlconstants::SAML20MD_UI_NS,samlconstants::SAML20MD_UI_PREFIX);
597 * Builder for localizedNameType objects.
599 * This is customized to force the element name to be specified.
601 class SAML_API localizedNameTypeBuilder : public xmltooling::XMLObjectBuilder {
603 virtual ~localizedNameTypeBuilder() {}
604 /** Builder that allows element/type override. */
605 #ifdef HAVE_COVARIANT_RETURNS
606 virtual localizedNameType* buildObject(
608 virtual xmltooling::XMLObject* buildObject(
610 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
613 /** Singleton builder. */
614 static localizedNameType* buildlocalizedNameType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
615 const localizedNameTypeBuilder* b = dynamic_cast<const localizedNameTypeBuilder*>(
616 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME))
619 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
620 #ifdef HAVE_COVARIANT_RETURNS
621 return b->buildObject(nsURI, localName, prefix, &schemaType);
623 return dynamic_cast<localizedNameType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
626 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedNameType.");
631 * Builder for localizedURIType objects.
633 * This is customized to force the element name to be specified.
635 class SAML_API localizedURITypeBuilder : public xmltooling::XMLObjectBuilder {
637 virtual ~localizedURITypeBuilder() {}
638 /** Builder that allows element/type override. */
639 #ifdef HAVE_COVARIANT_RETURNS
640 virtual localizedURIType* buildObject(
642 virtual xmltooling::XMLObject* buildObject(
644 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
647 /** Singleton builder. */
648 static localizedURIType* buildlocalizedURIType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
649 const localizedURITypeBuilder* b = dynamic_cast<const localizedURITypeBuilder*>(
650 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME))
653 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
654 #ifdef HAVE_COVARIANT_RETURNS
655 return b->buildObject(nsURI, localName, prefix, &schemaType);
657 return dynamic_cast<localizedURIType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
660 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedURIType.");
665 * Builder for EndpointType objects.
667 * This is customized to force the element name to be specified.
669 class SAML_API EndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
671 virtual ~EndpointTypeBuilder() {}
672 /** Builder that allows element/type override. */
673 #ifdef HAVE_COVARIANT_RETURNS
674 virtual EndpointType* buildObject(
676 virtual xmltooling::XMLObject* buildObject(
678 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
681 /** Singleton builder. */
682 static EndpointType* buildEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
683 const EndpointTypeBuilder* b = dynamic_cast<const EndpointTypeBuilder*>(
684 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME))
687 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
688 #ifdef HAVE_COVARIANT_RETURNS
689 return b->buildObject(nsURI, localName, prefix, &schemaType);
691 return dynamic_cast<EndpointType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
694 throw xmltooling::XMLObjectException("Unable to obtain typed builder for EndpointType.");
699 * Builder for IndexedEndpointType objects.
701 * This is customized to force the element name to be specified.
703 class SAML_API IndexedEndpointTypeBuilder : public xmltooling::XMLObjectBuilder {
705 virtual ~IndexedEndpointTypeBuilder() {}
706 /** Builder that allows element/type override. */
707 #ifdef HAVE_COVARIANT_RETURNS
708 virtual IndexedEndpointType* buildObject(
710 virtual xmltooling::XMLObject* buildObject(
712 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
715 /** Singleton builder. */
716 static IndexedEndpointType* buildIndexedEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr) {
717 const IndexedEndpointTypeBuilder* b = dynamic_cast<const IndexedEndpointTypeBuilder*>(
718 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME))
721 xmltooling::QName schemaType(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
722 #ifdef HAVE_COVARIANT_RETURNS
723 return b->buildObject(nsURI, localName, prefix, &schemaType);
725 return dynamic_cast<IndexedEndpointType*>(b->buildObject(nsURI, localName, prefix, &schemaType));
728 throw xmltooling::XMLObjectException("Unable to obtain typed builder for IndexedEndpointType.");
733 * Builder for RoleDescriptor extension objects.
735 * This is customized to force the schema type to be specified.
737 class SAML_API RoleDescriptorBuilder : public xmltooling::XMLObjectBuilder {
739 virtual ~RoleDescriptorBuilder() {}
740 /** Builder that allows element/type override. */
741 #ifdef HAVE_COVARIANT_RETURNS
742 virtual RoleDescriptor* buildObject(
744 virtual xmltooling::XMLObject* buildObject(
746 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
749 /** Singleton builder. */
750 static RoleDescriptor* buildRoleDescriptor(const xmltooling::QName& schemaType) {
751 const RoleDescriptorBuilder* b = dynamic_cast<const RoleDescriptorBuilder*>(
752 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,RoleDescriptor::LOCAL_NAME))
755 #ifdef HAVE_COVARIANT_RETURNS
756 return b->buildObject(samlconstants::SAML20MD_NS, RoleDescriptor::LOCAL_NAME, samlconstants::SAML20MD_PREFIX, &schemaType);
758 return dynamic_cast<RoleDescriptor*>(b->buildObject(samlconstants::SAML20MD_NS, RoleDescriptor::LOCAL_NAME, samlconstants::SAML20MD_PREFIX, &schemaType));
761 throw xmltooling::XMLObjectException("Unable to obtain typed builder for RoleDescriptor.");
766 * Builder for AuthnQueryDescriptorType objects.
768 * This is customized to return a RoleDescriptor element with an
769 * xsi:type of AuthnQueryDescriptorType.
771 class SAML_API AuthnQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
773 virtual ~AuthnQueryDescriptorTypeBuilder() {}
774 /** Default builder. */
775 #ifdef HAVE_COVARIANT_RETURNS
776 virtual AuthnQueryDescriptorType* buildObject() const {
778 virtual xmltooling::XMLObject* buildObject() const {
780 xmltooling::QName schemaType(
781 samlconstants::SAML20MD_QUERY_EXT_NS,AuthnQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
784 samlconstants::SAML20MD_NS,AuthnQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
787 /** Builder that allows element/type override. */
788 #ifdef HAVE_COVARIANT_RETURNS
789 virtual AuthnQueryDescriptorType* buildObject(
791 virtual xmltooling::XMLObject* buildObject(
793 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
796 /** Singleton builder. */
797 static AuthnQueryDescriptorType* buildAuthnQueryDescriptorType() {
798 const AuthnQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthnQueryDescriptorTypeBuilder*>(
799 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthnQueryDescriptorType::TYPE_NAME))
802 #ifdef HAVE_COVARIANT_RETURNS
803 return b->buildObject();
805 return dynamic_cast<AuthnQueryDescriptorType*>(b->buildObject());
808 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthnQueryDescriptorType.");
813 * Builder for AttributeQueryDescriptorType objects.
815 * This is customized to return a RoleDescriptor element with an
816 * xsi:type of AttributeQueryDescriptorType.
818 class SAML_API AttributeQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
820 virtual ~AttributeQueryDescriptorTypeBuilder() {}
821 /** Default builder. */
822 #ifdef HAVE_COVARIANT_RETURNS
823 virtual AttributeQueryDescriptorType* buildObject() const {
825 virtual xmltooling::XMLObject* buildObject() const {
827 xmltooling::QName schemaType(
828 samlconstants::SAML20MD_QUERY_EXT_NS,AttributeQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
831 samlconstants::SAML20MD_NS,AttributeQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
834 /** Builder that allows element/type override. */
835 #ifdef HAVE_COVARIANT_RETURNS
836 virtual AttributeQueryDescriptorType* buildObject(
838 virtual xmltooling::XMLObject* buildObject(
840 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
843 /** Singleton builder. */
844 static AttributeQueryDescriptorType* buildAttributeQueryDescriptorType() {
845 const AttributeQueryDescriptorTypeBuilder* b = dynamic_cast<const AttributeQueryDescriptorTypeBuilder*>(
846 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AttributeQueryDescriptorType::TYPE_NAME))
849 #ifdef HAVE_COVARIANT_RETURNS
850 return b->buildObject();
852 return dynamic_cast<AttributeQueryDescriptorType*>(b->buildObject());
855 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AttributeQueryDescriptorType.");
860 * Builder for AuthzDecisionQueryDescriptorType objects.
862 * This is customized to return a RoleDescriptor element with an
863 * xsi:type of AuthzDecisionQueryDescriptorType.
865 class SAML_API AuthzDecisionQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
867 virtual ~AuthzDecisionQueryDescriptorTypeBuilder() {}
868 /** Default builder. */
869 #ifdef HAVE_COVARIANT_RETURNS
870 virtual AuthzDecisionQueryDescriptorType* buildObject() const {
872 virtual xmltooling::XMLObject* buildObject() const {
874 xmltooling::QName schemaType(
875 samlconstants::SAML20MD_QUERY_EXT_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
878 samlconstants::SAML20MD_NS,AuthzDecisionQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20MD_PREFIX,&schemaType
881 /** Builder that allows element/type override. */
882 #ifdef HAVE_COVARIANT_RETURNS
883 virtual AuthzDecisionQueryDescriptorType* buildObject(
885 virtual xmltooling::XMLObject* buildObject(
887 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr
890 /** Singleton builder. */
891 static AuthzDecisionQueryDescriptorType* buildAuthzDecisionQueryDescriptorType() {
892 const AuthzDecisionQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthzDecisionQueryDescriptorTypeBuilder*>(
893 XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME))
896 #ifdef HAVE_COVARIANT_RETURNS
897 return b->buildObject();
899 return dynamic_cast<AuthzDecisionQueryDescriptorType*>(b->buildObject());
902 throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthzDecisionQueryDescriptorType.");
907 * Registers builders and validators for SAML 2.0 Metadata classes into the runtime.
909 void SAML_API registerMetadataClasses();
913 #endif /* __saml2_metadata_h__ */