From: cantor Date: Wed, 10 May 2006 03:12:31 +0000 (+0000) Subject: Completed SAML 1 assertion schema, started test cases. X-Git-Tag: 2.4.1~605 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fopensaml2.git;a=commitdiff_plain;h=7fc005ffbdb6eba55c757daf48433599fd9b39c3 Completed SAML 1 assertion schema, started test cases. git-svn-id: https://svn.middleware.georgetown.edu/cpp-opensaml2/trunk@9 fb386ef7-a10c-0410-8ebf-fd3f8e989ab0 --- diff --git a/.cdtproject b/.cdtproject index 42e0853..abae0c2 100644 --- a/.cdtproject +++ b/.cdtproject @@ -57,6 +57,7 @@ + @@ -65,6 +66,8 @@ + + diff --git a/cpp-opensaml2.sln b/cpp-opensaml2.sln index a6e1762..19f31bb 100644 --- a/cpp-opensaml2.sln +++ b/cpp-opensaml2.sln @@ -3,6 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "saml", "saml\saml.vcproj", "{34DE3EA5-EA05-4261-8B63-A850FFB91768}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "samltest", "samltest\samltest.vcproj", "{8BBB3B12-DBA1-4533-9C36-2CA95F1F1659}" + ProjectSection(ProjectDependencies) = postProject + {34DE3EA5-EA05-4261-8B63-A850FFB91768} = {34DE3EA5-EA05-4261-8B63-A850FFB91768} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -13,6 +18,10 @@ Global {34DE3EA5-EA05-4261-8B63-A850FFB91768}.Debug|Win32.Build.0 = Debug|Win32 {34DE3EA5-EA05-4261-8B63-A850FFB91768}.Release|Win32.ActiveCfg = Release|Win32 {34DE3EA5-EA05-4261-8B63-A850FFB91768}.Release|Win32.Build.0 = Release|Win32 + {8BBB3B12-DBA1-4533-9C36-2CA95F1F1659}.Debug|Win32.ActiveCfg = Debug|Win32 + {8BBB3B12-DBA1-4533-9C36-2CA95F1F1659}.Debug|Win32.Build.0 = Debug|Win32 + {8BBB3B12-DBA1-4533-9C36-2CA95F1F1659}.Release|Win32.ActiveCfg = Release|Win32 + {8BBB3B12-DBA1-4533-9C36-2CA95F1F1659}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/saml/SAMLConfig.h b/saml/SAMLConfig.h index 2b3540f..cd9dfa1 100644 --- a/saml/SAMLConfig.h +++ b/saml/SAMLConfig.h @@ -25,6 +25,8 @@ #include #include +#include + #include /** diff --git a/saml/saml1/core/Assertions.h b/saml/saml1/core/Assertions.h index 23cb0ef..eb138ae 100644 --- a/saml/saml1/core/Assertions.h +++ b/saml/saml1/core/Assertions.h @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -44,6 +45,7 @@ namespace opensaml { */ namespace saml1 { + // Forward references class SAML_API Assertion; DECL_XMLOBJECT_SIMPLE(SAML_API,AssertionIDReference,Reference,SAML 1.x AssertionIDReference element); @@ -77,12 +79,25 @@ namespace opensaml { BEGIN_XMLOBJECT(SAML_API,NameIdentifier,xmltooling::SimpleElement,SAML 1.x NameIdentifier element); DECL_STRING_ATTRIB(NameQualifier,NAMEQUALIFIER); DECL_STRING_ATTRIB(Format,FORMAT); + DECL_XMLOBJECT_CONTENT(Name); /** NameIdentifierType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; - BEGIN_XMLOBJECT(SAML_API,SubjectConfirmationData,xmltooling::ElementProxy,SAML 1.x SubjectConfirmationData element); - END_XMLOBJECT; + /** SAML 1.x SubjectConfirmationData element */ + class SAML_API SubjectConfirmationData : public virtual xmltooling::ElementProxy, + public virtual xmltooling::AttributeExtensibleXMLObject, + public virtual xmltooling::ValidatingXMLObject + { + protected: + SubjectConfirmationData() {} + public: + virtual ~SubjectConfirmationData() {} + /** Type-specific clone method. */ + virtual SubjectConfirmationData* cloneSubjectConfirmationData() const=0; + /** Element local name. */ + static const XMLCh LOCAL_NAME[]; + }; BEGIN_XMLOBJECT(SAML_API,SubjectConfirmation,xmltooling::XMLObject,SAML 1.x SubjectConfirmation element); DECL_TYPED_CHILDREN(ConfirmationMethod); @@ -109,7 +124,7 @@ namespace opensaml { 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 */ + /** SubjectLocalityType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; @@ -117,7 +132,7 @@ namespace opensaml { DECL_XMLOBJECT_ATTRIB(AuthorityKind,AUTHORITYKIND,xmltooling::QName); DECL_STRING_ATTRIB(Location,LOCATION); DECL_STRING_ATTRIB(Binding,BINDING); - /** AuthorityBinding local name */ + /** AuthorityBindingType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; @@ -126,7 +141,70 @@ namespace opensaml { DECL_DATETIME_ATTRIB(AuthenticationInstant,AUTHENTICATIONINSTANT); DECL_TYPED_CHILD(SubjectLocality); DECL_TYPED_CHILDREN(AuthorityBinding); - /** AuthenticationStatement local name */ + /** AuthenticationStatementType local name */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,Action,xmltooling::SimpleElement,SAML 1.x Action element); + DECL_STRING_ATTRIB(Namespace,NAMESPACE); + DECL_XMLOBJECT_CONTENT(Value); + /** ActionType local name */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,Evidence,xmltooling::XMLObject,SAML 1.x Evidence element); + DECL_TYPED_CHILDREN(AssertionIDReference); + DECL_TYPED_CHILDREN(Assertion); + /** EvidenceType local name */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,AuthorizationDecisionStatement,SubjectStatement,SAML 1.x AuthorizationDecisionStatement element); + DECL_STRING_ATTRIB(Resource,RESOURCE); + DECL_STRING_ATTRIB(Decision,DECISION); + DECL_TYPED_CHILDREN(Action); + DECL_TYPED_CHILD(Evidence); + /** AuthorizationDecisionStatementType local name */ + static const XMLCh TYPE_NAME[]; + /** Permit Decision */ + static const XMLCh DECISION_PERMIT[]; + /** Deny Decision */ + static const XMLCh DECISION_DENY[]; + /** Indeterminate Decision */ + static const XMLCh DECISION_INDETERMINATE[]; + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,AttributeDesignator,xmltooling::XMLObject,SAML 1.x AttributeDesignator element); + DECL_STRING_ATTRIB(AttributeName,ATTRIBUTENAME); + DECL_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE); + /** AttributeDesignatorType local name */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + BEGIN_XMLOBJECT(SAML_API,Attribute,AttributeDesignator,SAML 1.x Attribute element); + DECL_XMLOBJECT_CHILDREN(AttributeValue); + /** AttributeType local name */ + static const XMLCh TYPE_NAME[]; + END_XMLOBJECT; + + /** SAML 1.x AttributeValue element */ + class SAML_API AttributeValue : public virtual xmltooling::ElementProxy, + public virtual xmltooling::AttributeExtensibleXMLObject, + public virtual xmltooling::ValidatingXMLObject + { + protected: + AttributeValue() {} + public: + virtual ~AttributeValue() {} + /** Type-specific clone method. */ + virtual AttributeValue* cloneAttributeValue() const=0; + /** Element local name. */ + static const XMLCh LOCAL_NAME[]; + }; + + BEGIN_XMLOBJECT(SAML_API,AttributeStatement,SubjectStatement,SAML 1.x AttributeStatement element); + DECL_TYPED_CHILDREN(Attribute); + /** AttributeStatementType local name */ static const XMLCh TYPE_NAME[]; END_XMLOBJECT; @@ -153,16 +231,23 @@ namespace opensaml { static const XMLCh TYPE_NAME[]; END_XMLOBJECT; + DECL_SAML1OBJECTBUILDER(Action); DECL_SAML1OBJECTBUILDER(Advice); DECL_SAML1OBJECTBUILDER(Assertion); DECL_SAML1OBJECTBUILDER(AssertionIDReference); + DECL_SAML1OBJECTBUILDER(Attribute); + DECL_SAML1OBJECTBUILDER(AttributeDesignator); + DECL_SAML1OBJECTBUILDER(AttributeStatement); + DECL_SAML1OBJECTBUILDER(AttributeValue); DECL_SAML1OBJECTBUILDER(Audience); DECL_SAML1OBJECTBUILDER(AudienceRestrictionCondition); DECL_SAML1OBJECTBUILDER(AuthenticationStatement); + DECL_SAML1OBJECTBUILDER(AuthorizationDecisionStatement); DECL_SAML1OBJECTBUILDER(AuthorityBinding); - DECL_SAML1OBJECTBUILDER(DoNotCacheCondition); DECL_SAML1OBJECTBUILDER(Conditions); DECL_SAML1OBJECTBUILDER(ConfirmationMethod); + DECL_SAML1OBJECTBUILDER(DoNotCacheCondition); + DECL_SAML1OBJECTBUILDER(Evidence); DECL_SAML1OBJECTBUILDER(NameIdentifier); DECL_SAML1OBJECTBUILDER(Subject); DECL_SAML1OBJECTBUILDER(SubjectConfirmation); diff --git a/saml/saml1/core/impl/AssertionsImpl.cpp b/saml/saml1/core/impl/AssertionsImpl.cpp index 0ec6f0d..faf6978 100644 --- a/saml/saml1/core/impl/AssertionsImpl.cpp +++ b/saml/saml1/core/impl/AssertionsImpl.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -201,7 +202,10 @@ namespace opensaml { public AbstractXMLObjectUnmarshaller { public: - virtual ~NameIdentifierImpl() {} + virtual ~NameIdentifierImpl() { + XMLString::release(&m_Format); + XMLString::release(&m_NameQualifier); + } NameIdentifierImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { @@ -226,43 +230,32 @@ namespace opensaml { IMPL_XMLOBJECT_CONTENT; protected: + void marshallAttributes(DOMElement* domElement) const { + MARSHALL_STRING_ATTRIB(Format,FORMAT,NULL); + MARSHALL_STRING_ATTRIB(NameQualifier,NAMEQUALIFIER,NULL); + } + 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 + class SAML_DLLLOCAL SubjectConfirmationDataImpl + : public virtual SubjectConfirmationData, public AnyElementImpl, public AbstractValidatingXMLObject { public: virtual ~SubjectConfirmationDataImpl() {} SubjectConfirmationDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + : AnyElementImpl(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()); - } - } + : AnyElementImpl(src), AbstractValidatingXMLObject(src) { } 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, @@ -411,6 +404,102 @@ namespace opensaml { } }; + 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 AuthenticationStatementImpl : public virtual AuthenticationStatement, public SubjectStatementImpl { public: @@ -480,7 +569,8 @@ namespace opensaml { } }; - class SAML_DLLLOCAL SubjectLocalityImpl : public virtual SubjectLocality, + class SAML_DLLLOCAL ActionImpl : public virtual Action, + public AbstractSimpleElement, public AbstractChildlessElement, public AbstractDOMCachingXMLObject, public AbstractValidatingXMLObject, @@ -488,44 +578,153 @@ namespace opensaml { public AbstractXMLObjectUnmarshaller { public: - virtual ~SubjectLocalityImpl() { - XMLString::release(&m_IPAddress); - XMLString::release(&m_DNSAddress); + virtual ~ActionImpl() { + XMLString::release(&m_Namespace); } - SubjectLocalityImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + ActionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_Namespace(NULL) { + } + + ActionImpl(const ActionImpl& src) + : AbstractXMLObject(src), AbstractSimpleElement(src), + AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) { + setNamespace(src.getNamespace()); + } + + IMPL_XMLOBJECT_CLONE(Action); + IMPL_STRING_ATTRIB(Namespace); + IMPL_XMLOBJECT_CONTENT; + + protected: + void marshallAttributes(DOMElement* domElement) const { + MARSHALL_STRING_ATTRIB(Namespace,NAMESPACE,NULL); + } + + void processAttribute(const DOMAttr* attribute) { + PROC_STRING_ATTRIB(Namespace,NAMESPACE,NULL); + } + }; + + class SAML_DLLLOCAL EvidenceImpl : public virtual Evidence, + public AbstractComplexElement, + public AbstractDOMCachingXMLObject, + public AbstractValidatingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + public: + virtual ~EvidenceImpl() {} + + EvidenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + } + + EvidenceImpl(const EvidenceImpl& 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; + } + } + } + } + + IMPL_XMLOBJECT_CLONE(Evidence); + IMPL_TYPED_CHILDREN(AssertionIDReference,m_children.end()); + IMPL_TYPED_CHILDREN(Assertion,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); + AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); + } + }; + + class SAML_DLLLOCAL AuthorizationDecisionStatementImpl + : public virtual AuthorizationDecisionStatement, public SubjectStatementImpl + { + public: + virtual ~AuthorizationDecisionStatementImpl() { + XMLString::release(&m_Resource); + XMLString::release(&m_Decision); + } + + AuthorizationDecisionStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : SubjectStatementImpl(nsURI, localName, prefix, schemaType) { init(); } - SubjectLocalityImpl(const SubjectLocalityImpl& src) - : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) { + AuthorizationDecisionStatementImpl(const AuthorizationDecisionStatementImpl& src) : SubjectStatementImpl(src) { init(); - setIPAddress(src.getIPAddress()); - setDNSAddress(src.getDNSAddress()); + setResource(src.getResource()); + setDecision(src.getDecision()); + if (src.getEvidence()) + setEvidence(src.getEvidence()->cloneEvidence()); + VectorOf(Action) v=getActions(); + for (vector::const_iterator i=src.m_Actions.begin(); i!=src.m_Actions.end(); i++) { + if (*i) { + v.push_back((*i)->cloneAction()); + } + } } void init() { - m_IPAddress=m_DNSAddress=NULL; + SubjectStatementImpl::init(); + m_Resource=NULL; + m_Decision=NULL; + m_Evidence=NULL; + m_children.push_back(NULL); + m_pos_Evidence=m_pos_Subject; + m_pos_Evidence++; } - IMPL_XMLOBJECT_CLONE(SubjectLocality); - IMPL_STRING_ATTRIB(IPAddress); - IMPL_STRING_ATTRIB(DNSAddress); + IMPL_XMLOBJECT_CLONE(AuthorizationDecisionStatement); + SubjectStatement* cloneSubjectStatement() const { + return cloneAuthorizationDecisionStatement(); + } + Statement* cloneStatement() const { + return cloneAuthorizationDecisionStatement(); + } + IMPL_STRING_ATTRIB(Resource); + IMPL_STRING_ATTRIB(Decision); + IMPL_TYPED_CHILD(Evidence); + IMPL_TYPED_CHILDREN(Action, m_pos_Evidence); protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_STRING_ATTRIB(IPAddress,IPADDRESS,NULL); - MARSHALL_STRING_ATTRIB(DNSAddress,DNSADDRESS,NULL); + MARSHALL_STRING_ATTRIB(Resource,RESOURCE,NULL); + MARSHALL_STRING_ATTRIB(Decision,DECISION,NULL); + SubjectStatementImpl::marshallAttributes(domElement); + } + + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { + PROC_TYPED_CHILD(Evidence,SAMLConstants::SAML1_NS,false); + PROC_TYPED_CHILDREN(Action,SAMLConstants::SAML1_NS,false); + SubjectStatementImpl::processChildElement(childXMLObject,root); } void processAttribute(const DOMAttr* attribute) { - PROC_STRING_ATTRIB(IPAddress,IPADDRESS,NULL); - PROC_STRING_ATTRIB(DNSAddress,DNSADDRESS,NULL); + PROC_STRING_ATTRIB(Resource,RESOURCE,NULL); + PROC_STRING_ATTRIB(Decision,DECISION,NULL); + SubjectStatementImpl::processAttribute(attribute); } }; - class SAML_DLLLOCAL AuthorityBindingImpl : public virtual AuthorityBinding, + class SAML_DLLLOCAL AttributeDesignatorImpl : public virtual AttributeDesignator, public AbstractChildlessElement, public AbstractDOMCachingXMLObject, public AbstractValidatingXMLObject, @@ -533,46 +732,149 @@ namespace opensaml { public AbstractXMLObjectUnmarshaller { public: - virtual ~AuthorityBindingImpl() { - delete m_AuthorityKind; - XMLString::release(&m_Location); - XMLString::release(&m_Binding); + virtual ~AttributeDesignatorImpl() { + XMLString::release(&m_AttributeName); + XMLString::release(&m_AttributeNamespace); } - AuthorityBindingImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + AttributeDesignatorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } - AuthorityBindingImpl(const AuthorityBindingImpl& src) + AttributeDesignatorImpl(const AttributeDesignatorImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) { init(); - setAuthorityKind(src.getAuthorityKind()); - setLocation(src.getLocation()); - setBinding(src.getBinding()); + setAttributeName(src.getAttributeName()); + setAttributeNamespace(src.getAttributeNamespace()); } void init() { - m_AuthorityKind=NULL; - m_Location=m_Binding=NULL; + m_AttributeName=m_AttributeNamespace=NULL; } - IMPL_XMLOBJECT_CLONE(AuthorityBinding); - IMPL_XMLOBJECT_ATTRIB(AuthorityKind,QName); - IMPL_STRING_ATTRIB(Location); - IMPL_STRING_ATTRIB(Binding); + IMPL_XMLOBJECT_CLONE(AttributeDesignator); + IMPL_STRING_ATTRIB(AttributeName); + IMPL_STRING_ATTRIB(AttributeNamespace); protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_QNAME_ATTRIB(AuthorityKind,AUTHORITYKIND,NULL); - MARSHALL_STRING_ATTRIB(Location,LOCATION,NULL); - MARSHALL_STRING_ATTRIB(Binding,BINDING,NULL); + MARSHALL_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,NULL); + MARSHALL_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,NULL); } void processAttribute(const DOMAttr* attribute) { - PROC_QNAME_ATTRIB(AuthorityKind,AUTHORITYKIND,NULL); - PROC_STRING_ATTRIB(Location,LOCATION,NULL); - PROC_STRING_ATTRIB(Binding,BINDING,NULL); + PROC_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,NULL); + PROC_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,NULL); + } + }; + + class SAML_DLLLOCAL AttributeImpl : public virtual Attribute, + public AbstractComplexElement, + public AbstractDOMCachingXMLObject, + public AbstractValidatingXMLObject, + public AbstractXMLObjectMarshaller, + public AbstractXMLObjectUnmarshaller + { + public: + virtual ~AttributeImpl() { + XMLString::release(&m_AttributeName); + XMLString::release(&m_AttributeNamespace); + } + + AttributeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); + } + + AttributeImpl(const AttributeImpl& src) + : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) { + init(); + setAttributeName(src.getAttributeName()); + setAttributeNamespace(src.getAttributeNamespace()); + VectorOf(XMLObject) v=getAttributeValues(); + for (vector::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) { + if (*i) { + v.push_back((*i)->clone()); + } + } + } + + void init() { + m_AttributeName=m_AttributeNamespace=NULL; + } + + IMPL_XMLOBJECT_CLONE(Attribute); + AttributeDesignator* cloneAttributeDesignator() const { + return cloneAttribute(); + } + IMPL_STRING_ATTRIB(AttributeName); + IMPL_STRING_ATTRIB(AttributeNamespace); + IMPL_XMLOBJECT_CHILDREN(AttributeValue,m_children.end()); + + protected: + void marshallAttributes(DOMElement* domElement) const { + MARSHALL_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,NULL); + MARSHALL_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,NULL); + } + + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { + getAttributeValues().push_back(childXMLObject); + } + + void processAttribute(const DOMAttr* attribute) { + PROC_STRING_ATTRIB(AttributeName,ATTRIBUTENAME,NULL); + PROC_STRING_ATTRIB(AttributeNamespace,ATTRIBUTENAMESPACE,NULL); + } + }; + + class SAML_DLLLOCAL AttributeValueImpl + : public virtual AttributeValue, public AnyElementImpl, public AbstractValidatingXMLObject + { + public: + virtual ~AttributeValueImpl() {} + + AttributeValueImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : AnyElementImpl(nsURI, localName, prefix, schemaType) { + } + + AttributeValueImpl(const AttributeValueImpl& src) : AnyElementImpl(src), AbstractValidatingXMLObject(src) {} + + IMPL_XMLOBJECT_CLONE(AttributeValue); + }; + + class SAML_DLLLOCAL AttributeStatementImpl : public virtual AttributeStatement, public SubjectStatementImpl + { + public: + virtual ~AttributeStatementImpl() {} + + AttributeStatementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType) + : SubjectStatementImpl(nsURI, localName, prefix, schemaType) { + init(); + } + + AttributeStatementImpl(const AttributeStatementImpl& src) : SubjectStatementImpl(src) { + VectorOf(Attribute) v=getAttributes(); + for (vector::const_iterator i=src.m_Attributes.begin(); i!=src.m_Attributes.end(); i++) { + if (*i) { + v.push_back((*i)->cloneAttribute()); + } + } + } + + IMPL_XMLOBJECT_CLONE(AttributeStatement); + SubjectStatement* cloneSubjectStatement() const { + return cloneAttributeStatement(); + } + Statement* cloneStatement() const { + return cloneAttributeStatement(); + } + IMPL_TYPED_CHILDREN(Attribute, m_children.end()); + + protected: + void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { + PROC_TYPED_CHILDREN(Attribute,SAMLConstants::SAML1_NS,true); + SubjectStatementImpl::processChildElement(childXMLObject,root); } }; @@ -767,16 +1069,23 @@ namespace opensaml { // Builder Implementations +IMPL_XMLOBJECTBUILDER(Action); IMPL_XMLOBJECTBUILDER(Advice); IMPL_XMLOBJECTBUILDER(Assertion); IMPL_XMLOBJECTBUILDER(AssertionIDReference); +IMPL_XMLOBJECTBUILDER(Attribute); +IMPL_XMLOBJECTBUILDER(AttributeDesignator); +IMPL_XMLOBJECTBUILDER(AttributeStatement); +IMPL_XMLOBJECTBUILDER(AttributeValue); IMPL_XMLOBJECTBUILDER(Audience); IMPL_XMLOBJECTBUILDER(AudienceRestrictionCondition); IMPL_XMLOBJECTBUILDER(AuthenticationStatement); +IMPL_XMLOBJECTBUILDER(AuthorizationDecisionStatement); IMPL_XMLOBJECTBUILDER(AuthorityBinding); IMPL_XMLOBJECTBUILDER(Conditions); IMPL_XMLOBJECTBUILDER(ConfirmationMethod); IMPL_XMLOBJECTBUILDER(DoNotCacheCondition); +IMPL_XMLOBJECTBUILDER(Evidence); IMPL_XMLOBJECTBUILDER(NameIdentifier); IMPL_XMLOBJECTBUILDER(Subject); IMPL_XMLOBJECTBUILDER(SubjectConfirmation); @@ -784,6 +1093,9 @@ IMPL_XMLOBJECTBUILDER(SubjectConfirmationData); IMPL_XMLOBJECTBUILDER(SubjectLocality); // Unicode literals +const XMLCh Action::LOCAL_NAME[] = UNICODE_LITERAL_6(A,c,t,i,o,n); +const XMLCh Action::TYPE_NAME[] = UNICODE_LITERAL_10(A,c,t,i,o,n,T,y,p,e); +const XMLCh Action::NAMESPACE_ATTRIB_NAME[] = UNICODE_LITERAL_9(N,a,m,e,s,p,a,c,e); 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); @@ -793,6 +1105,15 @@ const XMLCh Assertion::ASSERTIONID_ATTRIB_NAME[] = UNICODE_LITERAL_11(A,s,s,e,r 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 Attribute::LOCAL_NAME[] = UNICODE_LITERAL_9(A,t,t,r,i,b,u,t,e); +const XMLCh Attribute::TYPE_NAME[] = UNICODE_LITERAL_13(A,t,t,r,i,b,u,t,e,T,y,p,e); +const XMLCh AttributeDesignator::LOCAL_NAME[] = UNICODE_LITERAL_19(A,t,t,r,i,b,u,t,e,D,e,s,i,g,n,a,t,o,r); +const XMLCh AttributeDesignator::TYPE_NAME[] = UNICODE_LITERAL_23(A,t,t,r,i,b,u,t,e,D,e,s,i,g,n,a,t,o,r,T,y,p,e); +const XMLCh AttributeDesignator::ATTRIBUTENAME_ATTRIB_NAME[] = UNICODE_LITERAL_13(A,t,t,r,i,b,u,t,e,N,a,m,e); +const XMLCh AttributeDesignator::ATTRIBUTENAMESPACE_ATTRIB_NAME[] = UNICODE_LITERAL_18(A,t,t,r,i,b,u,t,e,N,a,m,e,s,p,a,c,e); +const XMLCh AttributeStatement::LOCAL_NAME[] = UNICODE_LITERAL_18(A,t,t,r,i,b,u,t,e,S,t,a,t,e,m,e,n,t); +const XMLCh AttributeStatement::TYPE_NAME[] = UNICODE_LITERAL_22(A,t,t,r,i,b,u,t,e,S,t,a,t,e,m,e,n,t,T,y,p,e); +const XMLCh AttributeValue::LOCAL_NAME[] = UNICODE_LITERAL_14(A,t,t,r,i,b,u,t,e,V,a,l,u,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); @@ -805,6 +1126,13 @@ const XMLCh AuthorityBinding::TYPE_NAME[] = UNICODE_LITERAL_20(A,u,t,h,o 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 AuthorizationDecisionStatement::LOCAL_NAME[] = UNICODE_LITERAL_30(A,u,t,h,o,r,i,z,a,t,i,o,n,D,e,c,i,s,i,o,n,S,t,a,t,e,m,e,n,t); +const XMLCh AuthorizationDecisionStatement::TYPE_NAME[] = UNICODE_LITERAL_34(A,u,t,h,o,r,i,z,a,t,i,o,n,D,e,c,i,s,i,o,n,S,t,a,t,e,m,e,n,t,T,y,p,e); +const XMLCh AuthorizationDecisionStatement::RESOURCE_ATTRIB_NAME[] = UNICODE_LITERAL_8(R,e,s,o,u,r,c,e); +const XMLCh AuthorizationDecisionStatement::DECISION_ATTRIB_NAME[] = UNICODE_LITERAL_8(D,e,c,i,s,i,o,n); +const XMLCh AuthorizationDecisionStatement::DECISION_PERMIT[] = UNICODE_LITERAL_6(P,e,r,m,i,t); +const XMLCh AuthorizationDecisionStatement::DECISION_DENY[] = UNICODE_LITERAL_4(D,e,n,y); +const XMLCh AuthorizationDecisionStatement::DECISION_INDETERMINATE[] = UNICODE_LITERAL_13(I,n,d,e,t,e,r,m,i,n,a,t,e); 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); @@ -813,6 +1141,8 @@ const XMLCh Conditions::NOTONORAFTER_ATTRIB_NAME[] =UNICODE_LITERAL_12(N,o,t,O,n 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 Evidence::LOCAL_NAME[] = UNICODE_LITERAL_8(E,v,i,d,e,n,c,e); +const XMLCh Evidence::TYPE_NAME[] = UNICODE_LITERAL_12(E,v,i,d,e,n,c,e,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); diff --git a/saml/saml1/core/impl/AssertionsSchemaValidators.cpp b/saml/saml1/core/impl/AssertionsSchemaValidators.cpp index 7aed851..f789011 100644 --- a/saml/saml1/core/impl/AssertionsSchemaValidators.cpp +++ b/saml/saml1/core/impl/AssertionsSchemaValidators.cpp @@ -31,10 +31,12 @@ using namespace std; namespace opensaml { namespace saml1 { - + + XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,Action); XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,AssertionIDReference); XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,Audience); XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,ConfirmationMethod); + XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,NameIdentifier); BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,AudienceRestrictionCondition); XMLOBJECTVALIDATOR_NONEMPTY(AudienceRestrictionCondition,Audience); @@ -70,6 +72,37 @@ namespace opensaml { XMLOBJECTVALIDATOR_REQUIRE(AuthenticationStatement,Subject); END_XMLOBJECTVALIDATOR; + BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Evidence); + if (!ptr->hasChildren()) + throw ValidationException("Evidence must have at least one child element."); + END_XMLOBJECTVALIDATOR; + + BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,AuthorizationDecisionStatement); + XMLOBJECTVALIDATOR_REQUIRE(AuthorizationDecisionStatement,Resource); + XMLOBJECTVALIDATOR_REQUIRE(AuthorizationDecisionStatement,Decision); + if (!XMLString::equals(ptr->getDecision(),AuthorizationDecisionStatement::DECISION_PERMIT) && + !XMLString::equals(ptr->getDecision(),AuthorizationDecisionStatement::DECISION_DENY) && + !XMLString::equals(ptr->getDecision(),AuthorizationDecisionStatement::DECISION_INDETERMINATE)) + throw ValidationException("Decision must be one of Deny, Permit, or Indeterminate."); + XMLOBJECTVALIDATOR_REQUIRE(AuthorizationDecisionStatement,Subject); + XMLOBJECTVALIDATOR_NONEMPTY(AuthorizationDecisionStatement,Action); + END_XMLOBJECTVALIDATOR; + + BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,AttributeDesignator); + XMLOBJECTVALIDATOR_REQUIRE(AttributeDesignator,AttributeName); + XMLOBJECTVALIDATOR_REQUIRE(AttributeDesignator,AttributeNamespace); + END_XMLOBJECTVALIDATOR; + + BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Attribute); + XMLOBJECTVALIDATOR_REQUIRE(Attribute,AttributeName); + XMLOBJECTVALIDATOR_REQUIRE(Attribute,AttributeNamespace); + XMLOBJECTVALIDATOR_NONEMPTY(Attribute,AttributeValue); + END_XMLOBJECTVALIDATOR; + + BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,AttributeStatement); + XMLOBJECTVALIDATOR_NONEMPTY(AttributeStatement,Attribute); + END_XMLOBJECTVALIDATOR; + BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Assertion); XMLOBJECTVALIDATOR_REQUIRE(Assertion,AssertionID); XMLOBJECTVALIDATOR_REQUIRE(Assertion,Issuer); @@ -121,26 +154,43 @@ namespace opensaml { void opensaml::saml1::registerAssertionClasses() { QName q; + REGISTER_ELEMENT(Action); REGISTER_ELEMENT(Advice); REGISTER_ELEMENT(Assertion); REGISTER_ELEMENT(AssertionIDReference); + REGISTER_ELEMENT(Attribute); + REGISTER_ELEMENT(AttributeDesignator); + REGISTER_ELEMENT(AttributeStatement); + REGISTER_ELEMENT_NOVAL(AttributeValue); REGISTER_ELEMENT(Audience); REGISTER_ELEMENT(AudienceRestrictionCondition); REGISTER_ELEMENT(AuthenticationStatement); REGISTER_ELEMENT(AuthorityBinding); + REGISTER_ELEMENT(AuthorizationDecisionStatement); REGISTER_ELEMENT(Conditions); REGISTER_ELEMENT(ConfirmationMethod); REGISTER_ELEMENT_NOVAL(DoNotCacheCondition); + REGISTER_ELEMENT(Evidence); + REGISTER_ELEMENT(NameIdentifier); + REGISTER_ELEMENT(Subject); REGISTER_ELEMENT(SubjectConfirmation); REGISTER_ELEMENT_NOVAL(SubjectConfirmationData); REGISTER_ELEMENT(SubjectLocality); + REGISTER_TYPE(Action); REGISTER_TYPE(Advice); REGISTER_TYPE(Assertion); + REGISTER_TYPE(Attribute); + REGISTER_TYPE(AttributeDesignator); + REGISTER_TYPE(AttributeStatement); REGISTER_TYPE(AudienceRestrictionCondition); REGISTER_TYPE(AuthenticationStatement); REGISTER_TYPE(AuthorityBinding); + REGISTER_TYPE(AuthorizationDecisionStatement); REGISTER_TYPE(Conditions); REGISTER_TYPE_NOVAL(DoNotCacheCondition); + REGISTER_TYPE(Evidence); + REGISTER_TYPE(NameIdentifier); + REGISTER_TYPE(Subject); REGISTER_TYPE(SubjectConfirmation); REGISTER_TYPE(SubjectLocality); } diff --git a/samltest/Makefile.am b/samltest/Makefile.am new file mode 100644 index 0000000..d45c891 --- /dev/null +++ b/samltest/Makefile.am @@ -0,0 +1,33 @@ +AUTOMAKE_OPTIONS = foreign + +if BUILD_UNITTEST +bin_PROGRAMS = samltest +samltest_CXXFLAGS = $(CXXFLAGS) $(CXXTESTFLAGS) +else +bin_PROGRAMS = +endif + +samltest_h = \ + samltest.h \ + saml1/core/impl/ActionTest.h + +noinst_HEADERS = \ + internal.h + +nodist_samltest_SOURCES = $(samltest_h:.h=.cpp) + +CLEANFILES = $(nodist_samltest_SOURCES) + +do-cxxtestgen: + if test $(HFILE) = "samltest.h"; then \ + $(CXXTEST) --error-printer --have-eh --have-std --abort-on-fail -o $(CPPFILE) $(HFILE); \ + else \ + $(CXXTEST) --part --have-eh --have-std --abort-on-fail -o $(CPPFILE) $(HFILE); \ + fi; + +$(nodist_samltest_SOURCES): %.cpp: %.h + $(MAKE) do-cxxtestgen HFILE=$< CPPFILE=$@ + +samltest_LDADD = $(top_builddir)/saml/libsaml.la + +EXTRA_DIST = samltest.vcproj $(samltest_h) data diff --git a/samltest/data/cert.pem b/samltest/data/cert.pem new file mode 100644 index 0000000..e8261f3 --- /dev/null +++ b/samltest/data/cert.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICjzCCAfigAwIBAgIJAKk8t1hYcMkhMA0GCSqGSIb3DQEBBAUAMDoxCzAJBgNV +BAYTAlVTMRIwEAYDVQQKEwlJbnRlcm5ldDIxFzAVBgNVBAMTDnNwLmV4YW1wbGUu +b3JnMB4XDTA1MDYyMDE1NDgzNFoXDTMyMTEwNTE1NDgzNFowOjELMAkGA1UEBhMC +VVMxEjAQBgNVBAoTCUludGVybmV0MjEXMBUGA1UEAxMOc3AuZXhhbXBsZS5vcmcw +gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANlZ1L1mKzYbUVKiMQLhZlfGDyYa +/jjCiaXP0WhLNgvJpOTeajvsrApYNnFX5MLNzuC3NeQIjXUNLN2Yo2MCSthBIOL5 +qE5dka4z9W9zytoflW1LmJ8vXpx8Ay/meG4z//J5iCpYVEquA0xl28HUIlownZUF +7w7bx0cF/02qrR23AgMBAAGjgZwwgZkwHQYDVR0OBBYEFJZiO1qsyAyc3HwMlL9p +JpN6fbGwMGoGA1UdIwRjMGGAFJZiO1qsyAyc3HwMlL9pJpN6fbGwoT6kPDA6MQsw +CQYDVQQGEwJVUzESMBAGA1UEChMJSW50ZXJuZXQyMRcwFQYDVQQDEw5zcC5leGFt +cGxlLm9yZ4IJAKk8t1hYcMkhMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQAD +gYEAMFq/UeSQyngE0GpZueyD2UW0M358uhseYOgGEIfm+qXIFQF6MYwNoX7WFzhC +LJZ2E6mEvZZFHCHUtl7mGDvsRwgZ85YCtRbvleEpqfgNQToto9pLYe+X6vvH9Z6p +gmYsTmak+kxO93JprrOd9xp8aZPMEprL7VCdrhbZEfyYER0= +-----END CERTIFICATE----- diff --git a/samltest/data/key.pem b/samltest/data/key.pem new file mode 100644 index 0000000..5149449 --- /dev/null +++ b/samltest/data/key.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQDZWdS9Zis2G1FSojEC4WZXxg8mGv44womlz9FoSzYLyaTk3mo7 +7KwKWDZxV+TCzc7gtzXkCI11DSzdmKNjAkrYQSDi+ahOXZGuM/Vvc8raH5VtS5if +L16cfAMv5nhuM//yeYgqWFRKrgNMZdvB1CJaMJ2VBe8O28dHBf9Nqq0dtwIDAQAB +AoGAKsaVKdlLs9BYhuzIvIpju+6M2LEDS2Rt9qYZzm7O6i77NtfXDIgdq8OEo3Xq +3bPnfS5Retl8DYdURyBdN4Uh+WR/BUWQjBvOaJLEEdxvuAaLyAjniVREwkc2rXTZ +xoYYFL/XMyAEt/ye2ZbTw2u5R2i7HCYdddZWMkP1+Vabg8ECQQD7VJXWy8KFiyeC +thJiVqG/h5IO0y25dId/n81sW2B55eK0c4+IVsqc0a45/U/y2y1wtNBmIEQQn9yY +pDtWwzVRAkEA3WOgmvxFGTI5V1K5CLCCZzQIUYpzQDQvBu2sKYuy8dK2BMEGe9Zw +cKVyZJuDKHBvrVI5G6CqkHuFD2PwDvwAhwJBAPdfbM/q4/4/VddAz918uV1j2a2/ +y3yDJq7GIhHp6o5wZ3AHYhnmmyw48YxgOGWntxT80zYBwhy+zAhtdX5TStECQEKL +drP/TfnD2e6Ag/Ozso642iNAXWIYDWakvBIE1rXPYzzMlFlW3JdPc7H/+I2INlk/ +lMDUK1CggB9fJ8IpRzMCQQDQmqpWZtH6eaMAN6b/9WBdVzqzpCeTWFlL/SwhVbzI +s+k2zvC4HEAK9Y199g6SHVTQMEAE49wfhhCpY0JdCsQ/ +-----END RSA PRIVATE KEY----- diff --git a/samltest/data/saml1/core/impl/AdviceWithChildren.xml b/samltest/data/saml1/core/impl/AdviceWithChildren.xml new file mode 100644 index 0000000..eeab16c Binary files /dev/null and b/samltest/data/saml1/core/impl/AdviceWithChildren.xml differ diff --git a/samltest/data/saml1/core/impl/AssertionWithChildren.xml b/samltest/data/saml1/core/impl/AssertionWithChildren.xml new file mode 100644 index 0000000..85ec2b2 Binary files /dev/null and b/samltest/data/saml1/core/impl/AssertionWithChildren.xml differ diff --git a/samltest/data/saml1/core/impl/AttributeQueryWithChildren.xml b/samltest/data/saml1/core/impl/AttributeQueryWithChildren.xml new file mode 100644 index 0000000..22ec6c9 --- /dev/null +++ b/samltest/data/saml1/core/impl/AttributeQueryWithChildren.xml @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/AttributeStatementWithChildren.xml b/samltest/data/saml1/core/impl/AttributeStatementWithChildren.xml new file mode 100644 index 0000000..db4d7d4 Binary files /dev/null and b/samltest/data/saml1/core/impl/AttributeStatementWithChildren.xml differ diff --git a/samltest/data/saml1/core/impl/AttributeWithChildren.xml b/samltest/data/saml1/core/impl/AttributeWithChildren.xml new file mode 100644 index 0000000..f52888f Binary files /dev/null and b/samltest/data/saml1/core/impl/AttributeWithChildren.xml differ diff --git a/samltest/data/saml1/core/impl/AudienceRestrictionConditionWithChildren.xml b/samltest/data/saml1/core/impl/AudienceRestrictionConditionWithChildren.xml new file mode 100644 index 0000000..f8a3d4d Binary files /dev/null and b/samltest/data/saml1/core/impl/AudienceRestrictionConditionWithChildren.xml differ diff --git a/samltest/data/saml1/core/impl/AuthenticationQueryWithChildren.xml b/samltest/data/saml1/core/impl/AuthenticationQueryWithChildren.xml new file mode 100644 index 0000000..988ec02 --- /dev/null +++ b/samltest/data/saml1/core/impl/AuthenticationQueryWithChildren.xml @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/AuthenticationStatementWithChildren.xml b/samltest/data/saml1/core/impl/AuthenticationStatementWithChildren.xml new file mode 100644 index 0000000..f63491b Binary files /dev/null and b/samltest/data/saml1/core/impl/AuthenticationStatementWithChildren.xml differ diff --git a/samltest/data/saml1/core/impl/AuthorizationDecisionQueryWithChildren.xml b/samltest/data/saml1/core/impl/AuthorizationDecisionQueryWithChildren.xml new file mode 100644 index 0000000..abcc409 --- /dev/null +++ b/samltest/data/saml1/core/impl/AuthorizationDecisionQueryWithChildren.xml @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/AuthorizationDecisionStatementWithChildren.xml b/samltest/data/saml1/core/impl/AuthorizationDecisionStatementWithChildren.xml new file mode 100644 index 0000000..919637d Binary files /dev/null and b/samltest/data/saml1/core/impl/AuthorizationDecisionStatementWithChildren.xml differ diff --git a/samltest/data/saml1/core/impl/ConditionsWithChildren.xml b/samltest/data/saml1/core/impl/ConditionsWithChildren.xml new file mode 100644 index 0000000..393695d --- /dev/null +++ b/samltest/data/saml1/core/impl/ConditionsWithChildren.xml @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/EvidenceWithChildren.xml b/samltest/data/saml1/core/impl/EvidenceWithChildren.xml new file mode 100644 index 0000000..27f5278 Binary files /dev/null and b/samltest/data/saml1/core/impl/EvidenceWithChildren.xml differ diff --git a/samltest/data/saml1/core/impl/FullStatus.xml b/samltest/data/saml1/core/impl/FullStatus.xml new file mode 100644 index 0000000..c4df510 --- /dev/null +++ b/samltest/data/saml1/core/impl/FullStatus.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/FullStatusCode.xml b/samltest/data/saml1/core/impl/FullStatusCode.xml new file mode 100644 index 0000000..760e44f --- /dev/null +++ b/samltest/data/saml1/core/impl/FullStatusCode.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/FullStatusMessage.xml b/samltest/data/saml1/core/impl/FullStatusMessage.xml new file mode 100644 index 0000000..b8539ac --- /dev/null +++ b/samltest/data/saml1/core/impl/FullStatusMessage.xml @@ -0,0 +1 @@ +Nibble a Happy Warthog \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/RequestWithAssertionArtifact.xml b/samltest/data/saml1/core/impl/RequestWithAssertionArtifact.xml new file mode 100644 index 0000000..fb013eb --- /dev/null +++ b/samltest/data/saml1/core/impl/RequestWithAssertionArtifact.xml @@ -0,0 +1,6 @@ + diff --git a/samltest/data/saml1/core/impl/RequestWithAssertionIDReference.xml b/samltest/data/saml1/core/impl/RequestWithAssertionIDReference.xml new file mode 100644 index 0000000..a9d1b48 --- /dev/null +++ b/samltest/data/saml1/core/impl/RequestWithAssertionIDReference.xml @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/RequestWithQuery.xml b/samltest/data/saml1/core/impl/RequestWithQuery.xml new file mode 100644 index 0000000..97642b1 --- /dev/null +++ b/samltest/data/saml1/core/impl/RequestWithQuery.xml @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/ResponseWithChildren.xml b/samltest/data/saml1/core/impl/ResponseWithChildren.xml new file mode 100644 index 0000000..fdbd61e --- /dev/null +++ b/samltest/data/saml1/core/impl/ResponseWithChildren.xml @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/SubjectConfirmationWithChildren.xml b/samltest/data/saml1/core/impl/SubjectConfirmationWithChildren.xml new file mode 100644 index 0000000..38af8d2 Binary files /dev/null and b/samltest/data/saml1/core/impl/SubjectConfirmationWithChildren.xml differ diff --git a/samltest/data/saml1/core/impl/SubjectWithChildren.xml b/samltest/data/saml1/core/impl/SubjectWithChildren.xml new file mode 100644 index 0000000..7c134ba Binary files /dev/null and b/samltest/data/saml1/core/impl/SubjectWithChildren.xml differ diff --git a/samltest/data/saml1/core/impl/singleAction.xml b/samltest/data/saml1/core/impl/singleAction.xml new file mode 100644 index 0000000..f6b3cf5 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAction.xml differ diff --git a/samltest/data/saml1/core/impl/singleActionAttributes.xml b/samltest/data/saml1/core/impl/singleActionAttributes.xml new file mode 100644 index 0000000..c7701ed Binary files /dev/null and b/samltest/data/saml1/core/impl/singleActionAttributes.xml differ diff --git a/samltest/data/saml1/core/impl/singleAdvice.xml b/samltest/data/saml1/core/impl/singleAdvice.xml new file mode 100644 index 0000000..5bd3f6d Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAdvice.xml differ diff --git a/samltest/data/saml1/core/impl/singleAssertion.xml b/samltest/data/saml1/core/impl/singleAssertion.xml new file mode 100644 index 0000000..4c6a67f Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAssertion.xml differ diff --git a/samltest/data/saml1/core/impl/singleAssertionArtifact.xml b/samltest/data/saml1/core/impl/singleAssertionArtifact.xml new file mode 100644 index 0000000..84d0558 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAssertionArtifact.xml differ diff --git a/samltest/data/saml1/core/impl/singleAssertionArtifactAttribute.xml b/samltest/data/saml1/core/impl/singleAssertionArtifactAttribute.xml new file mode 100644 index 0000000..d576318 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAssertionArtifactAttribute.xml differ diff --git a/samltest/data/saml1/core/impl/singleAssertionAttributes.xml b/samltest/data/saml1/core/impl/singleAssertionAttributes.xml new file mode 100644 index 0000000..7c83a38 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAssertionAttributes.xml differ diff --git a/samltest/data/saml1/core/impl/singleAssertionIDReference.xml b/samltest/data/saml1/core/impl/singleAssertionIDReference.xml new file mode 100644 index 0000000..db3bef3 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAssertionIDReference.xml differ diff --git a/samltest/data/saml1/core/impl/singleAssertionIDReferenceContents.xml b/samltest/data/saml1/core/impl/singleAssertionIDReferenceContents.xml new file mode 100644 index 0000000..f6dc2dc Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAssertionIDReferenceContents.xml differ diff --git a/samltest/data/saml1/core/impl/singleAttribute.xml b/samltest/data/saml1/core/impl/singleAttribute.xml new file mode 100644 index 0000000..4e81fad Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAttribute.xml differ diff --git a/samltest/data/saml1/core/impl/singleAttributeAttributes.xml b/samltest/data/saml1/core/impl/singleAttributeAttributes.xml new file mode 100644 index 0000000..9fa828d Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAttributeAttributes.xml differ diff --git a/samltest/data/saml1/core/impl/singleAttributeDesignator.xml b/samltest/data/saml1/core/impl/singleAttributeDesignator.xml new file mode 100644 index 0000000..22a4433 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAttributeDesignator.xml differ diff --git a/samltest/data/saml1/core/impl/singleAttributeDesignatorAttributes.xml b/samltest/data/saml1/core/impl/singleAttributeDesignatorAttributes.xml new file mode 100644 index 0000000..0183cd6 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAttributeDesignatorAttributes.xml differ diff --git a/samltest/data/saml1/core/impl/singleAttributeQuery.xml b/samltest/data/saml1/core/impl/singleAttributeQuery.xml new file mode 100644 index 0000000..20ea074 --- /dev/null +++ b/samltest/data/saml1/core/impl/singleAttributeQuery.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/singleAttributeQueryAttributes.xml b/samltest/data/saml1/core/impl/singleAttributeQueryAttributes.xml new file mode 100644 index 0000000..a5d3b7f --- /dev/null +++ b/samltest/data/saml1/core/impl/singleAttributeQueryAttributes.xml @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/singleAttributeStatement.xml b/samltest/data/saml1/core/impl/singleAttributeStatement.xml new file mode 100644 index 0000000..2896710 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAttributeStatement.xml differ diff --git a/samltest/data/saml1/core/impl/singleAttributeValue.xml b/samltest/data/saml1/core/impl/singleAttributeValue.xml new file mode 100644 index 0000000..4dff576 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAttributeValue.xml differ diff --git a/samltest/data/saml1/core/impl/singleAttributeValueContents.xml b/samltest/data/saml1/core/impl/singleAttributeValueContents.xml new file mode 100644 index 0000000..043d8ab Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAttributeValueContents.xml differ diff --git a/samltest/data/saml1/core/impl/singleAudience.xml b/samltest/data/saml1/core/impl/singleAudience.xml new file mode 100644 index 0000000..9f6af4b Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAudience.xml differ diff --git a/samltest/data/saml1/core/impl/singleAudienceAttributes.xml b/samltest/data/saml1/core/impl/singleAudienceAttributes.xml new file mode 100644 index 0000000..ce2e3b2 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAudienceAttributes.xml differ diff --git a/samltest/data/saml1/core/impl/singleAudienceRestrictionCondition.xml b/samltest/data/saml1/core/impl/singleAudienceRestrictionCondition.xml new file mode 100644 index 0000000..0326f65 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAudienceRestrictionCondition.xml differ diff --git a/samltest/data/saml1/core/impl/singleAuthenticationQuery.xml b/samltest/data/saml1/core/impl/singleAuthenticationQuery.xml new file mode 100644 index 0000000..ae7fcc8 --- /dev/null +++ b/samltest/data/saml1/core/impl/singleAuthenticationQuery.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/singleAuthenticationQueryAttributes.xml b/samltest/data/saml1/core/impl/singleAuthenticationQueryAttributes.xml new file mode 100644 index 0000000..4d6a696 --- /dev/null +++ b/samltest/data/saml1/core/impl/singleAuthenticationQueryAttributes.xml @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/singleAuthenticationStatement.xml b/samltest/data/saml1/core/impl/singleAuthenticationStatement.xml new file mode 100644 index 0000000..3676599 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAuthenticationStatement.xml differ diff --git a/samltest/data/saml1/core/impl/singleAuthenticationStatementAttributes.xml b/samltest/data/saml1/core/impl/singleAuthenticationStatementAttributes.xml new file mode 100644 index 0000000..663cf2d Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAuthenticationStatementAttributes.xml differ diff --git a/samltest/data/saml1/core/impl/singleAuthorityBinding.xml b/samltest/data/saml1/core/impl/singleAuthorityBinding.xml new file mode 100644 index 0000000..caf8ac6 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAuthorityBinding.xml differ diff --git a/samltest/data/saml1/core/impl/singleAuthorityBindingAttributes.xml b/samltest/data/saml1/core/impl/singleAuthorityBindingAttributes.xml new file mode 100644 index 0000000..648d3a7 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAuthorityBindingAttributes.xml differ diff --git a/samltest/data/saml1/core/impl/singleAuthorizationDecisionQuery.xml b/samltest/data/saml1/core/impl/singleAuthorizationDecisionQuery.xml new file mode 100644 index 0000000..fcdc19d --- /dev/null +++ b/samltest/data/saml1/core/impl/singleAuthorizationDecisionQuery.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/singleAuthorizationDecisionQueryAttributes.xml b/samltest/data/saml1/core/impl/singleAuthorizationDecisionQueryAttributes.xml new file mode 100644 index 0000000..8ba5439 --- /dev/null +++ b/samltest/data/saml1/core/impl/singleAuthorizationDecisionQueryAttributes.xml @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/singleAuthorizationDecisionStatement.xml b/samltest/data/saml1/core/impl/singleAuthorizationDecisionStatement.xml new file mode 100644 index 0000000..6740ddd Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAuthorizationDecisionStatement.xml differ diff --git a/samltest/data/saml1/core/impl/singleAuthorizationDecisionStatementAttributes.xml b/samltest/data/saml1/core/impl/singleAuthorizationDecisionStatementAttributes.xml new file mode 100644 index 0000000..57abc3d Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAuthorizationDecisionStatementAttributes.xml differ diff --git a/samltest/data/saml1/core/impl/singleAuthorizationDecisionStatementAttributesInvalid.xml b/samltest/data/saml1/core/impl/singleAuthorizationDecisionStatementAttributesInvalid.xml new file mode 100644 index 0000000..ca6c5f3 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleAuthorizationDecisionStatementAttributesInvalid.xml differ diff --git a/samltest/data/saml1/core/impl/singleConditions.xml b/samltest/data/saml1/core/impl/singleConditions.xml new file mode 100644 index 0000000..abc1df9 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleConditions.xml differ diff --git a/samltest/data/saml1/core/impl/singleConditionsAttributes.xml b/samltest/data/saml1/core/impl/singleConditionsAttributes.xml new file mode 100644 index 0000000..059c5b0 --- /dev/null +++ b/samltest/data/saml1/core/impl/singleConditionsAttributes.xml @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/singleConfirmationMethod.xml b/samltest/data/saml1/core/impl/singleConfirmationMethod.xml new file mode 100644 index 0000000..4e41930 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleConfirmationMethod.xml differ diff --git a/samltest/data/saml1/core/impl/singleConfirmationMethodAttributes.xml b/samltest/data/saml1/core/impl/singleConfirmationMethodAttributes.xml new file mode 100644 index 0000000..2852083 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleConfirmationMethodAttributes.xml differ diff --git a/samltest/data/saml1/core/impl/singleDoNotCacheCondition.xml b/samltest/data/saml1/core/impl/singleDoNotCacheCondition.xml new file mode 100644 index 0000000..74674f6 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleDoNotCacheCondition.xml differ diff --git a/samltest/data/saml1/core/impl/singleEvidence.xml b/samltest/data/saml1/core/impl/singleEvidence.xml new file mode 100644 index 0000000..e684990 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleEvidence.xml differ diff --git a/samltest/data/saml1/core/impl/singleNameIdentifier.xml b/samltest/data/saml1/core/impl/singleNameIdentifier.xml new file mode 100644 index 0000000..b8fea9e Binary files /dev/null and b/samltest/data/saml1/core/impl/singleNameIdentifier.xml differ diff --git a/samltest/data/saml1/core/impl/singleNameIdentifierAttributes.xml b/samltest/data/saml1/core/impl/singleNameIdentifierAttributes.xml new file mode 100644 index 0000000..cc84bc1 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleNameIdentifierAttributes.xml differ diff --git a/samltest/data/saml1/core/impl/singleRequest.xml b/samltest/data/saml1/core/impl/singleRequest.xml new file mode 100644 index 0000000..d22410c --- /dev/null +++ b/samltest/data/saml1/core/impl/singleRequest.xml @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/singleRequestAttributes.xml b/samltest/data/saml1/core/impl/singleRequestAttributes.xml new file mode 100644 index 0000000..3cf7ba5 --- /dev/null +++ b/samltest/data/saml1/core/impl/singleRequestAttributes.xml @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/singleResponse.xml b/samltest/data/saml1/core/impl/singleResponse.xml new file mode 100644 index 0000000..c406605 --- /dev/null +++ b/samltest/data/saml1/core/impl/singleResponse.xml @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/singleResponseAttributes.xml b/samltest/data/saml1/core/impl/singleResponseAttributes.xml new file mode 100644 index 0000000..fd48ee8 --- /dev/null +++ b/samltest/data/saml1/core/impl/singleResponseAttributes.xml @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/singleStatus.xml b/samltest/data/saml1/core/impl/singleStatus.xml new file mode 100644 index 0000000..2b11e30 --- /dev/null +++ b/samltest/data/saml1/core/impl/singleStatus.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/singleStatusCode.xml b/samltest/data/saml1/core/impl/singleStatusCode.xml new file mode 100644 index 0000000..dd2926e --- /dev/null +++ b/samltest/data/saml1/core/impl/singleStatusCode.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/samltest/data/saml1/core/impl/singleStatusMessage.xml b/samltest/data/saml1/core/impl/singleStatusMessage.xml new file mode 100644 index 0000000..f1629ba --- /dev/null +++ b/samltest/data/saml1/core/impl/singleStatusMessage.xml @@ -0,0 +1 @@ + diff --git a/samltest/data/saml1/core/impl/singleSubject.xml b/samltest/data/saml1/core/impl/singleSubject.xml new file mode 100644 index 0000000..7391b8b Binary files /dev/null and b/samltest/data/saml1/core/impl/singleSubject.xml differ diff --git a/samltest/data/saml1/core/impl/singleSubjectConfirmation.xml b/samltest/data/saml1/core/impl/singleSubjectConfirmation.xml new file mode 100644 index 0000000..3195cf7 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleSubjectConfirmation.xml differ diff --git a/samltest/data/saml1/core/impl/singleSubjectConfirmationData.xml b/samltest/data/saml1/core/impl/singleSubjectConfirmationData.xml new file mode 100644 index 0000000..beadd0b Binary files /dev/null and b/samltest/data/saml1/core/impl/singleSubjectConfirmationData.xml differ diff --git a/samltest/data/saml1/core/impl/singleSubjectConfirmationDataAttributes.xml b/samltest/data/saml1/core/impl/singleSubjectConfirmationDataAttributes.xml new file mode 100644 index 0000000..f44b980 Binary files /dev/null and b/samltest/data/saml1/core/impl/singleSubjectConfirmationDataAttributes.xml differ diff --git a/samltest/data/saml1/core/impl/singleSubjectLocality.xml b/samltest/data/saml1/core/impl/singleSubjectLocality.xml new file mode 100644 index 0000000..eb86b5b Binary files /dev/null and b/samltest/data/saml1/core/impl/singleSubjectLocality.xml differ diff --git a/samltest/data/saml1/core/impl/singleSubjectLocalityAttributes.xml b/samltest/data/saml1/core/impl/singleSubjectLocalityAttributes.xml new file mode 100644 index 0000000..adb582c Binary files /dev/null and b/samltest/data/saml1/core/impl/singleSubjectLocalityAttributes.xml differ diff --git a/samltest/internal.h b/samltest/internal.h new file mode 100644 index 0000000..6707e1f --- /dev/null +++ b/samltest/internal.h @@ -0,0 +1,105 @@ +/* + * 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. + */ + +#include + +#include +#include +#include +#include +#include +#include + +using namespace opensaml; +using namespace xmltooling; +using namespace std; + +extern string data_path; + +class SAMLObjectBaseTestCase +{ +protected: + /** Location of file containing a single element with NO optional attributes */ + string singleElementFile; + + /** Location of file containing a single element with all optional attributes */ + string singleElementOptionalAttributesFile; + + /** Location of file containing a single element with child elements */ + string childElementsFile; + + /** The expected result of a marshalled single element with no optional attributes */ + DOMDocument* expectedDOM; + + /** The expected result of a marshalled single element with all optional attributes */ + DOMDocument* expectedOptionalAttributesDOM; + + /** The expected result of a marshalled single element with child elements */ + DOMDocument* expectedChildElementsDOM; + + /** + * Unmarshalls an element file into its SAML XMLObject. + * + * @return the SAML XMLObject from the file + */ + XMLObject* unmarshallElement(string elementFile) { + try { + ParserPool& p=XMLToolingConfig::getConfig().getParser(); + ifstream fs(elementFile.c_str()); + DOMDocument* doc = p.parse(fs); + const XMLObjectBuilder* b = XMLObjectBuilder::getBuilder(doc->getDocumentElement()); + return b->buildFromDocument(doc); + } + catch (XMLToolingException& e) { + TS_TRACE(e.what()); + throw; + } + } + + void assertEquals(const char* failMessage, DOMDocument* expectedDOM, XMLObject* xmlObject) { + DOMElement* generatedDOM = xmlObject->marshall(); + TSM_ASSERT(failMessage,generatedDOM->isEqualNode(expectedDOM->getDocumentElement())); + } + + void assertEquals(DOMDocument* expectedDOM, XMLObject* xmlObject) { + assertEquals("Marshalled DOM was not the same as the expected DOM", expectedDOM, xmlObject); + } + +public: + void setUp() { + ParserPool& p=XMLToolingConfig::getConfig().getParser(); + if (!singleElementFile.empty()) { + ifstream fs(singleElementFile.c_str()); + expectedDOM = p.parse(fs); + } + + if (!singleElementOptionalAttributesFile.empty()) { + ifstream fs(singleElementOptionalAttributesFile.c_str()); + expectedOptionalAttributesDOM = p.parse(fs); + } + + if (!childElementsFile.empty()) { + ifstream fs(childElementsFile.c_str()); + expectedChildElementsDOM = p.parse(fs); + } + } + + void tearDown() { + if (expectedDOM) expectedDOM->release(); + if (expectedOptionalAttributesDOM) expectedOptionalAttributesDOM->release(); + if (expectedChildElementsDOM) expectedChildElementsDOM->release(); + } +}; diff --git a/samltest/saml1/core/impl/ActionTest.cpp b/samltest/saml1/core/impl/ActionTest.cpp new file mode 100644 index 0000000..7fc76dc --- /dev/null +++ b/samltest/saml1/core/impl/ActionTest.cpp @@ -0,0 +1,45 @@ +/* Generated file, do not edit */ + +#ifndef CXXTEST_RUNNING +#define CXXTEST_RUNNING +#endif + +#define _CXXTEST_HAVE_STD +#define _CXXTEST_HAVE_EH +#define _CXXTEST_ABORT_TEST_ON_FAIL +#include +#include +#include +#include + +#include "c:\cvs\cpp-opensaml2\samltest\saml1\core\impl\ActionTest.h" + +static ActionTest suite_ActionTest; + +static CxxTest::List Tests_ActionTest = { 0, 0 }; +CxxTest::StaticSuiteDescription suiteDescription_ActionTest( "c:\\cvs\\cpp-opensaml2\\samltest\\saml1\\core\\impl\\ActionTest.h", 22, "ActionTest", suite_ActionTest, Tests_ActionTest ); + +static class TestDescription_ActionTest_testSingleElementUnmarshall : public CxxTest::RealTestDescription { +public: + TestDescription_ActionTest_testSingleElementUnmarshall() : CxxTest::RealTestDescription( Tests_ActionTest, suiteDescription_ActionTest, 44, "testSingleElementUnmarshall" ) {} + void runTest() { suite_ActionTest.testSingleElementUnmarshall(); } +} testDescription_ActionTest_testSingleElementUnmarshall; + +static class TestDescription_ActionTest_testSingleElementOptionalAttributesUnmarshall : public CxxTest::RealTestDescription { +public: + TestDescription_ActionTest_testSingleElementOptionalAttributesUnmarshall() : CxxTest::RealTestDescription( Tests_ActionTest, suiteDescription_ActionTest, 52, "testSingleElementOptionalAttributesUnmarshall" ) {} + void runTest() { suite_ActionTest.testSingleElementOptionalAttributesUnmarshall(); } +} testDescription_ActionTest_testSingleElementOptionalAttributesUnmarshall; + +static class TestDescription_ActionTest_testSingleElementMarshall : public CxxTest::RealTestDescription { +public: + TestDescription_ActionTest_testSingleElementMarshall() : CxxTest::RealTestDescription( Tests_ActionTest, suiteDescription_ActionTest, 59, "testSingleElementMarshall" ) {} + void runTest() { suite_ActionTest.testSingleElementMarshall(); } +} testDescription_ActionTest_testSingleElementMarshall; + +static class TestDescription_ActionTest_testSingleElementOptionalAttributesMarshall : public CxxTest::RealTestDescription { +public: + TestDescription_ActionTest_testSingleElementOptionalAttributesMarshall() : CxxTest::RealTestDescription( Tests_ActionTest, suiteDescription_ActionTest, 64, "testSingleElementOptionalAttributesMarshall" ) {} + void runTest() { suite_ActionTest.testSingleElementOptionalAttributesMarshall(); } +} testDescription_ActionTest_testSingleElementOptionalAttributesMarshall; + diff --git a/samltest/saml1/core/impl/ActionTest.h b/samltest/saml1/core/impl/ActionTest.h new file mode 100644 index 0000000..26e4580 --- /dev/null +++ b/samltest/saml1/core/impl/ActionTest.h @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#include "internal.h" +#include + +using namespace opensaml::saml1; + +class ActionTest : public CxxTest::TestSuite, public SAMLObjectBaseTestCase { + XMLCh* expectedContents; + XMLCh* expectedNamespace; + QName* qname; + +public: + void setUp() { + singleElementFile = data_path + "saml1/core/impl/singleAction.xml"; + singleElementOptionalAttributesFile = data_path + "saml1/core/impl/singleActionAttributes.xml"; + expectedContents = XMLString::transcode("Action Contents"); + expectedNamespace = XMLString::transcode("namespace"); + qname = new QName(SAMLConstants::SAML1_NS, Action::LOCAL_NAME, SAMLConstants::SAML1_PREFIX); + SAMLObjectBaseTestCase::setUp(); + } + + void tearDown() { + delete qname; + XMLString::release(&expectedContents); + XMLString::release(&expectedNamespace); + SAMLObjectBaseTestCase::tearDown(); + } + + void testSingleElementUnmarshall() { + auto_ptr xo(unmarshallElement(singleElementFile)); + Action* action = dynamic_cast(xo.get()); + TS_ASSERT(action!=NULL); + TSM_ASSERT("namespace attribute present", action->getNamespace()==NULL); + TSM_ASSERT("Contents present", action->getValue()==NULL); + } + + void testSingleElementOptionalAttributesUnmarshall() { + auto_ptr xo(unmarshallElement(singleElementOptionalAttributesFile)); + Action* action = dynamic_cast(xo.get()); + TSM_ASSERT_SAME_DATA("namespace attribute ", expectedNamespace, action->getNamespace(), XMLString::stringLen(expectedNamespace)); + TSM_ASSERT_SAME_DATA("Contents ", expectedContents, action->getValue(), XMLString::stringLen(expectedContents)); + } + + void testSingleElementMarshall() { + auto_ptr action(ActionBuilder::buildAction()); + assertEquals(expectedDOM, action.get()); + } + + void testSingleElementOptionalAttributesMarshall() { + auto_ptr action(ActionBuilder::buildAction()); + action->setNamespace(expectedNamespace); + action->setValue(expectedContents); + assertEquals(expectedOptionalAttributesDOM, action.get()); + } + +}; diff --git a/samltest/samltest.cpp b/samltest/samltest.cpp new file mode 100644 index 0000000..faa040e --- /dev/null +++ b/samltest/samltest.cpp @@ -0,0 +1,32 @@ +/* Generated file, do not edit */ + +#ifndef CXXTEST_RUNNING +#define CXXTEST_RUNNING +#endif + +#define _CXXTEST_HAVE_STD +#define _CXXTEST_HAVE_EH +#define _CXXTEST_ABORT_TEST_ON_FAIL +#include +#include +#include +#include +#include + +int main() { + return CxxTest::ErrorPrinter().run(); +} +#include "c:\cvs\cpp-opensaml2\samltest\samltest.h" + +static GlobalTest suite_GlobalTest; + +static CxxTest::List Tests_GlobalTest = { 0, 0 }; +CxxTest::StaticSuiteDescription suiteDescription_GlobalTest( "c:\\cvs\\cpp-opensaml2\\samltest\\samltest.h", 59, "GlobalTest", suite_GlobalTest, Tests_GlobalTest ); + +static class TestDescription_GlobalTest_testGlobal : public CxxTest::RealTestDescription { +public: + TestDescription_GlobalTest_testGlobal() : CxxTest::RealTestDescription( Tests_GlobalTest, suiteDescription_GlobalTest, 62, "testGlobal" ) {} + void runTest() { suite_GlobalTest.testGlobal(); } +} testDescription_GlobalTest_testGlobal; + +#include diff --git a/samltest/samltest.h b/samltest/samltest.h new file mode 100644 index 0000000..4033914 --- /dev/null +++ b/samltest/samltest.h @@ -0,0 +1,64 @@ +/* + * Copyright 2001-2005 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. + */ + +#include "internal.h" + +#include +#include + +//#define SAML_LEAKCHECK + +std::string data_path = "../samltest/data/"; + +class SAMLFixture : public CxxTest::GlobalFixture +{ +public: + bool setUpWorld() { + XMLToolingConfig::getConfig().log_config(); + if (!SAMLConfig::getConfig().init()) + return false; + if (getenv("SAMLTEST_DATA")) + data_path=std::string(getenv("SAMLTEST_DATA")) + "/"; + //std::string catpath=data_path + "catalog.xml"; + //auto_ptr_XMLCh temp(catpath.c_str()); + //return XMLToolingConfig::getConfig().getValidatingParser().loadCatalog(temp.get()); + return true; + } + bool tearDownWorld() { + SAMLConfig::getConfig().term(); +#if defined(_MSC_VER ) && defined(SAML_LEAKCHECK) + _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); + _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT ); + _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE ); + _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT ); + _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE ); + _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT ); + _CrtDumpMemoryLeaks(); +#endif + return true; + } + //bool setUp() { printf( "" ); return true; } + //bool tearDown() { printf( "" ); return true; } +}; + +static SAMLFixture globalFixture; + +class GlobalTest : public CxxTest::TestSuite +{ +public: + void testGlobal() { + } +}; diff --git a/samltest/samltest.vcproj b/samltest/samltest.vcproj new file mode 100644 index 0000000..bca3280 --- /dev/null +++ b/samltest/samltest.vcproj @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +