X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml1%2Fcore%2FAssertions.h;h=6c5fa78d6a87137ba1f484001d3618350b0c94b4;hb=04482c5c0e5fac5b688b0d23713526a15c51bd31;hp=bd0a770bea739667841f35072c358f2c6a11dc2a;hpb=0beb48ce00d0b6a3f177f7d9b48af1870ee92190;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/saml1/core/Assertions.h b/saml/saml1/core/Assertions.h index bd0a770..6c5fa78 100644 --- a/saml/saml1/core/Assertions.h +++ b/saml/saml1/core/Assertions.h @@ -1,23 +1,27 @@ -/* - * Copyright 2001-2007 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/Assertions.h - * - * XMLObjects representing the SAML 1.x Assertions schema + * + * XMLObjects representing the SAML 1.x Assertions schema. */ #ifndef __saml1_assertions_h__ @@ -27,14 +31,20 @@ #include #include -#include -#include -#include -#include +#include #define DECL_SAML1OBJECTBUILDER(cname) \ DECL_XMLOBJECTBUILDER(SAML_API,cname,samlconstants::SAML1_NS,samlconstants::SAML1_PREFIX) +namespace xmltooling { + class XMLTOOL_API DateTime; +}; + +namespace xmlsignature { + class XMLTOOL_API KeyInfo; + class XMLTOOL_API Signature; +}; + namespace opensaml { /** @@ -42,17 +52,17 @@ namespace opensaml { * SAML 1.x assertion namespace */ namespace saml1 { - + // Forward references class SAML_API Assertion; - + DECL_XMLOBJECT_SIMPLE(SAML_API,AssertionIDReference,AssertionID,SAML 1.x AssertionIDReference element); DECL_XMLOBJECT_SIMPLE(SAML_API,Audience,AudienceURI,SAML 1.x Audience element); DECL_XMLOBJECT_SIMPLE(SAML_API,ConfirmationMethod,Method,SAML 1.x ConfirmationMethod element); - + BEGIN_XMLOBJECT(SAML_API,Condition,xmltooling::XMLObject,SAML 1.x Condition element); END_XMLOBJECT; - + BEGIN_XMLOBJECT(SAML_API,AudienceRestrictionCondition,Condition,SAML 1.x AudienceRestrictionCondition element); DECL_TYPED_CHILDREN(Audience); /** AudienceRestrictionConditionType local name */ @@ -92,7 +102,7 @@ namespace opensaml { BEGIN_XMLOBJECT(SAML_API,SubjectConfirmationData,xmltooling::ElementProxy,SAML 1.x SubjectConfirmationData element); END_XMLOBJECT; - + BEGIN_XMLOBJECT(SAML_API,SubjectConfirmation,xmltooling::XMLObject,SAML 1.x SubjectConfirmation element); DECL_TYPED_CHILDREN(ConfirmationMethod); DECL_XMLOBJECT_CHILD(SubjectConfirmationData); @@ -253,7 +263,73 @@ namespace opensaml { DECL_SAML1OBJECTBUILDER(SubjectConfirmation); DECL_SAML1OBJECTBUILDER(SubjectConfirmationData); DECL_SAML1OBJECTBUILDER(SubjectLocality); - + + /** + * Builder for Condition extension objects. + * + * This is customized to force the schema type to be specified. + */ + class SAML_API ConditionBuilder : public xmltooling::XMLObjectBuilder { + public: + virtual ~ConditionBuilder() {} + /** Builder that allows element/type override. */ +#ifdef HAVE_COVARIANT_RETURNS + virtual Condition* 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 Condition* buildCondition(const xmltooling::QName& schemaType) { + const ConditionBuilder* b = dynamic_cast( + XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML1_NS,Condition::LOCAL_NAME)) + ); + if (b) { +#ifdef HAVE_COVARIANT_RETURNS + return b->buildObject(samlconstants::SAML1_NS, Condition::LOCAL_NAME, samlconstants::SAML1_PREFIX, &schemaType); +#else + return dynamic_cast(b->buildObject(samlconstants::SAML1_NS, Condition::LOCAL_NAME, samlconstants::SAML1_PREFIX, &schemaType)); +#endif + } + throw xmltooling::XMLObjectException("Unable to obtain typed builder for Condition."); + } + }; + + /** + * Builder for Statement extension objects. + * + * This is customized to force the schema type to be specified. + */ + class SAML_API StatementBuilder : public xmltooling::XMLObjectBuilder { + public: + virtual ~StatementBuilder() {} + /** Builder that allows element/type override. */ +#ifdef HAVE_COVARIANT_RETURNS + virtual Statement* 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 Statement* buildStatement(const xmltooling::QName& schemaType) { + const StatementBuilder* b = dynamic_cast( + XMLObjectBuilder::getBuilder(xmltooling::QName(samlconstants::SAML1_NS,Statement::LOCAL_NAME)) + ); + if (b) { +#ifdef HAVE_COVARIANT_RETURNS + return b->buildObject(samlconstants::SAML1_NS, Statement::LOCAL_NAME, samlconstants::SAML1_PREFIX, &schemaType); +#else + return dynamic_cast(b->buildObject(samlconstants::SAML1_NS, Statement::LOCAL_NAME, samlconstants::SAML1_PREFIX, &schemaType)); +#endif + } + throw xmltooling::XMLObjectException("Unable to obtain typed builder for Statement."); + } + }; + /** * Registers builders and validators for SAML 1.x Assertion classes into the runtime. */