X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml1%2Fcore%2FProtocols.h;h=c640a5c355a8ea0323afbbafddbef005406bdada;hb=e9554c255ad3c91c7c4976e7a1a54905903e66a2;hp=0d9df8738c3704647cf3aaf54892df07496d41aa;hpb=66136f386ddbdd855e1a078e13e19ddbf64a01e2;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/saml1/core/Protocols.h b/saml/saml1/core/Protocols.h index 0d9df87..c640a5c 100644 --- a/saml/saml1/core/Protocols.h +++ b/saml/saml1/core/Protocols.h @@ -1,6 +1,6 @@ /* - * Copyright 2001-2006 Internet2 - * + * Copyright 2001-2010 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,8 +16,8 @@ /** * @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__ @@ -26,14 +26,21 @@ #include #include -#include -#include -#include -#include +#include +#include #define DECL_SAML1POBJECTBUILDER(cname) \ 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 { @@ -50,10 +57,10 @@ namespace opensaml { * 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; @@ -94,7 +101,6 @@ namespace opensaml { DECL_STRING_ATTRIB(RequestID,REQUESTID); DECL_INHERITED_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT); DECL_TYPED_CHILDREN(RespondWith); - DECL_INHERITED_TYPED_FOREIGN_CHILD(Signature,xmlsignature); /** RequestAbstractType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; @@ -145,7 +151,6 @@ namespace opensaml { DECL_STRING_ATTRIB(InResponseTo,INRESPONSETO); DECL_INHERITED_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT); DECL_STRING_ATTRIB(Recipient,RECIPIENT); - DECL_INHERITED_TYPED_FOREIGN_CHILD(Signature,xmlsignature); /** ResponseAbstractType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; @@ -168,7 +173,40 @@ namespace opensaml { DECL_SAML1POBJECTBUILDER(StatusCode); DECL_SAML1POBJECTBUILDER(StatusDetail); DECL_SAML1POBJECTBUILDER(StatusMessage); - + + /** + * Builder for Query extension objects. + * + * This is customized to force the schema type to be specified. + */ + 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=nullptr, const xmltooling::QName* schemaType=nullptr + ) 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."); + } + }; + /** * Registers builders and validators for SAML 1.x Protocol classes into the runtime. */