#include "internal.h"
#include "exceptions.h"
#include "saml2/metadata/Metadata.h"
+#include "saml2/metadata/MetadataKeyInfoIterator.h"
-#include <xmltooling/AbstractChildlessElement.h>
#include <xmltooling/AbstractComplexElement.h>
#include <xmltooling/AbstractElementProxy.h>
#include <xmltooling/AbstractSimpleElement.h>
using namespace xmlsignature;
using namespace xmltooling;
using namespace std;
+using xmlconstants::XMLSIG_NS;
+using xmlconstants::XML_BOOL_NULL;
+using samlconstants::SAML20_NS;
+using samlconstants::SAML20MD_NS;
#if defined (_MSC_VER)
#pragma warning( push )
class SAML_DLLLOCAL localizedNameTypeImpl : public virtual localizedNameType,
public AbstractSimpleElement,
- public AbstractChildlessElement,
public AbstractDOMCachingXMLObject,
public AbstractXMLObjectMarshaller,
public AbstractXMLObjectUnmarshaller
}
IMPL_XMLOBJECT_CLONE(localizedNameType);
- IMPL_XMLOBJECT_CONTENT;
IMPL_STRING_ATTRIB(Lang);
protected:
void marshallAttributes(DOMElement* domElement) const {
- MARSHALL_STRING_ATTRIB(Lang,LANG,XMLConstants::XML_NS);
+ MARSHALL_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS);
}
void processAttribute(const DOMAttr* attribute) {
- PROC_STRING_ATTRIB(Lang,LANG,XMLConstants::XML_NS);
+ PROC_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS);
AbstractXMLObjectUnmarshaller::processAttribute(attribute);
}
};
class SAML_DLLLOCAL localizedURITypeImpl : public virtual localizedURIType,
public AbstractSimpleElement,
- public AbstractChildlessElement,
public AbstractDOMCachingXMLObject,
public AbstractXMLObjectMarshaller,
public AbstractXMLObjectUnmarshaller
}
IMPL_XMLOBJECT_CLONE(localizedURIType);
- IMPL_XMLOBJECT_CONTENT;
IMPL_STRING_ATTRIB(Lang);
protected:
void marshallAttributes(DOMElement* domElement) const {
- MARSHALL_STRING_ATTRIB(Lang,LANG,XMLConstants::XML_NS);
+ MARSHALL_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS);
}
void processAttribute(const DOMAttr* attribute) {
- PROC_STRING_ATTRIB(Lang,LANG,XMLConstants::XML_NS);
+ PROC_STRING_ATTRIB(Lang,LANG,xmlconstants::XML_NS);
AbstractXMLObjectUnmarshaller::processAttribute(attribute);
}
};
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
// Unknown child.
const XMLCh* nsURI=root->getNamespaceURI();
- if (!XMLString::equals(nsURI,SAMLConstants::SAML20MD_NS) && nsURI && *nsURI) {
+ if (!XMLString::equals(nsURI,SAML20MD_NS) && nsURI && *nsURI) {
getXMLObjects().push_back(childXMLObject);
return;
}
}
OrganizationImpl(const OrganizationImpl& src)
- : AbstractXMLObject(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
+ : AbstractXMLObject(src), AbstractComplexElement(src),
+ AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
init();
if (src.getExtensions())
setExtensions(src.getExtensions()->cloneExtensions());
protected:
void marshallAttributes(DOMElement* domElement) const {
- // Take care of wildcard.
- for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
- DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
- if (i->first.hasPrefix())
- attr->setPrefix(i->first.getPrefix());
- attr->setNodeValue(i->second);
- domElement->setAttributeNode(attr);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(OrganizationName,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(OrganizationDisplayName,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(OrganizationURL,SAMLConstants::SAML20MD_NS,false);
+ PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(OrganizationName,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(OrganizationDisplayName,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(OrganizationURL,SAML20MD_NS,false);
AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
}
void processAttribute(const DOMAttr* attribute) {
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
}
ContactPersonImpl(const ContactPersonImpl& src)
- : AbstractXMLObject(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
+ : AbstractXMLObject(src), AbstractComplexElement(src),
+ AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
init();
if (src.getExtensions())
setExtensions(src.getExtensions()->cloneExtensions());
IMPL_TYPED_CHILDREN(EmailAddress,m_pos_TelephoneNumber);
IMPL_TYPED_CHILDREN(TelephoneNumber,m_children.end());
- void setAttribute(QName& qualifiedName, const XMLCh* value) {
+ void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
if (!qualifiedName.hasNamespaceURI()) {
if (XMLString::equals(qualifiedName.getLocalPart(),CONTACTTYPE_ATTRIB_NAME)) {
setContactType(value);
return;
}
}
- AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
+ AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
}
protected:
void marshallAttributes(DOMElement* domElement) const {
MARSHALL_STRING_ATTRIB(ContactType,CONTACTTYPE,NULL);
-
- // Take care of wildcard.
- for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
- DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
- if (i->first.hasPrefix())
- attr->setPrefix(i->first.getPrefix());
- attr->setNodeValue(i->second);
- domElement->setAttributeNode(attr);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILD(Company,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILD(GivenName,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILD(SurName,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(EmailAddress,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(TelephoneNumber,SAMLConstants::SAML20MD_NS,false);
+ PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
+ PROC_TYPED_CHILD(Company,SAML20MD_NS,false);
+ PROC_TYPED_CHILD(GivenName,SAML20MD_NS,false);
+ PROC_TYPED_CHILD(SurName,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(EmailAddress,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(TelephoneNumber,SAML20MD_NS,false);
AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
}
void processAttribute(const DOMAttr* attribute) {
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
class SAML_DLLLOCAL AdditionalMetadataLocationImpl : public virtual AdditionalMetadataLocation,
public AbstractSimpleElement,
- public AbstractChildlessElement,
public AbstractDOMCachingXMLObject,
public AbstractXMLObjectMarshaller,
public AbstractXMLObjectUnmarshaller
}
IMPL_XMLOBJECT_CLONE(AdditionalMetadataLocation);
- IMPL_XMLOBJECT_CONTENT;
IMPL_STRING_ATTRIB(Namespace);
protected:
init();
}
- KeyDescriptorImpl(const KeyDescriptorImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
+ KeyDescriptorImpl(const KeyDescriptorImpl& src)
+ : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
setUse(src.getUse());
if (src.getKeyInfo())
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature,XMLConstants::XMLSIG_NS,false);
- PROC_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption,SAMLConstants::SAML20MD_NS,false);
+ PROC_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature,XMLSIG_NS,false);
+ PROC_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption,SAML20MD_NS,false);
AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
}
IMPL_STRING_ATTRIB(Location);
IMPL_STRING_ATTRIB(ResponseLocation);
- void setAttribute(QName& qualifiedName, const XMLCh* value) {
+ void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
if (!qualifiedName.hasNamespaceURI()) {
if (XMLString::equals(qualifiedName.getLocalPart(),BINDING_ATTRIB_NAME)) {
setBinding(value);
return;
}
}
- AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
+ AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
}
protected:
void marshallAttributes(DOMElement* domElement) const {
MARSHALL_STRING_ATTRIB(Binding,BINDING,NULL);
MARSHALL_STRING_ATTRIB(Location,LOCATION,NULL);
MARSHALL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION,NULL);
-
- // Take care of wildcard.
- for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
- DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
- if (i->first.hasPrefix())
- attr->setPrefix(i->first.getPrefix());
- attr->setNodeValue(i->second);
- domElement->setAttributeNode(attr);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
// Unknown child.
const XMLCh* nsURI=root->getNamespaceURI();
- if (!XMLString::equals(nsURI,SAMLConstants::SAML20MD_NS) && nsURI && *nsURI) {
+ if (!XMLString::equals(nsURI,SAML20MD_NS) && nsURI && *nsURI) {
getXMLObjects().push_back(childXMLObject);
return;
}
-
AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
}
void processAttribute(const DOMAttr* attribute) {
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
{
void init() {
m_Index=NULL;
- m_isDefault=XMLConstants::XML_BOOL_NULL;
+ m_isDefault=XML_BOOL_NULL;
}
protected:
IMPL_INTEGER_ATTRIB(Index);
IMPL_BOOLEAN_ATTRIB(isDefault);
- void setAttribute(QName& qualifiedName, const XMLCh* value) {
+ void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
if (!qualifiedName.hasNamespaceURI()) {
if (XMLString::equals(qualifiedName.getLocalPart(),INDEX_ATTRIB_NAME)) {
setIndex(value);
return;
}
}
- EndpointTypeImpl::setAttribute(qualifiedName, value);
+ EndpointTypeImpl::setAttribute(qualifiedName, value, ID);
}
protected:
}
RoleDescriptorImpl(const RoleDescriptorImpl& src)
- : AbstractXMLObject(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
+ : AbstractXMLObject(src), AbstractComplexElement(src),
+ AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
init();
setID(src.getID());
setProtocolSupportEnumeration(src.getProtocolSupportEnumeration());
}
}
- const XMLCh* getId() const {
- return getID();
- }
-
//IMPL_TYPED_CHILD(Signature);
// Need customized setter.
protected:
m_Signature->setContentReference(new opensaml::ContentReference(*this));
}
- IMPL_STRING_ATTRIB(ID);
+ KeyInfoIterator* getKeyInfoIterator() const {
+ return new MetadataKeyInfoIterator(*this);
+ }
+
+ std::string getName() const {
+ const EntityDescriptor* parent = dynamic_cast<const EntityDescriptor*>(getParent());
+ if (parent) {
+ char* ch = toUTF8(parent->getEntityID());
+ if (ch) {
+ string s(ch);
+ delete[] ch;
+ return s;
+ }
+ }
+ return "";
+ }
+
+ IMPL_ID_ATTRIB(ID);
IMPL_STRING_ATTRIB(ProtocolSupportEnumeration);
IMPL_STRING_ATTRIB(ErrorURL);
IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
return false;
}
- void setAttribute(QName& qualifiedName, const XMLCh* value) {
+ void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
if (!qualifiedName.hasNamespaceURI()) {
if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
setID(value);
return;
}
}
- AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
+ AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
}
protected:
MARSHALL_STRING_ATTRIB(ErrorURL,ERRORURL,NULL);
MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
-
- // Take care of wildcard.
- for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
- DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
- if (i->first.hasPrefix())
- attr->setPrefix(i->first.getPrefix());
- attr->setNodeValue(i->second);
- domElement->setAttributeNode(attr);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);
- PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(KeyDescriptor,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILD(Organization,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(ContactPerson,SAMLConstants::SAML20MD_NS,false);
+ PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
+ PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(KeyDescriptor,SAML20MD_NS,false);
+ PROC_TYPED_CHILD(Organization,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(ContactPerson,SAML20MD_NS,false);
AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
}
void processAttribute(const DOMAttr* attribute) {
PROC_ID_ATTRIB(ID,ID,NULL);
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
protected:
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_CHILDREN(ArtifactResolutionService,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(SingleLogoutService,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(ManageNameIDService,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(NameIDFormat,SAMLConstants::SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(ArtifactResolutionService,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(SingleLogoutService,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(ManageNameIDService,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
RoleDescriptorImpl::processChildElement(childXMLObject,root);
}
};
list<XMLObject*>::iterator m_pos_AttributeProfile;
void init() {
- m_WantAuthnRequestsSigned=XMLConstants::XML_BOOL_NULL;
+ m_WantAuthnRequestsSigned=XML_BOOL_NULL;
m_children.push_back(NULL);
m_children.push_back(NULL);
m_children.push_back(NULL);
IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile);
IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
- void setAttribute(QName& qualifiedName, const XMLCh* value) {
+ void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
if (!qualifiedName.hasNamespaceURI()) {
if (XMLString::equals(qualifiedName.getLocalPart(),WANTAUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
setWantAuthnRequestsSigned(value);
return;
}
}
- RoleDescriptorImpl::setAttribute(qualifiedName, value);
+ RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
}
protected:
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_CHILDREN(SingleSignOnService,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(NameIDMappingService,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(AssertionIDRequestService,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(AttributeProfile,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_CHILDREN(SingleSignOnService,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(NameIDMappingService,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AttributeProfile,SAML20MD_NS,false);
+ PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
}
};
{
void init() {
m_Name=m_NameFormat=m_FriendlyName=NULL;
- m_isRequired=XMLConstants::XML_BOOL_NULL;
+ m_isRequired=XML_BOOL_NULL;
}
public:
virtual ~RequestedAttributeImpl() {
}
RequestedAttributeImpl(const RequestedAttributeImpl& src)
- : AbstractXMLObject(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
+ : AbstractXMLObject(src), AbstractComplexElement(src),
+ AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
init();
setName(src.getName());
setNameFormat(src.getNameFormat());
IMPL_BOOLEAN_ATTRIB(isRequired);
IMPL_XMLOBJECT_CHILDREN(AttributeValue,m_children.end());
- void setAttribute(QName& qualifiedName, const XMLCh* value) {
+ void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
if (!qualifiedName.hasNamespaceURI()) {
if (XMLString::equals(qualifiedName.getLocalPart(),NAME_ATTRIB_NAME)) {
setName(value);
return;
}
}
- AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
+ AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
}
protected:
MARSHALL_STRING_ATTRIB(NameFormat,NAMEFORMAT,NULL);
MARSHALL_STRING_ATTRIB(FriendlyName,FRIENDLYNAME,NULL);
MARSHALL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,NULL);
-
- // Take care of wildcard.
- for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
- DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
- if (i->first.hasPrefix())
- attr->setPrefix(i->first.getPrefix());
- attr->setNodeValue(i->second);
- domElement->setAttributeNode(attr);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
}
void processAttribute(const DOMAttr* attribute) {
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
void init() {
m_Index=NULL;
- m_isDefault=XMLConstants::XML_BOOL_NULL;
+ m_isDefault=XML_BOOL_NULL;
m_children.push_back(NULL);
m_children.push_back(NULL);
m_pos_ServiceDescription=m_children.begin();
}
AttributeConsumingServiceImpl(const AttributeConsumingServiceImpl& src)
- : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
+ : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
setIndex(src.m_Index);
isDefault(src.m_isDefault);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_CHILDREN(ServiceName,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(ServiceDescription,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(RequestedAttribute,SAMLConstants::SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(ServiceName,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(ServiceDescription,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(RequestedAttribute,SAML20MD_NS,false);
AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
}
list<XMLObject*>::iterator m_pos_AssertionConsumerService;
void init() {
- m_AuthnRequestsSigned=XMLConstants::XML_BOOL_NULL;
- m_WantAssertionsSigned=XMLConstants::XML_BOOL_NULL;
+ m_AuthnRequestsSigned=XML_BOOL_NULL;
+ m_WantAssertionsSigned=XML_BOOL_NULL;
m_children.push_back(NULL);
m_pos_AssertionConsumerService=m_pos_NameIDFormat;
++m_pos_AssertionConsumerService;
IMPL_TYPED_CHILDREN(AssertionConsumerService,m_pos_AssertionConsumerService);
IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end());
- void setAttribute(QName& qualifiedName, const XMLCh* value) {
+ void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
if (!qualifiedName.hasNamespaceURI()) {
if (XMLString::equals(qualifiedName.getLocalPart(),AUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
setAuthnRequestsSigned(value);
return;
}
}
- RoleDescriptorImpl::setAttribute(qualifiedName, value);
+ RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
}
protected:
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_CHILDREN(AssertionConsumerService,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(AttributeConsumingService,SAMLConstants::SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AssertionConsumerService,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AttributeConsumingService,SAML20MD_NS,false);
SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
}
};
protected:
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_CHILDREN(AuthnQueryService,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(AssertionIDRequestService,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(NameIDFormat,SAMLConstants::SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AuthnQueryService,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
RoleDescriptorImpl::processChildElement(childXMLObject,root);
}
};
protected:
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_CHILDREN(AuthzService,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(AssertionIDRequestService,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(NameIDFormat,SAMLConstants::SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AuthzService,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
RoleDescriptorImpl::processChildElement(childXMLObject,root);
}
};
protected:
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_CHILDREN(AttributeService,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(AssertionIDRequestService,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(NameIDFormat,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(AttributeProfile,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAMLConstants::SAML20_NS,false);
+ PROC_TYPED_CHILDREN(AttributeService,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AttributeProfile,SAML20MD_NS,false);
+ PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
RoleDescriptorImpl::processChildElement(childXMLObject,root);
}
};
class SAML_DLLLOCAL QueryDescriptorTypeImpl : public virtual QueryDescriptorType, public RoleDescriptorImpl
{
void init() {
- m_WantAssertionsSigned=XMLConstants::XML_BOOL_NULL;
+ m_WantAssertionsSigned=XML_BOOL_NULL;
m_children.push_back(NULL);
m_pos_NameIDFormat=m_pos_ContactPerson;
++m_pos_NameIDFormat;
IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned);
IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
- void setAttribute(QName& qualifiedName, const XMLCh* value) {
+ void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
if (!qualifiedName.hasNamespaceURI()) {
if (XMLString::equals(qualifiedName.getLocalPart(),WANTASSERTIONSSIGNED_ATTRIB_NAME)) {
setWantAssertionsSigned(value);
return;
}
}
- RoleDescriptorImpl::setAttribute(qualifiedName, value);
+ RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
}
protected:
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_CHILDREN(NameIDFormat,SAMLConstants::SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
RoleDescriptorImpl::processChildElement(childXMLObject,root);
}
};
protected:
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_CHILDREN(AttributeConsumingService,SAMLConstants::SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AttributeConsumingService,SAML20MD_NS,false);
QueryDescriptorTypeImpl::processChildElement(childXMLObject,root);
}
};
protected:
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_CHILDREN(ActionNamespace,SAMLConstants::SAML20MD_QUERY_EXT_NS,false);
+ PROC_TYPED_CHILDREN(ActionNamespace,samlconstants::SAML20MD_QUERY_EXT_NS,false);
QueryDescriptorTypeImpl::processChildElement(childXMLObject,root);
}
};
}
AffiliationDescriptorImpl(const AffiliationDescriptorImpl& src)
- : AbstractXMLObject(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
+ : AbstractXMLObject(src), AbstractComplexElement(src),
+ AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
init();
setID(src.getID());
setAffiliationOwnerID(src.getAffiliationOwnerID());
IMPL_XMLOBJECT_CLONE(AffiliationDescriptor);
- const XMLCh* getId() const {
- return getID();
- }
-
//IMPL_TYPED_CHILD(Signature);
// Need customized setter.
protected:
m_Signature->setContentReference(new opensaml::ContentReference(*this));
}
- IMPL_STRING_ATTRIB(ID);
+ IMPL_ID_ATTRIB(ID);
IMPL_STRING_ATTRIB(AffiliationOwnerID);
IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
IMPL_DATETIME_ATTRIB(CacheDuration,0);
IMPL_TYPED_CHILDREN(AffiliateMember,m_pos_AffiliateMember);
IMPL_TYPED_CHILDREN(KeyDescriptor,m_children.end());
- void setAttribute(QName& qualifiedName, const XMLCh* value) {
+ void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
if (!qualifiedName.hasNamespaceURI()) {
if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
setID(value);
return;
}
}
- AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
+ AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
}
protected:
MARSHALL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID,NULL);
MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
-
- // Take care of wildcard.
- for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
- DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
- if (i->first.hasPrefix())
- attr->setPrefix(i->first.getPrefix());
- attr->setNodeValue(i->second);
- domElement->setAttributeNode(attr);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);
- PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(AffiliateMember,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(KeyDescriptor,SAMLConstants::SAML20MD_NS,false);
+ PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
+ PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AffiliateMember,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(KeyDescriptor,SAML20MD_NS,false);
AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
}
void processAttribute(const DOMAttr* attribute) {
PROC_ID_ATTRIB(ID,ID,NULL);
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
}
EntityDescriptorImpl(const EntityDescriptorImpl& src)
- : AbstractXMLObject(src), AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
+ : AbstractXMLObject(src), AbstractComplexElement(src),
+ AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
init();
setID(src.getID());
setEntityID(src.getEntityID());
IMPL_XMLOBJECT_CLONE(EntityDescriptor);
- const XMLCh* getId() const {
- return getID();
- }
-
//IMPL_TYPED_CHILD(Signature);
// Need customized setter.
protected:
m_Signature->setContentReference(new opensaml::ContentReference(*this));
}
- IMPL_STRING_ATTRIB(ID);
+ IMPL_ID_ATTRIB(ID);
IMPL_STRING_ATTRIB(EntityID);
IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
IMPL_DATETIME_ATTRIB(CacheDuration,0);
IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson);
IMPL_TYPED_CHILDREN(AdditionalMetadataLocation,m_children.end());
- void setAttribute(QName& qualifiedName, const XMLCh* value) {
+ void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) {
if (!qualifiedName.hasNamespaceURI()) {
if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
setID(value);
return;
}
}
- AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
+ AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
}
const IDPSSODescriptor* getIDPSSODescriptor(const XMLCh* protocol) const {
return NULL;
}
- const RoleDescriptor* getRoleDescriptor(xmltooling::QName& qname, const XMLCh* protocol) const {
+ const RoleDescriptor* getRoleDescriptor(const xmltooling::QName& qname, const XMLCh* protocol) const {
+ // Check for "known" elements/types.
+ QName q;
+ q.setNamespaceURI(SAML20MD_NS);
+ q.setLocalPart(IDPSSODescriptor::LOCAL_NAME);
+ if (q == qname)
+ return getIDPSSODescriptor(protocol);
+ q.setLocalPart(SPSSODescriptor::LOCAL_NAME);
+ if (q == qname)
+ return getSPSSODescriptor(protocol);
+ q.setLocalPart(AuthnAuthorityDescriptor::LOCAL_NAME);
+ if (q == qname)
+ return getAuthnAuthorityDescriptor(protocol);
+ q.setLocalPart(AttributeAuthorityDescriptor::LOCAL_NAME);
+ if (q == qname)
+ return getAttributeAuthorityDescriptor(protocol);
+ q.setLocalPart(PDPDescriptor::LOCAL_NAME);
+ if (q == qname)
+ return getPDPDescriptor(protocol);
+ q.setNamespaceURI(samlconstants::SAML20MD_QUERY_EXT_NS);
+ q.setLocalPart(AuthnQueryDescriptorType::TYPE_NAME);
+ if (q == qname)
+ return getAuthnQueryDescriptorType(protocol);
+ q.setLocalPart(AttributeQueryDescriptorType::TYPE_NAME);
+ if (q == qname)
+ return getAttributeQueryDescriptorType(protocol);
+ q.setLocalPart(AuthzDecisionQueryDescriptorType::TYPE_NAME);
+ if (q == qname)
+ return getAuthzDecisionQueryDescriptorType(protocol);
+
for (vector<RoleDescriptor*>::const_iterator i=m_RoleDescriptors.begin(); i!=m_RoleDescriptors.end(); i++) {
if ((*i)->getSchemaType() && qname==(*((*i)->getSchemaType())) && (*i)->hasSupport(protocol) && (*i)->isValid())
return (*i);
MARSHALL_STRING_ATTRIB(EntityID,ENTITYID,NULL);
MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,NULL);
MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,NULL);
-
- // Take care of wildcard.
- for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
- DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
- if (i->first.hasPrefix())
- attr->setPrefix(i->first.getPrefix());
- attr->setNodeValue(i->second);
- domElement->setAttributeNode(attr);
- }
+ marshallExtensionAttributes(domElement);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);
- PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(IDPSSODescriptor,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(SPSSODescriptor,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(AuthnAuthorityDescriptor,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(AttributeAuthorityDescriptor,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(PDPDescriptor,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(AuthnQueryDescriptorType,SAMLConstants::SAML20MD_QUERY_EXT_NS,false);
- PROC_TYPED_CHILDREN(AttributeQueryDescriptorType,SAMLConstants::SAML20MD_QUERY_EXT_NS,false);
- PROC_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType,SAMLConstants::SAML20MD_QUERY_EXT_NS,false);
- PROC_TYPED_CHILDREN(RoleDescriptor,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILD(AffiliationDescriptor,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILD(Organization,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(ContactPerson,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(AdditionalMetadataLocation,SAMLConstants::SAML20MD_NS,false);
+ PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
+ PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(IDPSSODescriptor,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(SPSSODescriptor,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AuthnAuthorityDescriptor,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AttributeAuthorityDescriptor,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(PDPDescriptor,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AuthnQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
+ PROC_TYPED_CHILDREN(AttributeQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
+ PROC_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
+ PROC_TYPED_CHILDREN(RoleDescriptor,SAML20MD_NS,false);
+ PROC_TYPED_CHILD(AffiliationDescriptor,SAML20MD_NS,false);
+ PROC_TYPED_CHILD(Organization,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(ContactPerson,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(AdditionalMetadataLocation,SAML20MD_NS,false);
AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
}
void processAttribute(const DOMAttr* attribute) {
PROC_ID_ATTRIB(ID,ID,NULL);
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
+ unmarshallExtensionAttribute(attribute);
}
};
init();
}
- EntitiesDescriptorImpl(const EntitiesDescriptorImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src) {
+ EntitiesDescriptorImpl(const EntitiesDescriptorImpl& src)
+ : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
init();
setID(src.getID());
setName(src.getName());
IMPL_XMLOBJECT_CLONE(EntitiesDescriptor);
- const XMLCh* getId() const {
- return getID();
- }
-
//IMPL_TYPED_CHILD(Signature);
// Need customized setter.
protected:
m_Signature->setContentReference(new opensaml::ContentReference(*this));
}
- IMPL_STRING_ATTRIB(ID);
+ IMPL_ID_ATTRIB(ID);
IMPL_STRING_ATTRIB(Name);
IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
IMPL_DATETIME_ATTRIB(CacheDuration,0);
}
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLConstants::XMLSIG_NS,false);
- PROC_TYPED_CHILD(Extensions,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(EntityDescriptor,SAMLConstants::SAML20MD_NS,false);
- PROC_TYPED_CHILDREN(EntitiesDescriptor,SAMLConstants::SAML20MD_NS,false);
+ PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
+ PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(EntityDescriptor,SAML20MD_NS,false);
+ PROC_TYPED_CHILDREN(EntitiesDescriptor,SAML20MD_NS,false);
AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
}