Merged trust engines back into a unified version, made metadata roles a "KeyInfoSource".
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / Metadata.h
index 7c70849..55df4bd 100644 (file)
 #define __saml2_metadata_h__
 
 #include <saml/saml2/core/Assertions.h>
-#include <saml/util/SAMLConstants.h>
 
 #include <ctime>
-#include <xmltooling/AttributeExtensibleXMLObject.h>
-#include <xmltooling/ElementProxy.h>
-#include <xmltooling/SimpleElement.h>
-#include <xmltooling/XMLObjectBuilder.h>
-#include <xmltooling/encryption/Encryption.h>
-#include <xmltooling/signature/KeyInfo.h>
-#include <xmltooling/signature/Signature.h>
-#include <xmltooling/util/DateTime.h>
-#include <xmltooling/validation/ValidatingXMLObject.h>
+#include <xmltooling/security/KeyInfoSource.h>
 
 #define DECL_SAML2MDOBJECTBUILDER(cname) \
-    DECL_XMLOBJECTBUILDER(SAML_API,cname,opensaml::SAMLConstants::SAML20MD_NS,opensaml::SAMLConstants::SAML20MD_PREFIX)
+    DECL_XMLOBJECTBUILDER(SAML_API,cname,samlconstants::SAML20MD_NS,samlconstants::SAML20MD_PREFIX)
 
 namespace opensaml {
 
@@ -84,29 +75,32 @@ namespace opensaml {
         DECL_XMLOBJECT_SIMPLE(SAML_API,NameIDFormat,Format,SAML 2.0 NameIDFormat element);
         DECL_XMLOBJECT_SIMPLE(SAML_API,SurName,Name,SAML 2.0 SurName element);
         DECL_XMLOBJECT_SIMPLE(SAML_API,TelephoneNumber,Number,SAML 2.0 TelephoneNumber element);
+        
+        DECL_XMLOBJECT_SIMPLE(SAML_API,ActionNamespace,Namespace,SAML 2.0 Metadata Extension ActionNamespace element);
+        DECL_XMLOBJECT_SIMPLE(SAML_API,SourceID,ID,SAML 1.x Metadata Profile SourceID element);
 
-        BEGIN_XMLOBJECT(SAML_API,localizedNameType,xmltooling::SimpleElement,SAML 2.0 localizedNameType type);
+        BEGIN_XMLOBJECT(SAML_API,localizedNameType,xmltooling::XMLObject,SAML 2.0 localizedNameType type);
             DECL_STRING_ATTRIB(Lang,LANG);
             /** localizedNameType local name */
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
 
-        BEGIN_XMLOBJECT(SAML_API,localizedURIType,xmltooling::SimpleElement,SAML 2.0 localizedURIType type);
+        BEGIN_XMLOBJECT(SAML_API,localizedURIType,xmltooling::XMLObject,SAML 2.0 localizedURIType type);
             DECL_STRING_ATTRIB(Lang,LANG);
             /** localizedURIType local name */
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,OrganizationName,localizedNameType,SAML 2.0 OrganizationName element);
-            DECL_XMLOBJECT_CONTENT(Name);
+            DECL_SIMPLE_CONTENT(Name);
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,OrganizationDisplayName,localizedNameType,SAML 2.0 OrganizationDisplayName element);
-            DECL_XMLOBJECT_CONTENT(Name);
+            DECL_SIMPLE_CONTENT(Name);
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,OrganizationURL,localizedURIType,SAML 2.0 OrganizationURL element);
-            DECL_XMLOBJECT_CONTENT(URL);
+            DECL_SIMPLE_CONTENT(URL);
         END_XMLOBJECT;
         
         BEGIN_XMLOBJECT(SAML_API,Extensions,xmltooling::ElementProxy,SAML 2.0 Extensions element);
@@ -145,9 +139,9 @@ namespace opensaml {
             static const XMLCh CONTACT_OTHER[];
         END_XMLOBJECT;
 
-        BEGIN_XMLOBJECT(SAML_API,AdditionalMetadataLocation,xmltooling::SimpleElement,SAML 2.0 AdditionalMetadataLocation element);
+        BEGIN_XMLOBJECT(SAML_API,AdditionalMetadataLocation,xmltooling::XMLObject,SAML 2.0 AdditionalMetadataLocation element);
             DECL_STRING_ATTRIB(Namespace,NAMESPACE);
-            DECL_XMLOBJECT_CONTENT(Location);
+            DECL_SIMPLE_CONTENT(Location);
             /** AdditionalMetadataLocationType local name */
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
@@ -164,14 +158,15 @@ namespace opensaml {
             static const XMLCh KEYTYPE_SIGNING[];
         END_XMLOBJECT;
 
-        BEGIN_XMLOBJECT4(SAML_API,RoleDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
-                CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 RoleDescriptor abstract element);
+        BEGIN_XMLOBJECT5(SAML_API,RoleDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
+                CacheableSAMLObject,TimeBoundSAMLObject,xmltooling::KeyInfoSource,
+                SAML 2.0 RoleDescriptor abstract element);
             DECL_STRING_ATTRIB(ID,ID);
             DECL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION);
             /** Searches the ProtocolSupportEnumeration attribute for the indicated protocol. */
             virtual bool hasSupport(const XMLCh* protocol) const=0;
             DECL_STRING_ATTRIB(ErrorURL,ERRORURL);
-            DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
+            DECL_INHERITED_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
             DECL_TYPED_CHILD(Extensions);
             DECL_TYPED_CHILDREN(KeyDescriptor);
             DECL_TYPED_CHILD(Organization);
@@ -188,7 +183,7 @@ namespace opensaml {
 
         BEGIN_XMLOBJECT(SAML_API,IndexedEndpointType,EndpointType,SAML 2.0 IndexedEndpointType type);
             DECL_INTEGER_ATTRIB(Index,INDEX);
-            DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT);
+            DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
             /** IndexedEndpointType local name */
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
@@ -221,7 +216,7 @@ namespace opensaml {
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,IDPSSODescriptor,SSODescriptorType,SAML 2.0 IDPSSODescriptor element);
-            DECL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED);
+            DECL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,false);
             DECL_TYPED_CHILDREN(SingleSignOnService);
             DECL_TYPED_CHILDREN(NameIDMappingService);
             DECL_TYPED_CHILDREN(AssertionIDRequestService);
@@ -232,22 +227,22 @@ namespace opensaml {
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,ServiceName,localizedNameType,SAML 2.0 ServiceName element);
-            DECL_XMLOBJECT_CONTENT(Name);
+            DECL_SIMPLE_CONTENT(Name);
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,ServiceDescription,localizedNameType,SAML 2.0 ServiceDescription element);
-            DECL_XMLOBJECT_CONTENT(Description);
+            DECL_SIMPLE_CONTENT(Description);
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,RequestedAttribute,saml2::Attribute,SAML 2.0 RequestedAttribute element);
-            DECL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED);
+            DECL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,false);
             /** RequestedAttributeType local name */
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,AttributeConsumingService,xmltooling::XMLObject,SAML 2.0 AttributeConsumingService element);
             DECL_INTEGER_ATTRIB(Index,INDEX);
-            DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT);
+            DECL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,false);
             DECL_TYPED_CHILDREN(ServiceName);
             DECL_TYPED_CHILDREN(ServiceDescription);
             DECL_TYPED_CHILDREN(RequestedAttribute);
@@ -259,8 +254,8 @@ namespace opensaml {
         END_XMLOBJECT;
 
         BEGIN_XMLOBJECT(SAML_API,SPSSODescriptor,SSODescriptorType,SAML 2.0 SPSSODescriptor element);
-            DECL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED);
-            DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED);
+            DECL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,false);
+            DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
             DECL_TYPED_CHILDREN(AssertionConsumerService);
             DECL_TYPED_CHILDREN(AttributeConsumingService);
             /** SPSSODescriptorType local name */
@@ -302,11 +297,35 @@ namespace opensaml {
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
 
+        BEGIN_XMLOBJECT(SAML_API,QueryDescriptorType,RoleDescriptor,SAML 2.0 QueryDescriptorType abstract type);
+            DECL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,false);
+            DECL_TYPED_CHILDREN(NameIDFormat);
+            /** QueryDescriptorType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,AuthnQueryDescriptorType,QueryDescriptorType,SAML 2.0 AuthnQueryDescriptorType extension type);
+            /** AuthnQueryDescriptorType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,AttributeQueryDescriptorType,QueryDescriptorType,SAML 2.0 AttributeQueryDescriptorType extension type);
+            DECL_TYPED_CHILDREN(AttributeConsumingService);
+            /** AttributeQueryDescriptorType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
+        BEGIN_XMLOBJECT(SAML_API,AuthzDecisionQueryDescriptorType,QueryDescriptorType,SAML 2.0 AuthzDecisionQueryDescriptorType extension type);
+            DECL_TYPED_CHILDREN(ActionNamespace);
+            /** AuthzDecisionQueryDescriptorType local name */
+            static const XMLCh TYPE_NAME[];
+        END_XMLOBJECT;
+
         BEGIN_XMLOBJECT4(SAML_API,AffiliationDescriptor,xmltooling::AttributeExtensibleXMLObject,SignableObject,
                 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 AffiliationDescriptor element);
             DECL_STRING_ATTRIB(ID,ID);
             DECL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID);
-            DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
+            DECL_INHERITED_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
             DECL_TYPED_CHILD(Extensions);
             DECL_TYPED_CHILDREN(AffiliateMember);
             DECL_TYPED_CHILDREN(KeyDescriptor);
@@ -318,7 +337,7 @@ namespace opensaml {
                 CacheableSAMLObject,TimeBoundSAMLObject,SAML 2.0 EntityDescriptor element);
             DECL_STRING_ATTRIB(ID,ID);
             DECL_STRING_ATTRIB(EntityID,ENTITYID);
-            DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
+            DECL_INHERITED_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
             DECL_TYPED_CHILD(Extensions);
             DECL_TYPED_CHILD(AffiliationDescriptor);
             DECL_TYPED_CHILDREN(RoleDescriptor);
@@ -327,6 +346,27 @@ namespace opensaml {
             DECL_TYPED_CHILDREN(AuthnAuthorityDescriptor);
             DECL_TYPED_CHILDREN(AttributeAuthorityDescriptor);
             DECL_TYPED_CHILDREN(PDPDescriptor);
+            DECL_TYPED_CHILDREN(AuthnQueryDescriptorType);
+            DECL_TYPED_CHILDREN(AttributeQueryDescriptorType);
+            DECL_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType);
+            /** Finds an IDP role supporting a given protocol. */
+            virtual const IDPSSODescriptor* getIDPSSODescriptor(const XMLCh* protocol) const=0;
+            /** Finds an SP role supporting a given protocol. */
+            virtual const SPSSODescriptor* getSPSSODescriptor(const XMLCh* protocol) const=0;
+            /** Finds an Authn Authority role supporting a given protocol. */
+            virtual const AuthnAuthorityDescriptor* getAuthnAuthorityDescriptor(const XMLCh* protocol) const=0;
+            /** Finds an Attribute Authority role supporting a given protocol. */
+            virtual const AttributeAuthorityDescriptor* getAttributeAuthorityDescriptor(const XMLCh* protocol) const=0;
+            /** Finds a PDP role supporting a given protocol. */
+            virtual const PDPDescriptor* getPDPDescriptor(const XMLCh* protocol) const=0;
+            /** Finds an AuthnQuery role supporting a given protocol. */
+            virtual const AuthnQueryDescriptorType* getAuthnQueryDescriptorType(const XMLCh* protocol) const=0;
+            /** Finds an AttributeQuery role supporting a given protocol. */
+            virtual const AttributeQueryDescriptorType* getAttributeQueryDescriptorType(const XMLCh* protocol) const=0;
+            /** Finds an AuthzDecisionQuery role supporting a given protocol. */
+            virtual const AuthzDecisionQueryDescriptorType* getAuthzDecisionQueryDescriptorType(const XMLCh* protocol) const=0;
+            /** Finds an extension role supporting a given protocol. */
+            virtual const RoleDescriptor* getRoleDescriptor(const xmltooling::QName& qname, const XMLCh* protocol) const=0;
             /** EntityDescriptorType local name */
             static const XMLCh TYPE_NAME[];
         END_XMLOBJECT;
@@ -335,7 +375,7 @@ namespace opensaml {
                 TimeBoundSAMLObject,SAML 2.0 EntitiesDescriptor element);
             DECL_STRING_ATTRIB(ID,ID);
             DECL_STRING_ATTRIB(Name,NAME);
-            DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
+            DECL_INHERITED_TYPED_FOREIGN_CHILD(Signature,xmlsignature);
             DECL_TYPED_CHILD(Extensions);
             DECL_TYPED_CHILDREN(EntityDescriptor);
             DECL_TYPED_CHILDREN(EntitiesDescriptor);
@@ -381,6 +421,9 @@ namespace opensaml {
         DECL_SAML2MDOBJECTBUILDER(SPSSODescriptor);
         DECL_SAML2MDOBJECTBUILDER(SurName);
         DECL_SAML2MDOBJECTBUILDER(TelephoneNumber);
+        
+        DECL_XMLOBJECTBUILDER(SAML_API,ActionNamespace,samlconstants::SAML20MD_QUERY_EXT_NS,samlconstants::SAML20MD_QUERY_EXT_PREFIX);
+        DECL_XMLOBJECTBUILDER(SAML_API,SourceID,samlconstants::SAML1MD_NS,samlconstants::SAML1MD_PREFIX);
 
         /**
          * Builder for localizedNameType objects.
@@ -398,10 +441,10 @@ namespace opensaml {
             /** Singleton builder. */
             static localizedNameType* buildlocalizedNameType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
                 const localizedNameTypeBuilder* b = dynamic_cast<const localizedNameTypeBuilder*>(
-                    XMLObjectBuilder::getBuilder(xmltooling::QName(SAMLConstants::SAML20MD_NS,localizedNameType::TYPE_NAME))
+                    XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME))
                     );
                 if (b) {
-                    xmltooling::QName schemaType(SAMLConstants::SAML20MD_NS,localizedNameType::TYPE_NAME,SAMLConstants::SAML20MD_PREFIX);
+                    xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedNameType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
                     return b->buildObject(nsURI, localName, prefix, &schemaType);
                 }
                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedNameType.");
@@ -424,10 +467,10 @@ namespace opensaml {
             /** Singleton builder. */
             static localizedURIType* buildlocalizedURIType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
                 const localizedURITypeBuilder* b = dynamic_cast<const localizedURITypeBuilder*>(
-                    XMLObjectBuilder::getBuilder(xmltooling::QName(SAMLConstants::SAML20MD_NS,localizedURIType::TYPE_NAME))
+                    XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME))
                     );
                 if (b) {
-                    xmltooling::QName schemaType(SAMLConstants::SAML20MD_NS,localizedURIType::TYPE_NAME,SAMLConstants::SAML20MD_PREFIX);
+                    xmltooling::QName schemaType(samlconstants::SAML20MD_NS,localizedURIType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
                     return b->buildObject(nsURI, localName, prefix, &schemaType);
                 }
                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for localizedURIType.");
@@ -450,10 +493,10 @@ namespace opensaml {
             /** Singleton builder. */
             static EndpointType* buildEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
                 const EndpointTypeBuilder* b = dynamic_cast<const EndpointTypeBuilder*>(
-                    XMLObjectBuilder::getBuilder(xmltooling::QName(SAMLConstants::SAML20MD_NS,EndpointType::TYPE_NAME))
+                    XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME))
                     );
                 if (b) {
-                    xmltooling::QName schemaType(SAMLConstants::SAML20MD_NS,EndpointType::TYPE_NAME,SAMLConstants::SAML20MD_PREFIX);
+                    xmltooling::QName schemaType(samlconstants::SAML20MD_NS,EndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
                     return b->buildObject(nsURI, localName, prefix, &schemaType);
                 }
                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for EndpointType.");
@@ -476,10 +519,10 @@ namespace opensaml {
             /** Singleton builder. */
             static IndexedEndpointType* buildIndexedEndpointType(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL) {
                 const IndexedEndpointTypeBuilder* b = dynamic_cast<const IndexedEndpointTypeBuilder*>(
-                    XMLObjectBuilder::getBuilder(xmltooling::QName(SAMLConstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME))
+                    XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME))
                     );
                 if (b) {
-                    xmltooling::QName schemaType(SAMLConstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME,SAMLConstants::SAML20MD_PREFIX);
+                    xmltooling::QName schemaType(samlconstants::SAML20MD_NS,IndexedEndpointType::TYPE_NAME,samlconstants::SAML20MD_PREFIX);
                     return b->buildObject(nsURI, localName, prefix, &schemaType);
                 }
                 throw xmltooling::XMLObjectException("Unable to obtain typed builder for IndexedEndpointType.");
@@ -487,14 +530,111 @@ namespace opensaml {
         };
 
         /**
-         * Registers builders and validators for SAML 2.0 Metadata classes into the runtime.
+         * Builder for AuthnQueryDescriptorType objects.
+         * 
+         * This is customized to return a RoleDescriptor element with an
+         * xsi:type of AuthnQueryDescriptorType.
          */
-        void SAML_API registerMetadataClasses();
+        class SAML_API AuthnQueryDescriptorTypeBuilder : public xmltooling::XMLObjectBuilder {
+        public:
+            virtual ~AuthnQueryDescriptorTypeBuilder() {}
+            /** Default builder. */
+            virtual AuthnQueryDescriptorType* buildObject() const {
+                xmltooling::QName schemaType(
+                    samlconstants::SAML20_NS,AuthnQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
+                    );
+                return buildObject(
+                    samlconstants::SAML20_NS,AuthnQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20_PREFIX,&schemaType
+                    );
+            }
+            /** Builder that allows element/type override. */
+            virtual AuthnQueryDescriptorType* buildObject(
+                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
+                ) const;
+        
+            /** Singleton builder. */
+            static AuthnQueryDescriptorType* buildAuthnQueryDescriptorType() {
+                const AuthnQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthnQueryDescriptorTypeBuilder*>(
+                    XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthnQueryDescriptorType::TYPE_NAME))
+                    );
+                if (b)
+                    return b->buildObject();
+                throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthnQueryDescriptorType.");
+            }
+        };
 
         /**
-         * Validator suite for SAML 2.0 Metadata schema validation.
+         * Builder for AttributeQueryDescriptorType objects.
+         * 
+         * This is customized to return a RoleDescriptor element with an
+         * xsi:type of AttributeQueryDescriptorType.
          */
-        extern SAML_API xmltooling::ValidatorSuite MetadataSchemaValidators;
+        class SAML_API AttributeQueryDescriptorTypeBuilder : public xmltooling::XMLObjectBuilder {
+        public:
+            virtual ~AttributeQueryDescriptorTypeBuilder() {}
+            /** Default builder. */
+            virtual AttributeQueryDescriptorType* buildObject() const {
+                xmltooling::QName schemaType(
+                    samlconstants::SAML20_NS,AttributeQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
+                    );
+                return buildObject(
+                    samlconstants::SAML20_NS,AttributeQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20_PREFIX,&schemaType
+                    );
+            }
+            /** Builder that allows element/type override. */
+            virtual AttributeQueryDescriptorType* buildObject(
+                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
+                ) const;
+        
+            /** Singleton builder. */
+            static AttributeQueryDescriptorType* buildAttributeQueryDescriptorType() {
+                const AttributeQueryDescriptorTypeBuilder* b = dynamic_cast<const AttributeQueryDescriptorTypeBuilder*>(
+                    XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AttributeQueryDescriptorType::TYPE_NAME))
+                    );
+                if (b)
+                    return b->buildObject();
+                throw xmltooling::XMLObjectException("Unable to obtain typed builder for AttributeQueryDescriptorType.");
+            }
+        };
+
+        /**
+         * Builder for AuthzDecisionQueryDescriptorType objects.
+         * 
+         * This is customized to return a RoleDescriptor element with an
+         * xsi:type of AuthzDecisionQueryDescriptorType.
+         */
+        class SAML_API AuthzDecisionQueryDescriptorTypeBuilder : public xmltooling::XMLObjectBuilder {
+        public:
+            virtual ~AuthzDecisionQueryDescriptorTypeBuilder() {}
+            /** Default builder. */
+            virtual AuthzDecisionQueryDescriptorType* buildObject() const {
+                xmltooling::QName schemaType(
+                    samlconstants::SAML20_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME,samlconstants::SAML20MD_QUERY_EXT_PREFIX
+                    );
+                return buildObject(
+                    samlconstants::SAML20_NS,AuthzDecisionQueryDescriptorType::LOCAL_NAME,samlconstants::SAML20_PREFIX,&schemaType
+                    );
+            }
+            /** Builder that allows element/type override. */
+            virtual AuthzDecisionQueryDescriptorType* buildObject(
+                const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
+                ) const;
+        
+            /** Singleton builder. */
+            static AuthzDecisionQueryDescriptorType* buildAuthzDecisionQueryDescriptorType() {
+                const AuthzDecisionQueryDescriptorTypeBuilder* b = dynamic_cast<const AuthzDecisionQueryDescriptorTypeBuilder*>(
+                    XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML20MD_QUERY_EXT_NS,AuthzDecisionQueryDescriptorType::TYPE_NAME))
+                    );
+                if (b)
+                    return b->buildObject();
+                throw xmltooling::XMLObjectException("Unable to obtain typed builder for AuthzDecisionQueryDescriptorType.");
+            }
+        };
+
+        /**
+         * Registers builders and validators for SAML 2.0 Metadata classes into the runtime.
+         */
+        void SAML_API registerMetadataClasses();
     };
 };