X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml1%2Fcore%2FProtocols.h;h=8258bb3000206545fc955625ecc2f419932964ed;hb=04482c5c0e5fac5b688b0d23713526a15c51bd31;hp=2201d091e55830f22b914fbb74ca0fbb05df7f88;hpb=1bc8e721db3a50294df852662e1eddcdbdae8f9f;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/saml1/core/Protocols.h b/saml/saml1/core/Protocols.h index 2201d09..8258bb3 100644 --- a/saml/saml1/core/Protocols.h +++ b/saml/saml1/core/Protocols.h @@ -1,23 +1,27 @@ -/* - * Copyright 2001-2006 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 +/** + * Licensed to the University Corporation for Advanced Internet + * Development, Inc. (UCAID) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + * + * UCAID licenses this file to you 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 * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. */ /** * @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,16 +30,21 @@ #include #include -#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 { @@ -52,10 +61,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; @@ -96,7 +105,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; @@ -128,8 +136,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; @@ -148,7 +155,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; @@ -171,7 +177,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. */