From 096d14037ebd2271f8e116d13f742be853435816 Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Mon, 8 May 2006 03:55:36 +0000 Subject: [PATCH] SAML objects in progress. --- .cdtproject | 1 + saml/Makefile.am | 5 +- saml/SAMLConfig.cpp | 60 +- saml/SAMLConfig.h | 26 + saml/internal.h | 3 + saml/saml.vcproj | 12 +- saml/saml1/core/Assertions.h | 134 +++- saml/saml1/core/impl/AssertionsImpl.cpp | 768 ++++++++++++++++++++- .../saml1/core/impl/AssertionsSchemaValidators.cpp | 146 ++++ saml/util/{XMLConstants.cpp => SAMLConstants.cpp} | 56 +- saml/util/{XMLConstants.h => SAMLConstants.h} | 2 +- 11 files changed, 1148 insertions(+), 65 deletions(-) create mode 100644 saml/saml1/core/impl/AssertionsSchemaValidators.cpp rename saml/util/{XMLConstants.cpp => SAMLConstants.cpp} (75%) rename saml/util/{XMLConstants.h => SAMLConstants.h} (95%) diff --git a/.cdtproject b/.cdtproject index e1951af..42e0853 100644 --- a/.cdtproject +++ b/.cdtproject @@ -55,6 +55,7 @@ + diff --git a/saml/Makefile.am b/saml/Makefile.am index a4afeb5..a57c0cb 100644 --- a/saml/Makefile.am +++ b/saml/Makefile.am @@ -15,7 +15,7 @@ libsamlinclude_HEADERS = \ SAMLConfig.h utilinclude_HEADERS = \ - util/XMLConstants.h + util/SAMLConstants.h saml1coreinclude_HEADERS = \ saml1/core/Assertions.h @@ -26,7 +26,8 @@ noinst_HEADERS = \ libsaml_la_SOURCES = \ SAMLConfig.cpp \ saml1/core/impl/AssertionsImpl.cpp \ - util/XMLConstants.cpp + saml1/core/impl/AssertionsSchemaValidators.cpp \ + util/SAMLConstants.cpp # this is different from the project version # http://sources.redhat.com/autobook/autobook/autobook_91.html diff --git a/saml/SAMLConfig.cpp b/saml/SAMLConfig.cpp index b36e9b0..5695db8 100644 --- a/saml/SAMLConfig.cpp +++ b/saml/SAMLConfig.cpp @@ -26,27 +26,21 @@ #include "exceptions.h" #include "SAMLConfig.h" #include "saml1/core/Assertions.h" -#include "util/XMLConstants.h" +#include "util/SAMLConstants.h" -#include #include +#include #include -using namespace opensaml::saml1; +#include +#include +#include + using namespace opensaml; +using namespace xmlsignature; using namespace xmltooling; using namespace log4cpp; - -#define REGISTER_ELEMENT(namespaceURI,cname) \ - q=QName(namespaceURI,cname::LOCAL_NAME); \ - XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \ - Validator::registerValidator(q,new cname##SchemaValidator()) - -#define REGISTER_TYPE(namespaceURI,cname) \ - q=QName(namespaceURI,cname::TYPE_NAME); \ - XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \ - Validator::registerValidator(q,new cname##SchemaValidator()) - +using namespace std; //DECL_EXCEPTION_FACTORY(XMLParserException,xmltooling); @@ -75,10 +69,7 @@ bool SAMLInternalConfig::init() XMLToolingConfig::getConfig().init(); log.debug("XMLTooling library initialized"); - QName q; - REGISTER_ELEMENT(XMLConstants::SAML1_NS,AssertionIDReference); - REGISTER_ELEMENT(XMLConstants::SAML1_NS,Audience); - REGISTER_ELEMENT(XMLConstants::SAML1_NS,ConfirmationMethod); + saml1::registerAssertionClasses(); log.info("library initialization complete"); return true; @@ -92,3 +83,36 @@ void SAMLInternalConfig::term() XMLToolingConfig::getConfig().term(); Category::getInstance(SAML_LOGCAT".SAMLConfig").info("library shutdown complete"); } + +void SAMLInternalConfig::generateRandomBytes(void* buf, unsigned int len) +{ + try { + if (XSECPlatformUtils::g_cryptoProvider->getRandom(reinterpret_cast(buf),len) hold(new unsigned char[len]); + generateRandomBytes(hold.get(),len); + for (unsigned int i=0; i +#include +#include /** * @namespace opensaml @@ -64,6 +66,30 @@ namespace opensaml { * before terminating itself */ virtual void term()=0; + + /** + * Generate random information using the underlying security library + * + * @param buf buffer for the information + * @param len number of bytes to write into buffer + */ + virtual void generateRandomBytes(void* buf, unsigned int len)=0; + + /** + * Generate random information using the underlying security library + * + * @param buf string buffer for the information + * @param len number of bytes to write into buffer + */ + virtual void generateRandomBytes(std::string& buf, unsigned int len)=0; + + /** + * Generate a valid XML identifier of the form _X{32} where X is a + * random hex character. The caller is responsible for freeing the result. + * + * @return a valid null-terminated XML ID + */ + virtual XMLCh* generateIdentifier()=0; protected: SAMLConfig() {} diff --git a/saml/internal.h b/saml/internal.h index 12d8662..aa0b8ce 100644 --- a/saml/internal.h +++ b/saml/internal.h @@ -55,6 +55,9 @@ namespace opensaml { bool init(); void term(); + void generateRandomBytes(void* buf, unsigned int len); + void generateRandomBytes(std::string& buf, unsigned int len); + XMLCh* generateIdentifier(); private: }; /// @endcond diff --git a/saml/saml.vcproj b/saml/saml.vcproj index 39ccad3..d9fe07c 100644 --- a/saml/saml.vcproj +++ b/saml/saml.vcproj @@ -62,7 +62,7 @@ /> @@ -206,6 +206,10 @@ RelativePath=".\saml1\core\impl\AssertionsImpl.cpp" > + + @@ -239,7 +243,7 @@ Name="util" > diff --git a/saml/saml1/core/Assertions.h b/saml/saml1/core/Assertions.h index 7dea433..23cb0ef 100644 --- a/saml/saml1/core/Assertions.h +++ b/saml/saml1/core/Assertions.h @@ -24,14 +24,17 @@ #define __saml_assertions_h__ #include -#include +#include #include #include #include +#include +#include +#include #include #define DECL_SAML1OBJECTBUILDER(cname) \ - DECL_XMLOBJECTBUILDER(SAML_API,cname,opensaml::XMLConstants::SAML1_NS,opensaml::XMLConstants::SAML1_PREFIX) + DECL_XMLOBJECTBUILDER(SAML_API,cname,opensaml::SAMLConstants::SAML1_NS,opensaml::SAMLConstants::SAML1_PREFIX) namespace opensaml { @@ -40,19 +43,136 @@ namespace opensaml { * SAML 1.x class namespace */ namespace saml1 { + + class SAML_API Assertion; + DECL_XMLOBJECT_SIMPLE(SAML_API,AssertionIDReference,Reference,SAML 1.x AssertionIDReference element); DECL_XMLOBJECT_SIMPLE(SAML_API,Audience,Uri,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 */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,DoNotCacheCondition,Condition,SAML 1.x DoNotCacheCondition element); + /** DoNotCacheConditionType local name */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,Conditions,xmltooling::XMLObject,SAML 1.x Conditions element); + DECL_XMLOBJECT_ATTRIB(NotBefore,NOTBEFORE,xmltooling::DateTime); + DECL_XMLOBJECT_ATTRIB(NotOnOrAfter,NOTONORAFTER,xmltooling::DateTime); + DECL_TYPED_CHILDREN(AudienceRestrictionCondition); + DECL_TYPED_CHILDREN(DoNotCacheCondition); + DECL_TYPED_CHILDREN(Condition); + /** ConditionsType local name */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,NameIdentifier,xmltooling::SimpleElement,SAML 1.x NameIdentifier element); + DECL_STRING_ATTRIB(NameQualifier,NAMEQUALIFIER); + DECL_STRING_ATTRIB(Format,FORMAT); + /** NameIdentifierType local name */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + 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); + DECL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature); + /** SubjectConfirmationType local name */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,Subject,xmltooling::XMLObject,SAML 1.x Subject element); + DECL_TYPED_CHILD(NameIdentifier); + DECL_TYPED_CHILD(SubjectConfirmation); + /** SubjectType local name */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,Statement,xmltooling::XMLObject,SAML 1.x Statement element); + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,SubjectStatement,Statement,SAML 1.x SubjectStatement element); + DECL_TYPED_CHILD(Subject); + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,SubjectLocality,xmltooling::XMLObject,SAML 1.x SubjectLocality element); + DECL_STRING_ATTRIB(IPAddress,IPADDRESS); + DECL_STRING_ATTRIB(DNSAddress,DNSADDRESS); + /** SubjectLocality local name */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,AuthorityBinding,xmltooling::XMLObject,SAML 1.x AuthorityBinding element); + DECL_XMLOBJECT_ATTRIB(AuthorityKind,AUTHORITYKIND,xmltooling::QName); + DECL_STRING_ATTRIB(Location,LOCATION); + DECL_STRING_ATTRIB(Binding,BINDING); + /** AuthorityBinding local name */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,AuthenticationStatement,SubjectStatement,SAML 1.x AuthenticationStatement element); + DECL_STRING_ATTRIB(AuthenticationMethod,AUTHENTICATIONMETHOD); + DECL_DATETIME_ATTRIB(AuthenticationInstant,AUTHENTICATIONINSTANT); + DECL_TYPED_CHILD(SubjectLocality); + DECL_TYPED_CHILDREN(AuthorityBinding); + /** AuthenticationStatement local name */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,Advice,xmltooling::XMLObject,SAML 1.x Advice element); + DECL_TYPED_CHILDREN(AssertionIDReference); + DECL_TYPED_CHILDREN(Assertion); + DECL_XMLOBJECT_CHILDREN(Other); + /** AdviceType local name */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,Assertion,xmltooling::XMLObject,SAML 1.x Assertion element); + DECL_INTEGER_ATTRIB(MinorVersion,MINORVERSION); + DECL_STRING_ATTRIB(AssertionID,ASSERTIONID); + DECL_STRING_ATTRIB(Issuer,ISSUER); + DECL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT); + DECL_TYPED_CHILD(Conditions); + DECL_TYPED_CHILD(Advice); + DECL_TYPED_CHILDREN(Statement); + DECL_TYPED_CHILDREN(SubjectStatement); + DECL_TYPED_CHILDREN(AuthenticationStatement); + DECL_TYPED_FOREIGN_CHILD(Signature,xmlsignature); + /** AssertionType local name */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + DECL_SAML1OBJECTBUILDER(Advice); + DECL_SAML1OBJECTBUILDER(Assertion); DECL_SAML1OBJECTBUILDER(AssertionIDReference); DECL_SAML1OBJECTBUILDER(Audience); + DECL_SAML1OBJECTBUILDER(AudienceRestrictionCondition); + DECL_SAML1OBJECTBUILDER(AuthenticationStatement); + DECL_SAML1OBJECTBUILDER(AuthorityBinding); + DECL_SAML1OBJECTBUILDER(DoNotCacheCondition); + DECL_SAML1OBJECTBUILDER(Conditions); DECL_SAML1OBJECTBUILDER(ConfirmationMethod); + DECL_SAML1OBJECTBUILDER(NameIdentifier); + DECL_SAML1OBJECTBUILDER(Subject); + DECL_SAML1OBJECTBUILDER(SubjectConfirmation); + DECL_SAML1OBJECTBUILDER(SubjectConfirmationData); + DECL_SAML1OBJECTBUILDER(SubjectLocality); -#ifdef SAML_DECLARE_VALIDATORS - XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,AssertionIDReference); - XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,Audience); - XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,ConfirmationMethod); -#endif + /** + * Registers builders and validators for Assertion classes into the runtime. + */ + void SAML_API registerAssertionClasses(); }; }; diff --git a/saml/saml1/core/impl/AssertionsImpl.cpp b/saml/saml1/core/impl/AssertionsImpl.cpp index 63e1b7d..0ec6f0d 100644 --- a/saml/saml1/core/impl/AssertionsImpl.cpp +++ b/saml/saml1/core/impl/AssertionsImpl.cpp @@ -1,7 +1,7 @@ /* -* Copyright 2001-2006 Internet2 + * Copyright 2001-2006 Internet2 * -* Licensed under the Apache License, Version 2.0 (the "License"); + * 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 * @@ -33,10 +33,12 @@ #include #include +#include #include using namespace opensaml::saml1; using namespace opensaml; +using namespace xmlsignature; using namespace xmltooling; using namespace std; @@ -48,9 +50,713 @@ using namespace std; namespace opensaml { namespace saml1 { - DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AssertionIDReference); - DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,Audience); - DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,ConfirmationMethod); + DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AssertionIDReference); + DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,Audience); + DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,ConfirmationMethod); + + class XMLTOOL_DLLLOCAL AudienceRestrictionConditionImpl : public virtual AudienceRestrictionCondition, + public AbstractComplexElement, + public AbstractDOMCachingXMLObject, + public AbstractValidatingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + public: + virtual ~AudienceRestrictionConditionImpl() {} + + AudienceRestrictionConditionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + } + + AudienceRestrictionConditionImpl(const AudienceRestrictionConditionImpl& src) + : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) { + VectorOf(Audience) v=getAudiences(); + for (vector::const_iterator i=src.m_Audiences.begin(); i!=src.m_Audiences.end(); i++) { + if (*i) { + v.push_back((*i)->cloneAudience()); + } + } + } + + IMPL_XMLOBJECT_CLONE(AudienceRestrictionCondition); + Condition* cloneCondition() const { + return cloneAudienceRestrictionCondition(); + } + IMPL_TYPED_CHILDREN(Audience,m_children.end()); + + protected: + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { + PROC_TYPED_CHILDREN(Audience,SAMLConstants::SAML1_NS,false); + AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); + } + }; + + class XMLTOOL_DLLLOCAL DoNotCacheConditionImpl : public virtual DoNotCacheCondition, + public AbstractChildlessElement, + public AbstractDOMCachingXMLObject, + public AbstractValidatingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + public: + virtual ~DoNotCacheConditionImpl() {} + + DoNotCacheConditionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + } + + DoNotCacheConditionImpl(const DoNotCacheConditionImpl& src) + : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) { + } + + IMPL_XMLOBJECT_CLONE(DoNotCacheCondition); + Condition* cloneCondition() const { + return cloneDoNotCacheCondition(); + } + }; + + class SAML_DLLLOCAL ConditionsImpl : public virtual Conditions, + public AbstractComplexElement, + public AbstractDOMCachingXMLObject, + public AbstractValidatingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + public: + virtual ~ConditionsImpl() { + delete m_NotBefore; + delete m_NotOnOrAfter; + } + + ConditionsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); + } + + ConditionsImpl(const ConditionsImpl& src) + : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) { + init(); + setNotBefore(src.getNotBefore()); + setNotOnOrAfter(src.getNotOnOrAfter()); + + for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { + if (*i) { + AudienceRestrictionCondition* arc=dynamic_cast(*i); + if (arc) { + getAudienceRestrictionConditions().push_back(arc->cloneAudienceRestrictionCondition()); + continue; + } + + DoNotCacheCondition* dncc=dynamic_cast(*i); + if (dncc) { + getDoNotCacheConditions().push_back(dncc->cloneDoNotCacheCondition()); + continue; + } + + Condition* c=dynamic_cast(*i); + if (c) { + getConditions().push_back(c->cloneCondition()); + continue; + } + } + } + } + + void init() { + m_NotBefore=m_NotOnOrAfter=NULL; + } + + IMPL_XMLOBJECT_CLONE(Conditions); + IMPL_DATETIME_ATTRIB(NotBefore); + IMPL_DATETIME_ATTRIB(NotOnOrAfter); + IMPL_TYPED_CHILDREN(AudienceRestrictionCondition, m_children.end()); + IMPL_TYPED_CHILDREN(DoNotCacheCondition,m_children.end()); + IMPL_TYPED_CHILDREN(Condition,m_children.end()); + + protected: + void marshallAttributes(DOMElement* domElement) const { + MARSHALL_DATETIME_ATTRIB(NotBefore,NOTBEFORE,NULL); + MARSHALL_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,NULL); + } + + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { + PROC_TYPED_CHILDREN(AudienceRestrictionCondition,SAMLConstants::SAML1_NS,true); + PROC_TYPED_CHILDREN(DoNotCacheCondition,SAMLConstants::SAML1_NS,true); + PROC_TYPED_CHILDREN(Condition,SAMLConstants::SAML1_NS,true); + AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); + } + + void processAttribute(const DOMAttr* attribute) { + PROC_DATETIME_ATTRIB(NotBefore,NOTBEFORE,NULL); + PROC_DATETIME_ATTRIB(NotOnOrAfter,NOTONORAFTER,NULL); + } + }; + + class SAML_DLLLOCAL NameIdentifierImpl : public virtual NameIdentifier, + public AbstractSimpleElement, + public AbstractChildlessElement, + public AbstractDOMCachingXMLObject, + public AbstractValidatingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + public: + virtual ~NameIdentifierImpl() {} + + NameIdentifierImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); + } + + NameIdentifierImpl(const NameIdentifierImpl& src) + : AbstractXMLObject(src), AbstractSimpleElement(src), + AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) { + init(); + setFormat(src.getFormat()); + setNameQualifier(src.getNameQualifier()); + } + + void init() { + m_Format=m_NameQualifier=NULL; + } + + IMPL_XMLOBJECT_CLONE(NameIdentifier); + IMPL_STRING_ATTRIB(Format); + IMPL_STRING_ATTRIB(NameQualifier); + IMPL_XMLOBJECT_CONTENT; + + protected: + void processAttribute(const DOMAttr* attribute) { + PROC_STRING_ATTRIB(Format,FORMAT,NULL); + PROC_STRING_ATTRIB(NameQualifier,NAMEQUALIFIER,NULL); + } + }; + + class SAML_DLLLOCAL SubjectConfirmationDataImpl : public virtual SubjectConfirmationData, + public AbstractDOMCachingXMLObject, + public AbstractElementProxy, + public AbstractValidatingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + public: + virtual ~SubjectConfirmationDataImpl() {} + + SubjectConfirmationDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + } + + SubjectConfirmationDataImpl(const SubjectConfirmationDataImpl& src) + : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractElementProxy(src), + AbstractValidatingXMLObject(src) { + for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { + if (*i) { + getXMLObjects().push_back((*i)->clone()); + } + } + } + + IMPL_XMLOBJECT_CLONE(SubjectConfirmationData); + IMPL_XMLOBJECT_CONTENT; + + protected: + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { + getXMLObjects().push_back(childXMLObject); + } + }; + + class SAML_DLLLOCAL SubjectConfirmationImpl : public virtual SubjectConfirmation, + public AbstractComplexElement, + public AbstractDOMCachingXMLObject, + public AbstractValidatingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + public: + virtual ~SubjectConfirmationImpl() {} + + SubjectConfirmationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); + } + + SubjectConfirmationImpl(const SubjectConfirmationImpl& src) + : AbstractXMLObject(src), + AbstractDOMCachingXMLObject(src), + AbstractValidatingXMLObject(src) { + init(); + if (src.getSubjectConfirmationData()) + setSubjectConfirmationData(src.getSubjectConfirmationData()->clone()); + if (src.getKeyInfo()) + setKeyInfo(src.getKeyInfo()->cloneKeyInfo()); + VectorOf(ConfirmationMethod) v=getConfirmationMethods(); + for (vector::const_iterator i=src.m_ConfirmationMethods.begin(); i!=src.m_ConfirmationMethods.end(); i++) { + if (*i) { + v.push_back((*i)->cloneConfirmationMethod()); + } + } + } + + void init() { + m_SubjectConfirmationData=NULL; + m_KeyInfo=NULL; + m_children.push_back(NULL); + m_children.push_back(NULL); + m_pos_SubjectConfirmationData=m_children.begin(); + m_pos_KeyInfo=m_pos_SubjectConfirmationData; + ++m_pos_KeyInfo; + } + + IMPL_XMLOBJECT_CLONE(SubjectConfirmation); + IMPL_TYPED_CHILDREN(ConfirmationMethod,m_pos_SubjectConfirmationData); + IMPL_XMLOBJECT_CHILD(SubjectConfirmationData); + IMPL_TYPED_CHILD(KeyInfo); + + protected: + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { + PROC_TYPED_CHILDREN(ConfirmationMethod,SAMLConstants::SAML1_NS,false); + PROC_TYPED_CHILD(KeyInfo,XMLConstants::XMLSIG_NS,false); + + // Anything else we'll assume is the data. + if (getSubjectConfirmationData()) + throw UnmarshallingException("Invalid child element: $1",params(1,childXMLObject->getElementQName().toString().c_str())); + setSubjectConfirmationData(childXMLObject); + } + }; + + class SAML_DLLLOCAL SubjectImpl : public virtual Subject, + public AbstractComplexElement, + public AbstractDOMCachingXMLObject, + public AbstractValidatingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + public: + virtual ~SubjectImpl() {} + + SubjectImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); + } + + SubjectImpl(const SubjectImpl& src) + : AbstractXMLObject(src), + AbstractDOMCachingXMLObject(src), + AbstractValidatingXMLObject(src) { + init(); + if (src.getNameIdentifier()) + setNameIdentifier(src.getNameIdentifier()->cloneNameIdentifier()); + if (src.getSubjectConfirmation()) + setSubjectConfirmation(src.getSubjectConfirmation()->cloneSubjectConfirmation()); + } + + void init() { + m_NameIdentifier=NULL; + m_SubjectConfirmation=NULL; + m_children.push_back(NULL); + m_children.push_back(NULL); + m_pos_NameIdentifier=m_children.begin(); + m_pos_SubjectConfirmation=m_pos_NameIdentifier; + ++m_pos_SubjectConfirmation; + } + + IMPL_XMLOBJECT_CLONE(Subject); + IMPL_TYPED_CHILD(NameIdentifier); + IMPL_TYPED_CHILD(SubjectConfirmation); + + protected: + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { + PROC_TYPED_CHILD(NameIdentifier,SAMLConstants::SAML1_NS,true); + PROC_TYPED_CHILD(SubjectConfirmation,SAMLConstants::SAML1_NS,true); + AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); + } + }; + + class SAML_DLLLOCAL SubjectStatementImpl : public virtual SubjectStatement, + public AbstractComplexElement, + public AbstractDOMCachingXMLObject, + public AbstractValidatingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + public: + virtual ~SubjectStatementImpl() {} + + SubjectStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); + } + + SubjectStatementImpl(const SubjectStatementImpl& src) + : AbstractXMLObject(src), + AbstractDOMCachingXMLObject(src), + AbstractValidatingXMLObject(src) { + init(); + if (src.getSubject()) + setSubject(src.getSubject()->cloneSubject()); + } + + void init() { + m_Subject=NULL; + m_children.push_back(NULL); + m_pos_Subject=m_children.begin(); + } + + IMPL_TYPED_CHILD(Subject); + + protected: + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { + PROC_TYPED_CHILD(Subject,SAMLConstants::SAML1_NS,true); + AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); + } + }; + + class SAML_DLLLOCAL AuthenticationStatementImpl : public virtual AuthenticationStatement, public SubjectStatementImpl + { + public: + virtual ~AuthenticationStatementImpl() { + XMLString::release(&m_AuthenticationMethod); + delete m_AuthenticationInstant; + } + + AuthenticationStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : SubjectStatementImpl(nsURI, localName, prefix, schemaType) { + init(); + } + + AuthenticationStatementImpl(const AuthenticationStatementImpl& src) : SubjectStatementImpl(src) { + init(); + setAuthenticationMethod(src.getAuthenticationMethod()); + setAuthenticationInstant(src.getAuthenticationInstant()); + if (src.getSubjectLocality()) + setSubjectLocality(src.getSubjectLocality()->cloneSubjectLocality()); + VectorOf(AuthorityBinding) v=getAuthorityBindings(); + for (vector::const_iterator i=src.m_AuthorityBindings.begin(); i!=src.m_AuthorityBindings.end(); i++) { + if (*i) { + v.push_back((*i)->cloneAuthorityBinding()); + } + } + } + + void init() { + SubjectStatementImpl::init(); + m_AuthenticationMethod=NULL; + m_AuthenticationInstant=NULL; + m_SubjectLocality=NULL; + m_children.push_back(NULL); + m_pos_SubjectLocality=m_pos_Subject; + m_pos_SubjectLocality++; + } + + IMPL_XMLOBJECT_CLONE(AuthenticationStatement); + SubjectStatement* cloneSubjectStatement() const { + return cloneAuthenticationStatement(); + } + Statement* cloneStatement() const { + return cloneAuthenticationStatement(); + } + IMPL_STRING_ATTRIB(AuthenticationMethod); + IMPL_DATETIME_ATTRIB(AuthenticationInstant); + IMPL_TYPED_CHILD(SubjectLocality); + IMPL_TYPED_CHILDREN(AuthorityBinding, m_children.end()); + + protected: + void marshallAttributes(DOMElement* domElement) const { + MARSHALL_STRING_ATTRIB(AuthenticationMethod,AUTHENTICATIONMETHOD,NULL); + MARSHALL_DATETIME_ATTRIB(AuthenticationInstant,AUTHENTICATIONINSTANT,NULL); + SubjectStatementImpl::marshallAttributes(domElement); + } + + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { + PROC_TYPED_CHILD(SubjectLocality,SAMLConstants::SAML1_NS,false); + PROC_TYPED_CHILDREN(AuthorityBinding,SAMLConstants::SAML1_NS,false); + SubjectStatementImpl::processChildElement(childXMLObject,root); + } + + void processAttribute(const DOMAttr* attribute) { + PROC_STRING_ATTRIB(AuthenticationMethod,AUTHENTICATIONMETHOD,NULL); + PROC_DATETIME_ATTRIB(AuthenticationInstant,AUTHENTICATIONINSTANT,NULL); + SubjectStatementImpl::processAttribute(attribute); + } + }; + + class SAML_DLLLOCAL SubjectLocalityImpl : public virtual SubjectLocality, + public AbstractChildlessElement, + public AbstractDOMCachingXMLObject, + public AbstractValidatingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + public: + virtual ~SubjectLocalityImpl() { + XMLString::release(&m_IPAddress); + XMLString::release(&m_DNSAddress); + } + + SubjectLocalityImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); + } + + SubjectLocalityImpl(const SubjectLocalityImpl& src) + : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) { + init(); + setIPAddress(src.getIPAddress()); + setDNSAddress(src.getDNSAddress()); + } + + void init() { + m_IPAddress=m_DNSAddress=NULL; + } + + IMPL_XMLOBJECT_CLONE(SubjectLocality); + IMPL_STRING_ATTRIB(IPAddress); + IMPL_STRING_ATTRIB(DNSAddress); + + protected: + void marshallAttributes(DOMElement* domElement) const { + MARSHALL_STRING_ATTRIB(IPAddress,IPADDRESS,NULL); + MARSHALL_STRING_ATTRIB(DNSAddress,DNSADDRESS,NULL); + } + + void processAttribute(const DOMAttr* attribute) { + PROC_STRING_ATTRIB(IPAddress,IPADDRESS,NULL); + PROC_STRING_ATTRIB(DNSAddress,DNSADDRESS,NULL); + } + }; + + class SAML_DLLLOCAL AuthorityBindingImpl : public virtual AuthorityBinding, + public AbstractChildlessElement, + public AbstractDOMCachingXMLObject, + public AbstractValidatingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + public: + virtual ~AuthorityBindingImpl() { + delete m_AuthorityKind; + XMLString::release(&m_Location); + XMLString::release(&m_Binding); + } + + AuthorityBindingImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); + } + + AuthorityBindingImpl(const AuthorityBindingImpl& src) + : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) { + init(); + setAuthorityKind(src.getAuthorityKind()); + setLocation(src.getLocation()); + setBinding(src.getBinding()); + } + + void init() { + m_AuthorityKind=NULL; + m_Location=m_Binding=NULL; + } + + IMPL_XMLOBJECT_CLONE(AuthorityBinding); + IMPL_XMLOBJECT_ATTRIB(AuthorityKind,QName); + IMPL_STRING_ATTRIB(Location); + IMPL_STRING_ATTRIB(Binding); + + protected: + void marshallAttributes(DOMElement* domElement) const { + MARSHALL_QNAME_ATTRIB(AuthorityKind,AUTHORITYKIND,NULL); + MARSHALL_STRING_ATTRIB(Location,LOCATION,NULL); + MARSHALL_STRING_ATTRIB(Binding,BINDING,NULL); + } + + void processAttribute(const DOMAttr* attribute) { + PROC_QNAME_ATTRIB(AuthorityKind,AUTHORITYKIND,NULL); + PROC_STRING_ATTRIB(Location,LOCATION,NULL); + PROC_STRING_ATTRIB(Binding,BINDING,NULL); + } + }; + + class SAML_DLLLOCAL AdviceImpl : public virtual Advice, + public AbstractComplexElement, + public AbstractDOMCachingXMLObject, + public AbstractValidatingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + public: + virtual ~AdviceImpl() {} + + AdviceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + } + + AdviceImpl(const AdviceImpl& src) + : AbstractXMLObject(src), + AbstractDOMCachingXMLObject(src), + AbstractValidatingXMLObject(src) { + + for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { + if (*i) { + AssertionIDReference* ref=dynamic_cast(*i); + if (ref) { + getAssertionIDReferences().push_back(ref->cloneAssertionIDReference()); + continue; + } + + Assertion* assertion=dynamic_cast(*i); + if (assertion) { + getAssertions().push_back(assertion->cloneAssertion()); + continue; + } + + getOthers().push_back((*i)->clone()); + } + } + } + + IMPL_XMLOBJECT_CLONE(Advice); + IMPL_TYPED_CHILDREN(AssertionIDReference,m_children.end()); + IMPL_TYPED_CHILDREN(Assertion,m_children.end()); + IMPL_XMLOBJECT_CHILDREN(Other,m_children.end()); + + protected: + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { + PROC_TYPED_CHILDREN(AssertionIDReference,SAMLConstants::SAML1_NS,false); + PROC_TYPED_CHILDREN(Assertion,SAMLConstants::SAML1_NS,true); + + // Unknown child. + const XMLCh* nsURI=root->getNamespaceURI(); + if (!XMLString::equals(nsURI,SAMLConstants::SAML1_NS) && nsURI && *nsURI) + getOthers().push_back(childXMLObject); + + AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); + } + }; + + class SAML_DLLLOCAL AssertionImpl : public virtual Assertion, + public AbstractComplexElement, + public AbstractDOMCachingXMLObject, + public AbstractValidatingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + public: + virtual ~AssertionImpl() { + XMLString::release(&m_AssertionID); + XMLString::release(&m_Issuer); + delete m_IssueInstant; + } + + AssertionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); + } + + AssertionImpl(const AssertionImpl& src) + : AbstractXMLObject(src), + AbstractDOMCachingXMLObject(src), + AbstractValidatingXMLObject(src) { + init(); + setMinorVersion(src.getMinorVersion()); + setAssertionID(src.getAssertionID()); + setIssuer(src.getIssuer()); + setIssueInstant(src.getIssueInstant()); + if (src.getConditions()) + setConditions(src.getConditions()->cloneConditions()); + if (src.getAdvice()) + setAdvice(src.getAdvice()->cloneAdvice()); + if (src.getSignature()) + setSignature(src.getSignature()->cloneSignature()); + for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { + if (*i) { + AuthenticationStatement* authst=dynamic_cast(*i); + if (authst) { + getAuthenticationStatements().push_back(authst->cloneAuthenticationStatement()); + continue; + } + + SubjectStatement* subst=dynamic_cast(*i); + if (subst) { + getSubjectStatements().push_back(subst->cloneSubjectStatement()); + continue; + } + + Statement* st=dynamic_cast(*i); + if (st) { + getStatements().push_back(st->cloneStatement()); + continue; + } + } + } + } + + void init() { + m_MinorVersion=1; + m_AssertionID=NULL; + m_Issuer=NULL; + m_IssueInstant=NULL; + m_children.push_back(NULL); + m_children.push_back(NULL); + m_children.push_back(NULL); + m_Conditions=NULL; + m_Advice=NULL; + m_Signature=NULL; + m_pos_Conditions=m_children.begin(); + m_pos_Advice=m_pos_Conditions; + m_pos_Advice++; + m_pos_Signature=m_pos_Advice; + m_pos_Signature++; + } + + IMPL_XMLOBJECT_CLONE(Assertion); + IMPL_INTEGER_ATTRIB(MinorVersion); + IMPL_STRING_ATTRIB(AssertionID); + IMPL_STRING_ATTRIB(Issuer); + IMPL_DATETIME_ATTRIB(IssueInstant); + IMPL_TYPED_CHILD(Conditions); + IMPL_TYPED_CHILD(Advice); + IMPL_TYPED_CHILD(Signature); + IMPL_TYPED_CHILDREN(Statement, m_pos_Signature); + IMPL_TYPED_CHILDREN(SubjectStatement, m_pos_Signature); + IMPL_TYPED_CHILDREN(AuthenticationStatement, m_pos_Signature); + + protected: + void marshallAttributes(DOMElement* domElement) const { + static const XMLCh MAJORVERSION[] = UNICODE_LITERAL_12(M,a,j,o,r,V,e,r,s,i,o,n); + static const XMLCh ONE[] = { chDigit_1, chNull }; + domElement->setAttributeNS(NULL,MAJORVERSION,ONE); + MARSHALL_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL); + if (!m_AssertionID) + const_cast(this)->m_AssertionID=SAMLConfig::getConfig().generateIdentifier(); + MARSHALL_ID_ATTRIB(AssertionID,ASSERTIONID,NULL); + MARSHALL_STRING_ATTRIB(Issuer,ISSUER,NULL); + if (!m_IssueInstant) + const_cast(this)->m_IssueInstant=new DateTime(time(NULL)); + MARSHALL_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL); + } + + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { + PROC_TYPED_CHILD(Conditions,SAMLConstants::SAML1_NS,false); + PROC_TYPED_CHILD(Advice,SAMLConstants::SAML1_NS,false); + PROC_TYPED_CHILD(Signature,XMLConstants::XMLSIG_NS,false); + PROC_TYPED_CHILDREN(AuthenticationStatement,SAMLConstants::SAML1_NS,false); + PROC_TYPED_CHILDREN(SubjectStatement,SAMLConstants::SAML1_NS,true); + PROC_TYPED_CHILDREN(Statement,SAMLConstants::SAML1_NS,true); + AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); + } + + void processAttribute(const DOMAttr* attribute) { + static const XMLCh MAJORVERSION[] = UNICODE_LITERAL_12(M,a,j,o,r,V,e,r,s,i,o,n); + if (XMLHelper::isNodeNamed(attribute,NULL,MAJORVERSION)) { + if (XMLString::parseInt(attribute->getValue()) != 1) + throw UnmarshallingException("Assertion has invalid major version."); + } + PROC_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL); + PROC_ID_ATTRIB(AssertionID,ASSERTIONID,NULL); + PROC_STRING_ATTRIB(Issuer,ISSUER,NULL); + PROC_DATETIME_ATTRIB(IssueInstant,ISSUEINSTANT,NULL); + } + }; }; }; @@ -61,14 +767,66 @@ namespace opensaml { // Builder Implementations +IMPL_XMLOBJECTBUILDER(Advice); +IMPL_XMLOBJECTBUILDER(Assertion); IMPL_XMLOBJECTBUILDER(AssertionIDReference); IMPL_XMLOBJECTBUILDER(Audience); +IMPL_XMLOBJECTBUILDER(AudienceRestrictionCondition); +IMPL_XMLOBJECTBUILDER(AuthenticationStatement); +IMPL_XMLOBJECTBUILDER(AuthorityBinding); +IMPL_XMLOBJECTBUILDER(Conditions); IMPL_XMLOBJECTBUILDER(ConfirmationMethod); +IMPL_XMLOBJECTBUILDER(DoNotCacheCondition); +IMPL_XMLOBJECTBUILDER(NameIdentifier); +IMPL_XMLOBJECTBUILDER(Subject); +IMPL_XMLOBJECTBUILDER(SubjectConfirmation); +IMPL_XMLOBJECTBUILDER(SubjectConfirmationData); +IMPL_XMLOBJECTBUILDER(SubjectLocality); // Unicode literals +const XMLCh Advice::LOCAL_NAME[] = UNICODE_LITERAL_6(A,d,v,i,c,e); +const XMLCh Advice::TYPE_NAME[] = UNICODE_LITERAL_10(A,d,v,i,c,e,T,y,p,e); +const XMLCh Assertion::LOCAL_NAME[] = UNICODE_LITERAL_9(A,s,s,e,r,t,i,o,n); +const XMLCh Assertion::TYPE_NAME[] = UNICODE_LITERAL_13(A,s,s,e,r,t,i,o,n,T,y,p,e); +const XMLCh Assertion::MINORVERSION_ATTRIB_NAME[] = UNICODE_LITERAL_12(M,i,n,o,r,V,e,r,s,i,o,n); +const XMLCh Assertion::ASSERTIONID_ATTRIB_NAME[] = UNICODE_LITERAL_11(A,s,s,e,r,t,i,o,n,I,D); +const XMLCh Assertion::ISSUER_ATTRIB_NAME[] = UNICODE_LITERAL_6(I,s,s,u,e,r); +const XMLCh Assertion::ISSUEINSTANT_ATTRIB_NAME[] = UNICODE_LITERAL_12(I,s,s,u,e,I,n,s,t,a,n,t); const XMLCh AssertionIDReference::LOCAL_NAME[] = UNICODE_LITERAL_20(A,s,s,e,r,t,i,o,n,I,D,R,e,f,e,r,e,n,c,e); const XMLCh Audience::LOCAL_NAME[] = UNICODE_LITERAL_8(A,u,d,i,e,n,c,e); +const XMLCh AudienceRestrictionCondition::LOCAL_NAME[] = UNICODE_LITERAL_28(A,u,d,i,e,n,c,e,R,e,s,t,r,i,c,t,i,o,n,C,o,n,d,i,t,i,o,n); +const XMLCh AudienceRestrictionCondition::TYPE_NAME[] = UNICODE_LITERAL_32(A,u,d,i,e,n,c,e,R,e,s,t,r,i,c,t,i,o,n,C,o,n,d,i,t,i,o,n,T,y,p,e); +const XMLCh AuthenticationStatement::LOCAL_NAME[] = UNICODE_LITERAL_23(A,u,t,h,e,n,t,i,c,a,t,i,o,n,S,t,a,t,e,m,e,n,t); +const XMLCh AuthenticationStatement::TYPE_NAME[] = UNICODE_LITERAL_27(A,u,t,h,e,n,t,i,c,a,t,i,o,n,S,t,a,t,e,m,e,n,t,T,y,p,e); +const XMLCh AuthenticationStatement::AUTHENTICATIONMETHOD_ATTRIB_NAME[] = UNICODE_LITERAL_20(A,u,t,h,e,n,t,i,c,a,t,i,o,n,M,e,t,h,o,d); +const XMLCh AuthenticationStatement::AUTHENTICATIONINSTANT_ATTRIB_NAME[] = UNICODE_LITERAL_21(A,u,t,h,e,n,t,i,c,a,t,i,o,n,I,n,s,t,a,n,t); +const XMLCh AuthorityBinding::LOCAL_NAME[] = UNICODE_LITERAL_16(A,u,t,h,o,r,i,t,y,B,i,n,d,i,n,g); +const XMLCh AuthorityBinding::TYPE_NAME[] = UNICODE_LITERAL_20(A,u,t,h,o,r,i,t,y,B,i,n,d,i,n,g,T,y,p,e); +const XMLCh AuthorityBinding::AUTHORITYKIND_ATTRIB_NAME[] = UNICODE_LITERAL_13(A,u,t,h,o,r,i,t,y,K,i,n,d); +const XMLCh AuthorityBinding::LOCATION_ATTRIB_NAME[] = UNICODE_LITERAL_8(L,o,c,a,t,i,o,n); +const XMLCh AuthorityBinding::BINDING_ATTRIB_NAME[] = UNICODE_LITERAL_7(B,i,n,d,i,n,g); +const XMLCh Condition::LOCAL_NAME[] = UNICODE_LITERAL_9(C,o,n,d,i,t,i,o,n); +const XMLCh Conditions::LOCAL_NAME[] = UNICODE_LITERAL_10(C,o,n,d,i,t,i,o,n,s); +const XMLCh Conditions::TYPE_NAME[] = UNICODE_LITERAL_14(C,o,n,d,i,t,i,o,n,s,T,y,p,e); +const XMLCh Conditions::NOTBEFORE_ATTRIB_NAME[] = UNICODE_LITERAL_9(N,o,t,B,e,f,o,r,e); +const XMLCh Conditions::NOTONORAFTER_ATTRIB_NAME[] =UNICODE_LITERAL_12(N,o,t,O,n,O,r,A,f,t,e,r); const XMLCh ConfirmationMethod::LOCAL_NAME[] = UNICODE_LITERAL_18(C,o,n,f,i,r,m,a,t,i,o,n,M,e,t,h,o,d); +const XMLCh DoNotCacheCondition::LOCAL_NAME[] = UNICODE_LITERAL_19(D,o,N,o,t,C,a,c,h,e,C,o,n,d,i,t,i,o,n); +const XMLCh DoNotCacheCondition::TYPE_NAME[] = UNICODE_LITERAL_23(D,o,N,o,t,C,a,c,h,e,C,o,n,d,i,t,i,o,n,T,y,p,e); +const XMLCh NameIdentifier::LOCAL_NAME[] = UNICODE_LITERAL_14(N,a,m,e,I,d,e,n,t,i,f,i,e,r); +const XMLCh NameIdentifier::TYPE_NAME[] = UNICODE_LITERAL_18(N,a,m,e,I,d,e,n,t,i,f,i,e,r,T,y,p,e); +const XMLCh NameIdentifier::NAMEQUALIFIER_ATTRIB_NAME[] = UNICODE_LITERAL_13(N,a,m,e,Q,u,a,l,i,f,i,e,r); +const XMLCh NameIdentifier::FORMAT_ATTRIB_NAME[] = UNICODE_LITERAL_6(F,o,r,m,a,t); +const XMLCh Statement::LOCAL_NAME[] = UNICODE_LITERAL_9(S,t,a,t,e,m,e,n,t); +const XMLCh Subject::LOCAL_NAME[] = UNICODE_LITERAL_7(S,u,b,j,e,c,t); +const XMLCh Subject::TYPE_NAME[] = UNICODE_LITERAL_11(S,u,b,j,e,c,t,T,y,p,e); +const XMLCh SubjectConfirmation::LOCAL_NAME[] = UNICODE_LITERAL_19(S,u,b,j,e,c,t,C,o,n,f,i,r,m,a,t,i,o,n); +const XMLCh SubjectConfirmation::TYPE_NAME[] = UNICODE_LITERAL_23(S,u,b,j,e,c,t,C,o,n,f,i,r,m,a,t,i,o,n,T,y,p,e); +const XMLCh SubjectConfirmationData::LOCAL_NAME[] = UNICODE_LITERAL_23(S,u,b,j,e,c,t,C,o,n,f,i,r,m,a,t,i,o,n,D,a,t,a); +const XMLCh SubjectLocality::LOCAL_NAME[] = UNICODE_LITERAL_15(S,u,b,j,e,c,t,L,o,c,a,l,i,t,y); +const XMLCh SubjectLocality::TYPE_NAME[] = UNICODE_LITERAL_19(S,u,b,j,e,c,t,L,o,c,a,l,i,t,y,T,y,p,e); +const XMLCh SubjectLocality::IPADDRESS_ATTRIB_NAME[] = UNICODE_LITERAL_9(I,P,A,d,d,r,e,s,s); +const XMLCh SubjectLocality::DNSADDRESS_ATTRIB_NAME[] = UNICODE_LITERAL_10(D,N,S,A,d,d,r,e,s,s); #define XCH(ch) chLatin_##ch #define XNUM(d) chDigit_##d diff --git a/saml/saml1/core/impl/AssertionsSchemaValidators.cpp b/saml/saml1/core/impl/AssertionsSchemaValidators.cpp new file mode 100644 index 0000000..7aed851 --- /dev/null +++ b/saml/saml1/core/impl/AssertionsSchemaValidators.cpp @@ -0,0 +1,146 @@ +/* +* 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 + * + * 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. + */ + +/** + * AssertionsSchemaValidators.cpp + * + * Schema-based validators for SAML 1.x Assertions classes + */ + +#include "internal.h" +#include "exceptions.h" +#include "saml1/core/Assertions.h" + +using namespace opensaml::saml1; +using namespace opensaml; +using namespace xmltooling; +using namespace std; + +namespace opensaml { + namespace saml1 { + + XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,AssertionIDReference); + XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,Audience); + XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,ConfirmationMethod); + + BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,AudienceRestrictionCondition); + XMLOBJECTVALIDATOR_NONEMPTY(AudienceRestrictionCondition,Audience); + END_XMLOBJECTVALIDATOR; + + BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Conditions); + if (!ptr->hasChildren()) { + XMLOBJECTVALIDATOR_ONEOF(Conditions,NotBefore,NotOnOrAfter); + } + END_XMLOBJECTVALIDATOR; + + BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,SubjectConfirmation); + XMLOBJECTVALIDATOR_NONEMPTY(SubjectConfirmation,ConfirmationMethod); + END_XMLOBJECTVALIDATOR; + + BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Subject); + XMLOBJECTVALIDATOR_ONEOF(Subject,NameIdentifier,SubjectConfirmation); + END_XMLOBJECTVALIDATOR; + + BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,SubjectLocality); + XMLOBJECTVALIDATOR_ONEOF(SubjectLocality,IPAddress,DNSAddress); + END_XMLOBJECTVALIDATOR; + + BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,AuthorityBinding); + XMLOBJECTVALIDATOR_REQUIRE(AuthorityBinding,AuthorityKind); + XMLOBJECTVALIDATOR_REQUIRE(AuthorityBinding,Location); + XMLOBJECTVALIDATOR_REQUIRE(AuthorityBinding,Binding); + END_XMLOBJECTVALIDATOR; + + BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,AuthenticationStatement); + XMLOBJECTVALIDATOR_REQUIRE(AuthenticationStatement,AuthenticationMethod); + XMLOBJECTVALIDATOR_REQUIRE(AuthenticationStatement,AuthenticationInstant); + XMLOBJECTVALIDATOR_REQUIRE(AuthenticationStatement,Subject); + END_XMLOBJECTVALIDATOR; + + BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Assertion); + XMLOBJECTVALIDATOR_REQUIRE(Assertion,AssertionID); + XMLOBJECTVALIDATOR_REQUIRE(Assertion,Issuer); + XMLOBJECTVALIDATOR_REQUIRE(Assertion,IssueInstant); + if (ptr->getAuthenticationStatements().empty() && + ptr->getSubjectStatements().empty() && + ptr->getStatements().empty()) + throw ValidationException("Assertion must have at least one statement."); + END_XMLOBJECTVALIDATOR; + + class SAML_DLLLOCAL checkWildcardNS { + public: + void operator()(const XMLObject* xmlObject) const { + const XMLCh* ns=xmlObject->getElementQName().getNamespaceURI(); + if (XMLString::equals(ns,SAMLConstants::SAML1_NS) || !ns || !*ns) { + throw ValidationException( + "Object contains an illegal extension child element ($1).", + params(1,xmlObject->getElementQName().toString().c_str()) + ); + } + } + }; + + BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Advice); + const vector& anys=ptr->getOthers(); + for_each(anys.begin(),anys.end(),checkWildcardNS()); + END_XMLOBJECTVALIDATOR; + + }; +}; + +#define REGISTER_ELEMENT(cname) \ + q=QName(SAMLConstants::SAML1_NS,cname::LOCAL_NAME); \ + XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \ + Validator::registerValidator(q,new cname##SchemaValidator()) + +#define REGISTER_TYPE(cname) \ + q=QName(SAMLConstants::SAML1_NS,cname::TYPE_NAME); \ + XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \ + Validator::registerValidator(q,new cname##SchemaValidator()) + +#define REGISTER_ELEMENT_NOVAL(cname) \ + q=QName(SAMLConstants::SAML1_NS,cname::LOCAL_NAME); \ + XMLObjectBuilder::registerBuilder(q,new cname##Builder()); + +#define REGISTER_TYPE_NOVAL(cname) \ + q=QName(SAMLConstants::SAML1_NS,cname::TYPE_NAME); \ + XMLObjectBuilder::registerBuilder(q,new cname##Builder()); + +void opensaml::saml1::registerAssertionClasses() { + QName q; + REGISTER_ELEMENT(Advice); + REGISTER_ELEMENT(Assertion); + REGISTER_ELEMENT(AssertionIDReference); + REGISTER_ELEMENT(Audience); + REGISTER_ELEMENT(AudienceRestrictionCondition); + REGISTER_ELEMENT(AuthenticationStatement); + REGISTER_ELEMENT(AuthorityBinding); + REGISTER_ELEMENT(Conditions); + REGISTER_ELEMENT(ConfirmationMethod); + REGISTER_ELEMENT_NOVAL(DoNotCacheCondition); + REGISTER_ELEMENT(SubjectConfirmation); + REGISTER_ELEMENT_NOVAL(SubjectConfirmationData); + REGISTER_ELEMENT(SubjectLocality); + REGISTER_TYPE(Advice); + REGISTER_TYPE(Assertion); + REGISTER_TYPE(AudienceRestrictionCondition); + REGISTER_TYPE(AuthenticationStatement); + REGISTER_TYPE(AuthorityBinding); + REGISTER_TYPE(Conditions); + REGISTER_TYPE_NOVAL(DoNotCacheCondition); + REGISTER_TYPE(SubjectConfirmation); + REGISTER_TYPE(SubjectLocality); +} diff --git a/saml/util/XMLConstants.cpp b/saml/util/SAMLConstants.cpp similarity index 75% rename from saml/util/XMLConstants.cpp rename to saml/util/SAMLConstants.cpp index 5290bed..b0b0d88 100644 --- a/saml/util/XMLConstants.cpp +++ b/saml/util/SAMLConstants.cpp @@ -15,20 +15,20 @@ */ /** - * XMLConstants.cpp + * SAMLConstants.cpp * * SAML XML namespace constants */ #include "internal.h" -#include "util/XMLConstants.h" +#include "util/SAMLConstants.h" #include using namespace xercesc; using namespace opensaml; -const XMLCh XMLConstants::SOAP11ENV_NS[] = // http://schemas.xmlsoap.org/soap/envelope/ +const XMLCh SAMLConstants::SOAP11ENV_NS[] = // http://schemas.xmlsoap.org/soap/envelope/ { chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, chForwardSlash, chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a, chLatin_s, chPeriod, chLatin_x, chLatin_m, chLatin_l, chLatin_s, chLatin_o, chLatin_a, chLatin_p, chPeriod, @@ -37,43 +37,43 @@ const XMLCh XMLConstants::SOAP11ENV_NS[] = // http://schemas.xmlsoap.org/soap/en chLatin_e, chLatin_n, chLatin_v, chLatin_e, chLatin_l, chLatin_o, chLatin_p, chLatin_e, chForwardSlash, chNull }; -const XMLCh XMLConstants::SOAP11ENV_PREFIX[] = UNICODE_LITERAL_1(S); +const XMLCh SAMLConstants::SOAP11ENV_PREFIX[] = UNICODE_LITERAL_1(S); -const XMLCh XMLConstants::PAOS_NS[] = // urn:liberty:paos:2003-08 +const XMLCh SAMLConstants::PAOS_NS[] = // urn:liberty:paos:2003-08 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_l, chLatin_i, chLatin_b, chLatin_e, chLatin_r, chLatin_t, chLatin_y, chColon, chLatin_p, chLatin_a, chLatin_o, chLatin_s, chColon, chDigit_2, chDigit_0, chDigit_0, chDigit_3, chDash, chDigit_0, chDigit_8, chNull }; -const XMLCh XMLConstants::PAOS_PREFIX[] = UNICODE_LITERAL_4(p,a,o,s); +const XMLCh SAMLConstants::PAOS_PREFIX[] = UNICODE_LITERAL_4(p,a,o,s); -const XMLCh XMLConstants::SAML1_NS[] = // urn:oasis:names:tc:SAML:1.0:assertion +const XMLCh SAMLConstants::SAML1_NS[] = // urn:oasis:names:tc:SAML:1.0:assertion { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon, chLatin_a, chLatin_s, chLatin_s, chLatin_e, chLatin_r, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull }; -const XMLCh XMLConstants::SAML1P_NS[] = // urn:oasis:names:tc:SAML:1.0:protocol +const XMLCh SAMLConstants::SAML1P_NS[] = // urn:oasis:names:tc:SAML:1.0:protocol { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_0, chColon, chLatin_p, chLatin_r, chLatin_o, chLatin_t, chLatin_o, chLatin_c, chLatin_o, chLatin_l, chNull }; -const XMLCh XMLConstants::SAML1_PREFIX[] = UNICODE_LITERAL_4(s,a,m,l); +const XMLCh SAMLConstants::SAML1_PREFIX[] = UNICODE_LITERAL_4(s,a,m,l); -const XMLCh XMLConstants::SAML1P_PREFIX[] = UNICODE_LITERAL_5(s,a,m,l,p); +const XMLCh SAMLConstants::SAML1P_PREFIX[] = UNICODE_LITERAL_5(s,a,m,l,p); -const XMLCh XMLConstants::SAML11_PROTOCOL_ENUM[] = // urn:oasis:names:tc:SAML:1.1:protocol +const XMLCh SAMLConstants::SAML11_PROTOCOL_ENUM[] = // urn:oasis:names:tc:SAML:1.1:protocol { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_1, chPeriod, chDigit_1, chColon, chLatin_p, chLatin_r, chLatin_o, chLatin_t, chLatin_o, chLatin_c, chLatin_o, chLatin_l, chNull }; -const XMLCh XMLConstants::SAML1_METADATA_PROFILE[] = // urn:oasis:names:tc:SAML:profiles:v1metadata +const XMLCh SAMLConstants::SAML1_METADATA_PROFILE[] = // urn:oasis:names:tc:SAML:profiles:v1metadata { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, @@ -81,43 +81,43 @@ const XMLCh XMLConstants::SAML1_METADATA_PROFILE[] = // urn:oasis:names:tc:SAML: chLatin_v, chDigit_1, chLatin_m, chLatin_e, chLatin_t, chLatin_a, chLatin_d, chLatin_a, chLatin_t, chLatin_a, chNull }; -const XMLCh XMLConstants::SAML20_NS[] = // urn:oasis:names:tc:SAML:2.0:assertion +const XMLCh SAMLConstants::SAML20_NS[] = // urn:oasis:names:tc:SAML:2.0:assertion { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon, chLatin_a, chLatin_s, chLatin_s, chLatin_e, chLatin_r, chLatin_t, chLatin_i, chLatin_o, chLatin_n, chNull }; -const XMLCh XMLConstants::SAML20P_NS[] = // urn:oasis:names:tc:SAML:2.0:protocol +const XMLCh SAMLConstants::SAML20P_NS[] = // urn:oasis:names:tc:SAML:2.0:protocol { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon, chLatin_p, chLatin_r, chLatin_o, chLatin_t, chLatin_o, chLatin_c, chLatin_o, chLatin_l, chNull }; -const XMLCh XMLConstants::SAML20MD_NS[] = // urn:oasis:names:tc:SAML:2.0:metadata +const XMLCh SAMLConstants::SAML20MD_NS[] = // urn:oasis:names:tc:SAML:2.0:metadata { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon, chLatin_m, chLatin_e, chLatin_t, chLatin_a, chLatin_d, chLatin_a, chLatin_t, chLatin_a, chNull }; -const XMLCh XMLConstants::SAML20AC_NS[] = // urn:oasis:names:tc:SAML:2.0:ac +const XMLCh SAMLConstants::SAML20AC_NS[] = // urn:oasis:names:tc:SAML:2.0:ac { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon, chLatin_a, chLatin_c, chNull }; -const XMLCh XMLConstants::SAML20_PREFIX[] = UNICODE_LITERAL_4(s,a,m,l); +const XMLCh SAMLConstants::SAML20_PREFIX[] = UNICODE_LITERAL_4(s,a,m,l); -const XMLCh XMLConstants::SAML20P_PREFIX[] = UNICODE_LITERAL_5(s,a,m,l,p); +const XMLCh SAMLConstants::SAML20P_PREFIX[] = UNICODE_LITERAL_5(s,a,m,l,p); -const XMLCh XMLConstants::SAML20MD_PREFIX[] = UNICODE_LITERAL_2(m,d); +const XMLCh SAMLConstants::SAML20MD_PREFIX[] = UNICODE_LITERAL_2(m,d); -const XMLCh XMLConstants::SAML20AC_PREFIX[] = UNICODE_LITERAL_2(a,c); +const XMLCh SAMLConstants::SAML20AC_PREFIX[] = UNICODE_LITERAL_2(a,c); -const XMLCh XMLConstants::SAML20ECP_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp +const XMLCh SAMLConstants::SAML20ECP_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon, @@ -125,9 +125,9 @@ const XMLCh XMLConstants::SAML20ECP_NS[] = // urn:oasis:names:tc:SAML:2.0:profil chLatin_S, chLatin_S, chLatin_O, chColon, chLatin_e, chLatin_c, chLatin_p, chNull }; -const XMLCh XMLConstants::SAML20ECP_PREFIX[] = UNICODE_LITERAL_3(e,c,p); +const XMLCh SAMLConstants::SAML20ECP_PREFIX[] = UNICODE_LITERAL_3(e,c,p); -const XMLCh XMLConstants::SAML20DCE_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:attribute:DCE +const XMLCh SAMLConstants::SAML20DCE_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:attribute:DCE { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon, @@ -136,9 +136,9 @@ const XMLCh XMLConstants::SAML20DCE_NS[] = // urn:oasis:names:tc:SAML:2.0:profil chLatin_D, chLatin_C, chLatin_E, chNull }; -const XMLCh XMLConstants::SAML20DCE_PREFIX[] = UNICODE_LITERAL_3(D,C,E); +const XMLCh SAMLConstants::SAML20DCE_PREFIX[] = UNICODE_LITERAL_3(D,C,E); -const XMLCh XMLConstants::SAML20X500_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:attribute:X500 +const XMLCh SAMLConstants::SAML20X500_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:attribute:X500 { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon, @@ -147,9 +147,9 @@ const XMLCh XMLConstants::SAML20X500_NS[] = // urn:oasis:names:tc:SAML:2.0:profi chLatin_X, chDigit_5, chDigit_0, chDigit_0, chNull }; -const XMLCh XMLConstants::SAML20X500_PREFIX[] = { chLatin_x, chDigit_5, chDigit_0, chDigit_0 }; +const XMLCh SAMLConstants::SAML20X500_PREFIX[] = { chLatin_x, chDigit_5, chDigit_0, chDigit_0 }; -const XMLCh XMLConstants::SAML20XACML_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:attribute:XACML +const XMLCh SAMLConstants::SAML20XACML_NS[] = // urn:oasis:names:tc:SAML:2.0:profiles:attribute:XACML { chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_o, chLatin_a, chLatin_s, chLatin_i, chLatin_s, chColon, chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chColon, chLatin_t, chLatin_c, chColon, chLatin_S, chLatin_A, chLatin_M, chLatin_L, chColon, chDigit_2, chPeriod, chDigit_0, chColon, @@ -158,4 +158,4 @@ const XMLCh XMLConstants::SAML20XACML_NS[] = // urn:oasis:names:tc:SAML:2.0:prof chLatin_X, chLatin_A, chLatin_C, chLatin_M, chLatin_L, chNull }; -const XMLCh XMLConstants::SAML20XACML_PREFIX[] = UNICODE_LITERAL_9(x,a,c,m,l,p,r,o,f); +const XMLCh SAMLConstants::SAML20XACML_PREFIX[] = UNICODE_LITERAL_9(x,a,c,m,l,p,r,o,f); diff --git a/saml/util/XMLConstants.h b/saml/util/SAMLConstants.h similarity index 95% rename from saml/util/XMLConstants.h rename to saml/util/SAMLConstants.h index af7d4ba..7e69914 100644 --- a/saml/util/XMLConstants.h +++ b/saml/util/SAMLConstants.h @@ -30,7 +30,7 @@ namespace opensaml { /** * SAML related constants. */ - struct SAML_API XMLConstants : public xmltooling::XMLConstants + struct SAML_API SAMLConstants : public xmltooling::XMLConstants { /** SOAP 1.1 Envelope XML namespace ("http://schemas.xmlsoap.org/soap/envelope/") */ static const XMLCh SOAP11ENV_NS[]; -- 2.1.4