X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml1%2Fcore%2FProtocols.h;h=10fc9c7b5f2752075079d4f900f2147a2fbe3114;hb=5697d9abd4e6d149bbc6153acde26c3f0a5d4859;hp=c3300b96ab946396fedc86fc80a8f8c1b0105870;hpb=c2e1672d873d6fbdfb199e60bcaff6cae4fcf978;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/saml1/core/Protocols.h b/saml/saml1/core/Protocols.h index c3300b9..10fc9c7 100644 --- a/saml/saml1/core/Protocols.h +++ b/saml/saml1/core/Protocols.h @@ -1,6 +1,6 @@ /* - * Copyright 2001-2006 Internet2 - * + * Copyright 2001-2009 Internet2 + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,29 +16,51 @@ /** * @file saml/saml1/core/Protocols.h - * - * XMLObjects representing the SAML 1.x Protocols schema + * + * XMLObjects representing the SAML 1.x Protocols schema. */ #ifndef __saml1_protocols_h__ #define __saml1_protocols_h__ -#include +#include +#include + +#include +#include #define DECL_SAML1POBJECTBUILDER(cname) \ - DECL_XMLOBJECTBUILDER(SAML_API,cname,opensaml::SAMLConstants::SAML1P_NS,opensaml::SAMLConstants::SAML1P_PREFIX) + DECL_XMLOBJECTBUILDER(SAML_API,cname,samlconstants::SAML1P_NS,samlconstants::SAML1P_PREFIX) + +namespace xmltooling { + class XMLTOOL_API DateTime; +}; + +namespace xmlsignature { + class XMLTOOL_API KeyInfo; + class XMLTOOL_API Signature; +}; namespace opensaml { + namespace saml1 { + class SAML_API Action; + class SAML_API Assertion; + class SAML_API AssertionIDReference; + class SAML_API AttributeDesignator; + class SAML_API Evidence; + class SAML_API Subject; + }; + /** * @namespace opensaml::saml1p * SAML 1.x protocol namespace */ namespace saml1p { - + DECL_XMLOBJECT_SIMPLE(SAML_API,AssertionArtifact,Artifact,SAML 1.x AssertionArtifact element); DECL_XMLOBJECT_SIMPLE(SAML_API,StatusMessage,Message,SAML 1.x StatusMessage element); - + BEGIN_XMLOBJECT(SAML_API,RespondWith,xmltooling::XMLObject,SAML 1.x RespondWith element); /** Gets the QName content of the element. */ virtual xmltooling::QName* getQName() const=0; @@ -74,12 +96,11 @@ namespace opensaml { static const XMLCh TYPE_NAME[]; END_XMLOBJECT; - BEGIN_XMLOBJECT(SAML_API,RequestAbstractType,SignableObject,SAML 1.x RequestAbstractType base type); + BEGIN_XMLOBJECT(SAML_API,RequestAbstractType,RootObject,SAML 1.x RequestAbstractType base type); DECL_INTEGER_ATTRIB(MinorVersion,MINORVERSION); DECL_STRING_ATTRIB(RequestID,REQUESTID); - DECL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT); + DECL_INHERITED_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT); DECL_TYPED_CHILDREN(RespondWith); - DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature); /** RequestAbstractType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; @@ -111,8 +132,7 @@ namespace opensaml { static xmltooling::QName VERSIONMISMATCH; END_XMLOBJECT; - BEGIN_XMLOBJECT(SAML_API,StatusDetail,xmltooling::XMLObject,SAML 1.x StatusDetail element); - DECL_XMLOBJECT_CHILDREN(Detail); + BEGIN_XMLOBJECT(SAML_API,StatusDetail,xmltooling::ElementExtensibleXMLObject,SAML 1.x StatusDetail element); /** StatusDetailType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; @@ -125,13 +145,12 @@ namespace opensaml { static const XMLCh TYPE_NAME[]; END_XMLOBJECT; - BEGIN_XMLOBJECT(SAML_API,ResponseAbstractType,SignableObject,SAML 1.x ResponseAbstractType base type); + BEGIN_XMLOBJECT(SAML_API,ResponseAbstractType,RootObject,SAML 1.x ResponseAbstractType base type); DECL_INTEGER_ATTRIB(MinorVersion,MINORVERSION); DECL_STRING_ATTRIB(ResponseID,RESPONSEID); DECL_STRING_ATTRIB(InResponseTo,INRESPONSETO); - DECL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT); + DECL_INHERITED_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT); DECL_STRING_ATTRIB(Recipient,RECIPIENT); - DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature); /** ResponseAbstractType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; @@ -154,16 +173,44 @@ namespace opensaml { DECL_SAML1POBJECTBUILDER(StatusCode); DECL_SAML1POBJECTBUILDER(StatusDetail); DECL_SAML1POBJECTBUILDER(StatusMessage); - + /** - * Registers builders and validators for SAML 1.x Protocol classes into the runtime. + * Builder for Query extension objects. + * + * This is customized to force the schema type to be specified. */ - void SAML_API registerProtocolClasses(); + class SAML_API QueryBuilder : public xmltooling::XMLObjectBuilder { + public: + virtual ~QueryBuilder() {} + /** Builder that allows element/type override. */ +#ifdef HAVE_COVARIANT_RETURNS + virtual Query* buildObject( +#else + virtual xmltooling::XMLObject* buildObject( +#endif + const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL + ) const; + + /** Singleton builder. */ + static Query* buildQuery(const xmltooling::QName& schemaType) { + const QueryBuilder* b = dynamic_cast( + XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML1P_NS,Query::LOCAL_NAME)) + ); + if (b) { +#ifdef HAVE_COVARIANT_RETURNS + return b->buildObject(samlconstants::SAML1P_NS, Query::LOCAL_NAME, samlconstants::SAML1P_PREFIX, &schemaType); +#else + return dynamic_cast(b->buildObject(samlconstants::SAML1P_NS, Query::LOCAL_NAME, samlconstants::SAML1P_PREFIX, &schemaType)); +#endif + } + throw xmltooling::XMLObjectException("Unable to obtain typed builder for Query."); + } + }; /** - * Validator suite for SAML 1.x Protocol schema validation. + * Registers builders and validators for SAML 1.x Protocol classes into the runtime. */ - extern SAML_API xmltooling::ValidatorSuite ProtocolSchemaValidators; + void SAML_API registerProtocolClasses(); }; };