X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml2%2Fmetadata%2FMetadata.h;h=c8167a272d2a8c772f2472647d4a88fd03740fd2;hb=5263186a620ca02913980ad2d35d4045844e7a05;hp=7c7084998f0f96a8add36702e3e4694abc925f3d;hpb=c2e1672d873d6fbdfb199e60bcaff6cae4fcf978;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/saml2/metadata/Metadata.h b/saml/saml2/metadata/Metadata.h index 7c70849..c8167a2 100644 --- a/saml/saml2/metadata/Metadata.h +++ b/saml/saml2/metadata/Metadata.h @@ -35,7 +35,6 @@ #include #include #include -#include #define DECL_SAML2MDOBJECTBUILDER(cname) \ DECL_XMLOBJECTBUILDER(SAML_API,cname,opensaml::SAMLConstants::SAML20MD_NS,opensaml::SAMLConstants::SAML20MD_PREFIX) @@ -84,6 +83,9 @@ 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); DECL_STRING_ATTRIB(Lang,LANG); @@ -188,7 +190,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 +223,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); @@ -240,14 +242,14 @@ namespace opensaml { 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 +261,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,6 +304,30 @@ 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); @@ -327,6 +353,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; @@ -381,6 +428,9 @@ namespace opensaml { DECL_SAML2MDOBJECTBUILDER(SPSSODescriptor); DECL_SAML2MDOBJECTBUILDER(SurName); DECL_SAML2MDOBJECTBUILDER(TelephoneNumber); + + DECL_XMLOBJECTBUILDER(SAML_API,ActionNamespace,opensaml::SAMLConstants::SAML20MD_QUERY_EXT_NS,opensaml::SAMLConstants::SAML20MD_QUERY_EXT_PREFIX); + DECL_XMLOBJECTBUILDER(SAML_API,SourceID,opensaml::SAMLConstants::SAML1MD_NS,opensaml::SAMLConstants::SAML1MD_PREFIX); /** * Builder for localizedNameType objects. @@ -487,14 +537,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( + 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( + 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( + 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(); }; };