saml2/core/Protocols.h
saml2mdinclude_HEADERS = \
- saml2/metadata/Metadata.h
+ saml2/metadata/Metadata.h \
+ saml2/metadata/MetadataFilter.h \
+ saml2/metadata/MetadataProvider.h \
+ saml2/metadata/MetadataResolver.h
noinst_HEADERS = \
internal.h
saml2/core/impl/Assertions20SchemaValidators.cpp \
saml2/core/impl/Protocols20Impl.cpp \
saml2/metadata/impl/MetadataImpl.cpp \
+ saml2/metadata/impl/MetadataProvider.cpp \
saml2/metadata/impl/MetadataSchemaValidators.cpp \
signature/ContentReference.cpp \
signature/SignatureProfileValidator.cpp \
RelativePath=".\saml2\core\Assertions.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath=".\saml2\core\Protocols.h"\r
+ >\r
+ </File>\r
</Filter>\r
<Filter\r
Name="metadata"\r
public AbstractXMLObjectUnmarshaller
{
void init() {
- m_MinorVersion=1;
+ m_MinorVersion=NULL;
m_AssertionID=NULL;
m_Issuer=NULL;
m_IssueInstant=NULL;
}
public:
virtual ~AssertionImpl() {
+ XMLString::release(&m_MinorVersion);
XMLString::release(&m_AssertionID);
XMLString::release(&m_Issuer);
delete m_IssueInstant;
AbstractDOMCachingXMLObject(src),
AbstractValidatingXMLObject(src) {
init();
- setMinorVersion(src.getMinorVersion());
+ setMinorVersion(src.m_MinorVersion);
setAssertionID(src.getAssertionID());
setIssuer(src.getIssuer());
setIssueInstant(src.getIssueInstant());
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);
+ domElement->setAttributeNS(NULL,MAJORVERSION,XMLConstants::XML_ONE);
+ if (!m_MinorVersion)
+ const_cast<AssertionImpl*>(this)->m_MinorVersion=XMLString::replicate(XMLConstants::XML_ONE);
MARSHALL_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
if (!m_AssertionID)
const_cast<AssertionImpl*>(this)->m_AssertionID=SAMLConfig::getConfig().generateIdentifier();
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)
+ if (!XMLString::equals(attribute->getValue(),XMLConstants::XML_ONE))
throw UnmarshallingException("Assertion has invalid major version.");
}
PROC_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
ptr->getSubjectStatements().empty() &&
ptr->getStatements().empty())
throw ValidationException("Assertion must have at least one statement.");
- if (ptr->getMinorVersion()==0 && ptr->getConditions() && !ptr->getConditions()->getDoNotCacheConditions().empty())
+ pair<bool,int> minor=ptr->getMinorVersion();
+ if (!minor.first)
+ throw ValidationException("Assertion must have MinorVersion");
+ if (minor.second==0 && ptr->getConditions() && !ptr->getConditions()->getDoNotCacheConditions().empty())
throw ValidationException("SAML 1.0 assertions cannot contain DoNotCacheCondition elements.");
END_XMLOBJECTVALIDATOR;
public AbstractXMLObjectUnmarshaller
{
void init() {
- m_MinorVersion=1;
+ m_MinorVersion=NULL;
m_RequestID=NULL;
m_IssueInstant=NULL;
m_children.push_back(NULL);
}
public:
virtual ~RequestAbstractTypeImpl() {
+ XMLString::release(&m_MinorVersion);
XMLString::release(&m_RequestID);
delete m_IssueInstant;
}
AbstractDOMCachingXMLObject(src),
AbstractValidatingXMLObject(src) {
init();
- setMinorVersion(src.getMinorVersion());
+ setMinorVersion(src.m_MinorVersion);
setRequestID(src.getRequestID());
setIssueInstant(src.getIssueInstant());
if (src.getSignature())
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);
+ domElement->setAttributeNS(NULL,MAJORVERSION,XMLConstants::XML_ONE);
+ if (!m_MinorVersion)
+ const_cast<RequestAbstractTypeImpl*>(this)->m_MinorVersion=XMLString::replicate(XMLConstants::XML_ONE);
MARSHALL_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
if (!m_RequestID)
const_cast<RequestAbstractTypeImpl*>(this)->m_RequestID=SAMLConfig::getConfig().generateIdentifier();
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)
+ if (!XMLString::equals(attribute->getValue(),XMLConstants::XML_ONE))
throw UnmarshallingException("Request has invalid major version.");
}
PROC_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
public AbstractXMLObjectUnmarshaller
{
void init() {
- m_MinorVersion=1;
+ m_MinorVersion=NULL;
m_ResponseID=NULL;
m_InResponseTo=NULL;
m_IssueInstant=NULL;
}
public:
virtual ~ResponseAbstractTypeImpl() {
+ XMLString::release(&m_MinorVersion);
XMLString::release(&m_ResponseID);
XMLString::release(&m_InResponseTo);
XMLString::release(&m_Recipient);
AbstractDOMCachingXMLObject(src),
AbstractValidatingXMLObject(src) {
init();
- setMinorVersion(src.getMinorVersion());
+ setMinorVersion(src.m_MinorVersion);
setResponseID(src.getResponseID());
setInResponseTo(src.getInResponseTo());
setIssueInstant(src.getIssueInstant());
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);
+ domElement->setAttributeNS(NULL,MAJORVERSION,XMLConstants::XML_ONE);
+ if (!m_MinorVersion)
+ const_cast<ResponseAbstractTypeImpl*>(this)->m_MinorVersion=XMLString::replicate(XMLConstants::XML_ONE);
MARSHALL_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
if (!m_ResponseID)
const_cast<ResponseAbstractTypeImpl*>(this)->m_ResponseID=SAMLConfig::getConfig().generateIdentifier();
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)
+ if (!XMLString::equals(attribute->getValue(),XMLConstants::XML_ONE))
throw UnmarshallingException("Response has invalid major version.");
}
PROC_INTEGER_ATTRIB(MinorVersion,MINORVERSION,NULL);
BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Request);
XMLOBJECTVALIDATOR_REQUIRE(Request,RequestID);
XMLOBJECTVALIDATOR_REQUIRE(Request,IssueInstant);
- int count=0;
+ pair<bool,int> minor=ptr->getMinorVersion();
+ if (!minor.first)
+ throw ValidationException("Request must have MinorVersion");
+ int count=0;
if (ptr->getQuery()!=NULL)
count++;
if (!ptr->getAssertionIDReferences().empty())
XMLOBJECTVALIDATOR_REQUIRE(Response,ResponseID);
XMLOBJECTVALIDATOR_REQUIRE(Response,IssueInstant);
XMLOBJECTVALIDATOR_REQUIRE(Response,Status);
+ pair<bool,int> minor=ptr->getMinorVersion();
+ if (!minor.first)
+ throw ValidationException("Response must have MinorVersion");
END_XMLOBJECTVALIDATOR;
};
};
public AbstractXMLObjectUnmarshaller
{
public:
- virtual ~ProxyRestrictionImpl() {}
+ virtual ~ProxyRestrictionImpl() {
+ XMLString::release(&m_Count);
+ }
ProxyRestrictionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
: AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+ m_Count=NULL;
}
ProxyRestrictionImpl(const ProxyRestrictionImpl& src)
: AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
- setCount(src.getCount());
+ setCount(src.m_Count);
VectorOf(Audience) v=getAudiences();
for (vector<Audience*>::const_iterator i=src.m_Audiences.begin(); i!=src.m_Audiences.end(); i++) {
if (*i) {
BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,ProxyRestriction);
if (ptr->getAudiences().empty()) {
- XMLOBJECTVALIDATOR_REQUIRE(ProxyRestriction,Count);
+ XMLOBJECTVALIDATOR_REQUIRE_INTEGER(ProxyRestriction,Count);
}
END_XMLOBJECTVALIDATOR;
class SAML_DLLLOCAL IndexedEndpointTypeImpl : public virtual IndexedEndpointType, public EndpointTypeImpl
{
void init() {
- m_Index=0;
- m_isDefault=false;
+ m_Index=NULL;
+ m_isDefault=XMLConstants::XML_BOOL_NULL;
}
protected:
init();
}
public:
- virtual ~IndexedEndpointTypeImpl() {}
+ virtual ~IndexedEndpointTypeImpl() {
+ XMLString::release(&m_Index);
+ }
IndexedEndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
: AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
IndexedEndpointTypeImpl(const IndexedEndpointTypeImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {
- setIndex(src.getIndex());
- isDefault(src.isDefault());
+ setIndex(src.m_Index);
+ isDefault(src.m_isDefault);
}
IMPL_XMLOBJECT_CLONE(IndexedEndpointType);
void setAttribute(QName& qualifiedName, const XMLCh* value) {
if (!qualifiedName.hasNamespaceURI()) {
if (XMLString::equals(qualifiedName.getLocalPart(),INDEX_ATTRIB_NAME)) {
- setIndex(XMLString::parseInt(value));
+ setIndex(value);
return;
}
else if (XMLString::equals(qualifiedName.getLocalPart(),ISDEFAULT_ATTRIB_NAME)) {
- if (value) {
- if (*value==chLatin_t || *value==chDigit_1)
- isDefault(true);
- else if (*value==chLatin_f || *value==chDigit_0)
- isDefault(false);
- }
+ setisDefault(value);
return;
}
}
list<XMLObject*>::iterator m_pos_AttributeProfile;
void init() {
- m_WantAuthnRequestsSigned=false;
+ m_WantAuthnRequestsSigned=XMLConstants::XML_BOOL_NULL;
m_children.push_back(NULL);
m_children.push_back(NULL);
m_children.push_back(NULL);
IDPSSODescriptorImpl(const IDPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
init();
- WantAuthnRequestsSigned(src.WantAuthnRequestsSigned());
+ WantAuthnRequestsSigned(src.m_WantAuthnRequestsSigned);
VectorOf(SingleSignOnService) v=getSingleSignOnServices();
for (vector<SingleSignOnService*>::const_iterator i=src.m_SingleSignOnServices.begin(); i!=src.m_SingleSignOnServices.end(); i++) {
if (*i) {
void setAttribute(QName& qualifiedName, const XMLCh* value) {
if (!qualifiedName.hasNamespaceURI()) {
if (XMLString::equals(qualifiedName.getLocalPart(),WANTAUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
- if (value) {
- if (*value==chLatin_t || *value==chDigit_1)
- WantAuthnRequestsSigned(true);
- else if (*value==chLatin_f || *value==chDigit_0)
- WantAuthnRequestsSigned(false);
- }
+ setWantAuthnRequestsSigned(value);
return;
}
}
{
void init() {
m_Name=m_NameFormat=m_FriendlyName=NULL;
- m_isRequired=false;
+ m_isRequired=XMLConstants::XML_BOOL_NULL;
}
public:
virtual ~RequestedAttributeImpl() {
setName(src.getName());
setNameFormat(src.getNameFormat());
setFriendlyName(src.getFriendlyName());
- isRequired(src.isRequired());
+ isRequired(src.m_isRequired);
VectorOf(XMLObject) v=getAttributeValues();
for (vector<XMLObject*>::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) {
if (*i) {
return;
}
else if (XMLString::equals(qualifiedName.getLocalPart(),ISREQUIRED_ATTRIB_NAME)) {
- if (value) {
- if (*value==chLatin_t || *value==chDigit_1)
- isRequired(true);
- else if (*value==chLatin_f || *value==chDigit_0)
- isRequired(false);
- }
+ setisRequired(value);
return;
}
}
list<XMLObject*>::iterator m_pos_RequestedAttribute;
void init() {
- m_Index=1;
- m_isDefault=false;
+ m_Index=NULL;
+ m_isDefault=XMLConstants::XML_BOOL_NULL;
m_children.push_back(NULL);
m_children.push_back(NULL);
m_pos_ServiceDescription=m_children.begin();
}
public:
- virtual ~AttributeConsumingServiceImpl() {}
+ virtual ~AttributeConsumingServiceImpl() {
+ XMLString::release(&m_Index);
+ }
AttributeConsumingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
: AbstractXMLObject(nsURI, localName, prefix, schemaType) {
AttributeConsumingServiceImpl(const AttributeConsumingServiceImpl& src)
: AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
init();
- setIndex(src.getIndex());
- isDefault(src.isDefault());
+ setIndex(src.m_Index);
+ isDefault(src.m_isDefault);
VectorOf(ServiceName) v=getServiceNames();
for (vector<ServiceName*>::const_iterator i=src.m_ServiceNames.begin(); i!=src.m_ServiceNames.end(); i++) {
if (*i) {
list<XMLObject*>::iterator m_pos_AssertionConsumerService;
void init() {
- m_AuthnRequestsSigned=false;
- m_WantAssertionsSigned=false;
+ m_AuthnRequestsSigned=XMLConstants::XML_BOOL_NULL;
+ m_WantAssertionsSigned=XMLConstants::XML_BOOL_NULL;
m_children.push_back(NULL);
m_pos_AssertionConsumerService=m_pos_NameIDFormat;
++m_pos_AssertionConsumerService;
SPSSODescriptorImpl(const SPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
init();
- AuthnRequestsSigned(src.AuthnRequestsSigned());
- WantAssertionsSigned(src.WantAssertionsSigned());
+ AuthnRequestsSigned(src.m_AuthnRequestsSigned);
+ WantAssertionsSigned(src.m_WantAssertionsSigned);
VectorOf(AssertionConsumerService) v=getAssertionConsumerServices();
for (vector<AssertionConsumerService*>::const_iterator i=src.m_AssertionConsumerServices.begin(); i!=src.m_AssertionConsumerServices.end(); i++) {
if (*i) {
void setAttribute(QName& qualifiedName, const XMLCh* value) {
if (!qualifiedName.hasNamespaceURI()) {
if (XMLString::equals(qualifiedName.getLocalPart(),AUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
- if (value) {
- if (*value==chLatin_t || *value==chDigit_1)
- AuthnRequestsSigned(true);
- else if (*value==chLatin_f || *value==chDigit_0)
- AuthnRequestsSigned(false);
- }
+ setAuthnRequestsSigned(value);
return;
}
else if (XMLString::equals(qualifiedName.getLocalPart(),WANTASSERTIONSSIGNED_ATTRIB_NAME)) {
- if (value) {
- if (*value==chLatin_t || *value==chDigit_1)
- WantAssertionsSigned(true);
- else if (*value==chLatin_f || *value==chDigit_0)
- WantAssertionsSigned(false);
- }
+ setWantAssertionsSigned(value);
return;
}
}
BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,IndexedEndpointType,EndpointType);
EndpointTypeSchemaValidator::validate(xmlObject);
- XMLOBJECTVALIDATOR_REQUIRE(IndexedEndpointType,Index);
+ XMLOBJECTVALIDATOR_REQUIRE_INTEGER(IndexedEndpointType,Index);
END_XMLOBJECTVALIDATOR;
BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,ArtifactResolutionService,IndexedEndpointType);
END_XMLOBJECTVALIDATOR;
BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,AttributeConsumingService);
- XMLOBJECTVALIDATOR_REQUIRE(AttributeConsumingService,Index);
+ XMLOBJECTVALIDATOR_REQUIRE_INTEGER(AttributeConsumingService,Index);
XMLOBJECTVALIDATOR_NONEMPTY(AttributeConsumingService,ServiceName);
XMLOBJECTVALIDATOR_NONEMPTY(AttributeConsumingService,RequestedAttribute);
END_XMLOBJECTVALIDATOR;
TSM_ASSERT_SAME_DATA("Issuer attribute", expectedIssuer, assertion.getIssuer(), XMLString::stringLen(expectedIssuer));\r
TSM_ASSERT_SAME_DATA("IssueInstant attribute", expectedIssueInstant, assertion.getIssueInstant()->getRawData(), XMLString::stringLen(expectedIssueInstant));\r
TSM_ASSERT_SAME_DATA("ID attribute", expectedID, assertion.getAssertionID(), XMLString::stringLen(expectedID));\r
- TSM_ASSERT_EQUALS("Issuer expectedMinorVersion", expectedMinorVersion, assertion.getMinorVersion());\r
+ TSM_ASSERT_EQUALS("Issuer expectedMinorVersion", expectedMinorVersion, assertion.getMinorVersion().second);\r
\r
TSM_ASSERT("Conditions element", assertion.getConditions()==NULL);\r
TSM_ASSERT("Advice element", assertion.getAdvice()==NULL);\r