2 * Copyright 2001-2010 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 * Implementation classes for SAML 2.0 Metadata schema.
24 #include "exceptions.h"
25 #include "saml2/metadata/Metadata.h"
26 #include "signature/ContentReference.h"
28 #include <xmltooling/AbstractComplexElement.h>
29 #include <xmltooling/AbstractSimpleElement.h>
30 #include <xmltooling/XMLToolingConfig.h>
31 #include <xmltooling/encryption/Encryption.h>
32 #include <xmltooling/impl/AnyElement.h>
33 #include <xmltooling/io/AbstractXMLObjectMarshaller.h>
34 #include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
35 #include <xmltooling/security/CredentialCriteria.h>
36 #include <xmltooling/security/CredentialResolver.h>
37 #include <xmltooling/signature/KeyInfo.h>
38 #include <xmltooling/signature/Signature.h>
39 #include <xmltooling/util/DateTime.h>
40 #include <xmltooling/util/XMLHelper.h>
43 #include <xercesc/util/XMLUniDefs.hpp>
44 #include <xsec/framework/XSECDefs.hpp>
46 using namespace samlconstants;
47 using namespace opensaml::saml2md;
48 using namespace opensaml::saml2;
49 using namespace xmlencryption;
50 using namespace xmlsignature;
51 using namespace xmltooling;
53 using xmlconstants::XMLSIG_NS;
54 using xmlconstants::XML_BOOL_NULL;
56 #if defined (_MSC_VER)
57 #pragma warning( push )
58 #pragma warning( disable : 4250 4251 )
64 DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AffiliateMember);
65 DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,AttributeProfile);
66 DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,Company);
67 DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,EmailAddress);
68 DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,GivenName);
69 DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,NameIDFormat);
70 DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,SurName);
71 DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,TelephoneNumber);
73 DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,ActionNamespace);
74 DECL_XMLOBJECTIMPL_SIMPLE(SAML_DLLLOCAL,SourceID);
76 class SAML_DLLLOCAL localizedNameTypeImpl : public virtual localizedNameType,
77 public AbstractSimpleElement,
78 public AbstractDOMCachingXMLObject,
79 public AbstractXMLObjectMarshaller,
80 public AbstractXMLObjectUnmarshaller
88 localizedNameTypeImpl() {
93 virtual ~localizedNameTypeImpl() {
94 XMLString::release(&m_Lang);
95 XMLString::release(&m_LangPrefix);
98 localizedNameTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
99 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
103 localizedNameTypeImpl(const localizedNameTypeImpl& src)
104 : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
106 setLang(src.getLang());
107 if (src.m_LangPrefix)
108 m_LangPrefix = XMLString::replicate(src.m_LangPrefix);
111 IMPL_XMLOBJECT_CLONE(localizedNameType);
112 IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh);
115 void marshallAttributes(DOMElement* domElement) const {
116 if (m_Lang && *m_Lang) {
117 DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS,LANG_ATTRIB_NAME);
118 if (m_LangPrefix && *m_LangPrefix)
119 attr->setPrefix(m_LangPrefix);
120 attr->setNodeValue(m_Lang);
121 domElement->setAttributeNodeNS(attr);
125 void processAttribute(const DOMAttr* attribute) {
126 if (XMLHelper::isNodeNamed(attribute, xmlconstants::XML_NS, LANG_ATTRIB_NAME)) {
127 setLang(attribute->getValue());
128 const XMLCh* temp = attribute->getPrefix();
129 if (temp && *temp && !XMLString::equals(temp, xmlconstants::XML_NS))
130 m_LangPrefix = XMLString::replicate(temp);
133 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
137 class SAML_DLLLOCAL localizedURITypeImpl : public virtual localizedURIType,
138 public AbstractSimpleElement,
139 public AbstractDOMCachingXMLObject,
140 public AbstractXMLObjectMarshaller,
141 public AbstractXMLObjectUnmarshaller
145 m_LangPrefix=nullptr;
149 localizedURITypeImpl() {
154 virtual ~localizedURITypeImpl() {
155 XMLString::release(&m_Lang);
156 XMLString::release(&m_LangPrefix);
159 localizedURITypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
160 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
164 localizedURITypeImpl(const localizedURITypeImpl& src)
165 : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
167 setLang(src.getLang());
168 if (src.m_LangPrefix)
169 m_LangPrefix = XMLString::replicate(src.m_LangPrefix);
172 IMPL_XMLOBJECT_CLONE(localizedURIType);
173 IMPL_XMLOBJECT_FOREIGN_ATTRIB(Lang,XMLCh);
176 void marshallAttributes(DOMElement* domElement) const {
177 if (m_Lang && *m_Lang) {
178 DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(xmlconstants::XML_NS,LANG_ATTRIB_NAME);
179 if (m_LangPrefix && *m_LangPrefix)
180 attr->setPrefix(m_LangPrefix);
181 attr->setNodeValue(m_Lang);
182 domElement->setAttributeNodeNS(attr);
186 void processAttribute(const DOMAttr* attribute) {
187 if (XMLHelper::isNodeNamed(attribute, xmlconstants::XML_NS, LANG_ATTRIB_NAME)) {
188 setLang(attribute->getValue());
189 const XMLCh* temp = attribute->getPrefix();
190 if (temp && *temp && !XMLString::equals(temp, xmlconstants::XML_NS))
191 m_LangPrefix = XMLString::replicate(temp);
194 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
198 class SAML_DLLLOCAL OrganizationNameImpl : public virtual OrganizationName, public localizedNameTypeImpl
201 virtual ~OrganizationNameImpl() {}
203 OrganizationNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
204 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
206 OrganizationNameImpl(const OrganizationNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
208 IMPL_XMLOBJECT_CLONE(OrganizationName);
209 localizedNameType* clonelocalizedNameType() const {
210 return new OrganizationNameImpl(*this);
214 class SAML_DLLLOCAL OrganizationDisplayNameImpl : public virtual OrganizationDisplayName, public localizedNameTypeImpl
217 virtual ~OrganizationDisplayNameImpl() {}
219 OrganizationDisplayNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
220 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
222 OrganizationDisplayNameImpl(const OrganizationDisplayNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
224 IMPL_XMLOBJECT_CLONE(OrganizationDisplayName);
225 localizedNameType* clonelocalizedNameType() const {
226 return new OrganizationDisplayNameImpl(*this);
230 class SAML_DLLLOCAL OrganizationURLImpl : public virtual OrganizationURL, public localizedURITypeImpl
233 virtual ~OrganizationURLImpl() {}
235 OrganizationURLImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
236 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
238 OrganizationURLImpl(const OrganizationURLImpl& src) : AbstractXMLObject(src), localizedURITypeImpl(src) {}
240 IMPL_XMLOBJECT_CLONE(OrganizationURL);
241 localizedURIType* clonelocalizedURIType() const {
242 return new OrganizationURLImpl(*this);
246 class SAML_DLLLOCAL ServiceNameImpl : public virtual ServiceName, public localizedNameTypeImpl
249 virtual ~ServiceNameImpl() {}
251 ServiceNameImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
252 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
254 ServiceNameImpl(const ServiceNameImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
256 IMPL_XMLOBJECT_CLONE(ServiceName);
257 localizedNameType* clonelocalizedNameType() const {
258 return new ServiceNameImpl(*this);
262 class SAML_DLLLOCAL ServiceDescriptionImpl : public virtual ServiceDescription, public localizedNameTypeImpl
265 virtual ~ServiceDescriptionImpl() {}
267 ServiceDescriptionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
268 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
270 ServiceDescriptionImpl(const ServiceDescriptionImpl& src) : AbstractXMLObject(src), localizedNameTypeImpl(src) {}
272 IMPL_XMLOBJECT_CLONE(ServiceDescription);
273 localizedNameType* clonelocalizedNameType() const {
274 return new ServiceDescriptionImpl(*this);
278 class SAML_DLLLOCAL ExtensionsImpl : public virtual Extensions,
279 public AbstractComplexElement,
280 public AbstractDOMCachingXMLObject,
281 public AbstractXMLObjectMarshaller,
282 public AbstractXMLObjectUnmarshaller
285 virtual ~ExtensionsImpl() {}
287 ExtensionsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
288 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
291 ExtensionsImpl(const ExtensionsImpl& src)
292 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
293 VectorOf(XMLObject) v=getUnknownXMLObjects();
294 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
295 v.push_back((*i)->clone());
298 IMPL_XMLOBJECT_CLONE(Extensions);
299 IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
302 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
304 const XMLCh* nsURI=root->getNamespaceURI();
305 if (!XMLString::equals(nsURI,SAML20MD_NS) && nsURI && *nsURI) {
306 getUnknownXMLObjects().push_back(childXMLObject);
310 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
314 class SAML_DLLLOCAL OrganizationImpl : public virtual Organization,
315 public AbstractComplexElement,
316 public AbstractAttributeExtensibleXMLObject,
317 public AbstractDOMCachingXMLObject,
318 public AbstractXMLObjectMarshaller,
319 public AbstractXMLObjectUnmarshaller
321 list<XMLObject*>::iterator m_pos_OrganizationDisplayName;
322 list<XMLObject*>::iterator m_pos_OrganizationURL;
325 m_children.push_back(nullptr);
326 m_children.push_back(nullptr);
327 m_children.push_back(nullptr);
328 m_Extensions=nullptr;
329 m_pos_Extensions=m_children.begin();
330 m_pos_OrganizationDisplayName=m_pos_Extensions;
331 ++m_pos_OrganizationDisplayName;
332 m_pos_OrganizationURL=m_pos_OrganizationDisplayName;
333 ++m_pos_OrganizationURL;
336 virtual ~OrganizationImpl() {}
338 OrganizationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
339 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
343 OrganizationImpl(const OrganizationImpl& src)
344 : AbstractXMLObject(src), AbstractComplexElement(src),
345 AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
347 if (src.getExtensions())
348 setExtensions(src.getExtensions()->cloneExtensions());
349 VectorOf(OrganizationName) v=getOrganizationNames();
350 for (vector<OrganizationName*>::const_iterator i=src.m_OrganizationNames.begin(); i!=src.m_OrganizationNames.end(); i++) {
352 v.push_back((*i)->cloneOrganizationName());
355 VectorOf(OrganizationDisplayName) w=getOrganizationDisplayNames();
356 for (vector<OrganizationDisplayName*>::const_iterator j=src.m_OrganizationDisplayNames.begin(); j!=src.m_OrganizationDisplayNames.end(); j++) {
358 w.push_back((*j)->cloneOrganizationDisplayName());
361 VectorOf(OrganizationURL) x=getOrganizationURLs();
362 for (vector<OrganizationURL*>::const_iterator k=src.m_OrganizationURLs.begin(); k!=src.m_OrganizationURLs.end(); k++) {
364 x.push_back((*k)->cloneOrganizationURL());
369 IMPL_XMLOBJECT_CLONE(Organization);
370 IMPL_TYPED_CHILD(Extensions);
371 IMPL_TYPED_CHILDREN(OrganizationName,m_pos_OrganizationDisplayName);
372 IMPL_TYPED_CHILDREN(OrganizationDisplayName,m_pos_OrganizationURL);
373 IMPL_TYPED_CHILDREN(OrganizationURL,m_children.end());
376 void marshallAttributes(DOMElement* domElement) const {
377 marshallExtensionAttributes(domElement);
380 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
381 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
382 PROC_TYPED_CHILDREN(OrganizationName,SAML20MD_NS,false);
383 PROC_TYPED_CHILDREN(OrganizationDisplayName,SAML20MD_NS,false);
384 PROC_TYPED_CHILDREN(OrganizationURL,SAML20MD_NS,false);
385 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
388 void processAttribute(const DOMAttr* attribute) {
389 unmarshallExtensionAttribute(attribute);
393 class SAML_DLLLOCAL ContactPersonImpl : public virtual ContactPerson,
394 public AbstractComplexElement,
395 public AbstractAttributeExtensibleXMLObject,
396 public AbstractDOMCachingXMLObject,
397 public AbstractXMLObjectMarshaller,
398 public AbstractXMLObjectUnmarshaller
400 list<XMLObject*>::iterator m_pos_TelephoneNumber;
403 m_ContactType=nullptr;
404 m_children.push_back(nullptr);
405 m_children.push_back(nullptr);
406 m_children.push_back(nullptr);
407 m_children.push_back(nullptr);
408 m_children.push_back(nullptr);
409 m_Extensions=nullptr;
413 m_pos_Extensions=m_children.begin();
414 m_pos_Company=m_pos_Extensions;
416 m_pos_GivenName=m_pos_Company;
418 m_pos_SurName=m_pos_GivenName;
420 m_pos_TelephoneNumber=m_pos_SurName;
421 ++m_pos_TelephoneNumber;
424 virtual ~ContactPersonImpl() {
425 XMLString::release(&m_ContactType);
428 ContactPersonImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
429 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
433 ContactPersonImpl(const ContactPersonImpl& src)
434 : AbstractXMLObject(src), AbstractComplexElement(src),
435 AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
437 if (src.getExtensions())
438 setExtensions(src.getExtensions()->cloneExtensions());
439 if (src.getCompany())
440 setCompany(src.getCompany()->cloneCompany());
441 if (src.getGivenName())
442 setGivenName(src.getGivenName()->cloneGivenName());
443 if (src.getSurName())
444 setSurName(src.getSurName()->cloneSurName());
446 VectorOf(EmailAddress) v=getEmailAddresss();
447 for (vector<EmailAddress*>::const_iterator i=src.m_EmailAddresss.begin(); i!=src.m_EmailAddresss.end(); i++) {
449 v.push_back((*i)->cloneEmailAddress());
452 VectorOf(TelephoneNumber) w=getTelephoneNumbers();
453 for (vector<TelephoneNumber*>::const_iterator j=src.m_TelephoneNumbers.begin(); j!=src.m_TelephoneNumbers.end(); j++) {
455 w.push_back((*j)->cloneTelephoneNumber());
460 IMPL_XMLOBJECT_CLONE(ContactPerson);
461 IMPL_STRING_ATTRIB(ContactType);
462 IMPL_TYPED_CHILD(Extensions);
463 IMPL_TYPED_CHILD(Company);
464 IMPL_TYPED_CHILD(GivenName);
465 IMPL_TYPED_CHILD(SurName);
466 IMPL_TYPED_CHILDREN(EmailAddress,m_pos_TelephoneNumber);
467 IMPL_TYPED_CHILDREN(TelephoneNumber,m_children.end());
469 void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
470 if (!qualifiedName.hasNamespaceURI()) {
471 if (XMLString::equals(qualifiedName.getLocalPart(),CONTACTTYPE_ATTRIB_NAME)) {
472 setContactType(value);
476 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
480 void marshallAttributes(DOMElement* domElement) const {
481 MARSHALL_STRING_ATTRIB(ContactType,CONTACTTYPE,nullptr);
482 marshallExtensionAttributes(domElement);
485 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
486 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
487 PROC_TYPED_CHILD(Company,SAML20MD_NS,false);
488 PROC_TYPED_CHILD(GivenName,SAML20MD_NS,false);
489 PROC_TYPED_CHILD(SurName,SAML20MD_NS,false);
490 PROC_TYPED_CHILDREN(EmailAddress,SAML20MD_NS,false);
491 PROC_TYPED_CHILDREN(TelephoneNumber,SAML20MD_NS,false);
492 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
495 void processAttribute(const DOMAttr* attribute) {
496 unmarshallExtensionAttribute(attribute);
500 class SAML_DLLLOCAL AdditionalMetadataLocationImpl : public virtual AdditionalMetadataLocation,
501 public AbstractSimpleElement,
502 public AbstractDOMCachingXMLObject,
503 public AbstractXMLObjectMarshaller,
504 public AbstractXMLObjectUnmarshaller
511 virtual ~AdditionalMetadataLocationImpl() {
512 XMLString::release(&m_Namespace);
515 AdditionalMetadataLocationImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
516 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
520 AdditionalMetadataLocationImpl(const AdditionalMetadataLocationImpl& src)
521 : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
525 IMPL_XMLOBJECT_CLONE(AdditionalMetadataLocation);
526 IMPL_STRING_ATTRIB(Namespace);
529 void marshallAttributes(DOMElement* domElement) const {
530 MARSHALL_STRING_ATTRIB(Namespace,NAMESPACE,nullptr);
533 void processAttribute(const DOMAttr* attribute) {
534 PROC_STRING_ATTRIB(Namespace,NAMESPACE,nullptr);
535 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
539 class SAML_DLLLOCAL KeyDescriptorImpl : public virtual KeyDescriptor,
540 public AbstractComplexElement,
541 public AbstractDOMCachingXMLObject,
542 public AbstractXMLObjectMarshaller,
543 public AbstractXMLObjectUnmarshaller
548 m_children.push_back(nullptr);
549 m_pos_KeyInfo=m_children.begin();
552 virtual ~KeyDescriptorImpl() {
553 XMLString::release(&m_Use);
556 KeyDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
557 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
561 KeyDescriptorImpl(const KeyDescriptorImpl& src)
562 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
564 setUse(src.getUse());
565 if (src.getKeyInfo())
566 setKeyInfo(src.getKeyInfo()->cloneKeyInfo());
567 VectorOf(EncryptionMethod) v=getEncryptionMethods();
568 for (vector<EncryptionMethod*>::const_iterator i=src.m_EncryptionMethods.begin(); i!=src.m_EncryptionMethods.end(); i++) {
570 v.push_back((*i)->cloneEncryptionMethod());
575 IMPL_XMLOBJECT_CLONE(KeyDescriptor);
576 IMPL_STRING_ATTRIB(Use);
577 IMPL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
578 IMPL_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption,m_children.end());
581 void marshallAttributes(DOMElement* domElement) const {
582 MARSHALL_STRING_ATTRIB(Use,USE,nullptr);
585 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
586 PROC_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature,XMLSIG_NS,false);
587 PROC_TYPED_FOREIGN_CHILDREN(EncryptionMethod,xmlencryption,SAML20MD_NS,false);
588 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
591 void processAttribute(const DOMAttr* attribute) {
592 PROC_STRING_ATTRIB(Use,USE,nullptr);
593 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
597 class SAML_DLLLOCAL EndpointTypeImpl : public virtual EndpointType,
598 public AbstractAttributeExtensibleXMLObject,
599 public AbstractComplexElement,
600 public AbstractDOMCachingXMLObject,
601 public AbstractXMLObjectMarshaller,
602 public AbstractXMLObjectUnmarshaller
605 m_Binding=m_Location=m_ResponseLocation=nullptr;
614 virtual ~EndpointTypeImpl() {
615 XMLString::release(&m_Binding);
616 XMLString::release(&m_Location);
617 XMLString::release(&m_ResponseLocation);
620 EndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
621 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
624 EndpointTypeImpl(const EndpointTypeImpl& src)
625 : AbstractXMLObject(src),
626 AbstractAttributeExtensibleXMLObject(src),
627 AbstractComplexElement(src),
628 AbstractDOMCachingXMLObject(src) {
629 setBinding(src.getBinding());
630 setLocation(src.getLocation());
631 setResponseLocation(src.getResponseLocation());
632 VectorOf(XMLObject) v=getUnknownXMLObjects();
633 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
634 v.push_back((*i)->clone());
637 IMPL_XMLOBJECT_CLONE(EndpointType);
638 IMPL_STRING_ATTRIB(Binding);
639 IMPL_STRING_ATTRIB(Location);
640 IMPL_STRING_ATTRIB(ResponseLocation);
641 IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
643 void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
644 if (!qualifiedName.hasNamespaceURI()) {
645 if (XMLString::equals(qualifiedName.getLocalPart(),BINDING_ATTRIB_NAME)) {
649 else if (XMLString::equals(qualifiedName.getLocalPart(),LOCATION_ATTRIB_NAME)) {
653 else if (XMLString::equals(qualifiedName.getLocalPart(),RESPONSELOCATION_ATTRIB_NAME)) {
654 setResponseLocation(value);
658 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
661 void marshallAttributes(DOMElement* domElement) const {
662 MARSHALL_STRING_ATTRIB(Binding,BINDING,nullptr);
663 MARSHALL_STRING_ATTRIB(Location,LOCATION,nullptr);
664 MARSHALL_STRING_ATTRIB(ResponseLocation,RESPONSELOCATION,nullptr);
665 marshallExtensionAttributes(domElement);
668 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
670 const XMLCh* nsURI=root->getNamespaceURI();
671 if (!XMLString::equals(nsURI,SAML20MD_NS) && nsURI && *nsURI) {
672 getUnknownXMLObjects().push_back(childXMLObject);
675 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
678 void processAttribute(const DOMAttr* attribute) {
679 unmarshallExtensionAttribute(attribute);
683 class SAML_DLLLOCAL IndexedEndpointTypeImpl : public virtual IndexedEndpointType, public EndpointTypeImpl
687 m_isDefault=XML_BOOL_NULL;
691 IndexedEndpointTypeImpl() {
695 virtual ~IndexedEndpointTypeImpl() {
696 XMLString::release(&m_Index);
699 IndexedEndpointTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
700 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
702 IndexedEndpointTypeImpl(const IndexedEndpointTypeImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {
703 setIndex(src.m_Index);
704 isDefault(src.m_isDefault);
707 IMPL_XMLOBJECT_CLONE(IndexedEndpointType);
708 EndpointType* cloneEndpointType() const {
709 return new IndexedEndpointTypeImpl(*this);
712 IMPL_INTEGER_ATTRIB(Index);
713 IMPL_BOOLEAN_ATTRIB(isDefault);
715 void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
716 if (!qualifiedName.hasNamespaceURI()) {
717 if (XMLString::equals(qualifiedName.getLocalPart(),INDEX_ATTRIB_NAME)) {
721 else if (XMLString::equals(qualifiedName.getLocalPart(),ISDEFAULT_ATTRIB_NAME)) {
726 EndpointTypeImpl::setAttribute(qualifiedName, value, ID);
730 void marshallAttributes(DOMElement* domElement) const {
731 MARSHALL_INTEGER_ATTRIB(Index,INDEX,nullptr);
732 MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,nullptr);
733 EndpointTypeImpl::marshallAttributes(domElement);
737 class SAML_DLLLOCAL ArtifactResolutionServiceImpl : public virtual ArtifactResolutionService, public IndexedEndpointTypeImpl
740 virtual ~ArtifactResolutionServiceImpl() {}
742 ArtifactResolutionServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
743 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
745 ArtifactResolutionServiceImpl(const ArtifactResolutionServiceImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {}
747 IMPL_XMLOBJECT_CLONE(ArtifactResolutionService);
748 IndexedEndpointType* cloneIndexedEndpointType() const {
749 return new ArtifactResolutionServiceImpl(*this);
751 EndpointType* cloneEndpointType() const {
752 return new ArtifactResolutionServiceImpl(*this);
756 class SAML_DLLLOCAL SingleLogoutServiceImpl : public virtual SingleLogoutService, public EndpointTypeImpl
759 virtual ~SingleLogoutServiceImpl() {}
761 SingleLogoutServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
762 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
764 SingleLogoutServiceImpl(const SingleLogoutServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
766 IMPL_XMLOBJECT_CLONE(SingleLogoutService);
767 EndpointType* cloneEndpointType() const {
768 return new SingleLogoutServiceImpl(*this);
772 class SAML_DLLLOCAL ManageNameIDServiceImpl : public virtual ManageNameIDService, public EndpointTypeImpl
775 virtual ~ManageNameIDServiceImpl() {}
777 ManageNameIDServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
778 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
780 ManageNameIDServiceImpl(const ManageNameIDServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
782 IMPL_XMLOBJECT_CLONE(ManageNameIDService);
783 EndpointType* cloneEndpointType() const {
784 return new ManageNameIDServiceImpl(*this);
788 class SAML_DLLLOCAL SingleSignOnServiceImpl : public virtual SingleSignOnService, public EndpointTypeImpl
791 virtual ~SingleSignOnServiceImpl() {}
793 SingleSignOnServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
794 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
796 SingleSignOnServiceImpl(const SingleSignOnServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
798 IMPL_XMLOBJECT_CLONE(SingleSignOnService);
799 EndpointType* cloneEndpointType() const {
800 return new SingleSignOnServiceImpl(*this);
804 class SAML_DLLLOCAL NameIDMappingServiceImpl : public virtual NameIDMappingService, public EndpointTypeImpl
807 virtual ~NameIDMappingServiceImpl() {}
809 NameIDMappingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
810 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
812 NameIDMappingServiceImpl(const NameIDMappingServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
814 IMPL_XMLOBJECT_CLONE(NameIDMappingService);
815 EndpointType* cloneEndpointType() const {
816 return new NameIDMappingServiceImpl(*this);
820 class SAML_DLLLOCAL AssertionIDRequestServiceImpl : public virtual AssertionIDRequestService, public EndpointTypeImpl
823 virtual ~AssertionIDRequestServiceImpl() {}
825 AssertionIDRequestServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
826 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
828 AssertionIDRequestServiceImpl(const AssertionIDRequestServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
830 IMPL_XMLOBJECT_CLONE(AssertionIDRequestService);
831 EndpointType* cloneEndpointType() const {
832 return new AssertionIDRequestServiceImpl(*this);
836 class SAML_DLLLOCAL AssertionConsumerServiceImpl : public virtual AssertionConsumerService, public IndexedEndpointTypeImpl
839 virtual ~AssertionConsumerServiceImpl() {}
841 AssertionConsumerServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
842 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
844 AssertionConsumerServiceImpl(const AssertionConsumerServiceImpl& src) : AbstractXMLObject(src), IndexedEndpointTypeImpl(src) {}
846 IMPL_XMLOBJECT_CLONE(AssertionConsumerService);
847 EndpointType* cloneEndpointType() const {
848 return new AssertionConsumerServiceImpl(*this);
850 IndexedEndpointType* cloneIndexedEndpointType() const {
851 return new AssertionConsumerServiceImpl(*this);
855 class SAML_DLLLOCAL AuthnQueryServiceImpl : public virtual AuthnQueryService, public EndpointTypeImpl
858 virtual ~AuthnQueryServiceImpl() {}
860 AuthnQueryServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
861 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
863 AuthnQueryServiceImpl(const AuthnQueryServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
865 IMPL_XMLOBJECT_CLONE(AuthnQueryService);
866 EndpointType* cloneEndpointType() const {
867 return new AuthnQueryServiceImpl(*this);
871 class SAML_DLLLOCAL AuthzServiceImpl : public virtual AuthzService, public EndpointTypeImpl
874 virtual ~AuthzServiceImpl() {}
876 AuthzServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
877 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
879 AuthzServiceImpl(const AuthzServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
881 IMPL_XMLOBJECT_CLONE(AuthzService);
882 EndpointType* cloneEndpointType() const {
883 return new AuthzServiceImpl(*this);
887 class SAML_DLLLOCAL AttributeServiceImpl : public virtual AttributeService, public EndpointTypeImpl
890 virtual ~AttributeServiceImpl() {}
892 AttributeServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
893 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
895 AttributeServiceImpl(const AttributeServiceImpl& src) : AbstractXMLObject(src), EndpointTypeImpl(src) {}
897 IMPL_XMLOBJECT_CLONE(AttributeService);
898 EndpointType* cloneEndpointType() const {
899 return new AttributeServiceImpl(*this);
903 class SAML_DLLLOCAL RoleDescriptorImpl : public virtual RoleDescriptor,
904 public virtual SignableObject,
905 public AbstractComplexElement,
906 public AbstractAttributeExtensibleXMLObject,
907 public AbstractDOMCachingXMLObject,
908 public AbstractXMLObjectMarshaller,
909 public AbstractXMLObjectUnmarshaller
912 m_ID=m_ProtocolSupportEnumeration=m_ErrorURL=nullptr;
913 m_ValidUntil=m_CacheDuration=nullptr;
914 m_children.push_back(nullptr);
915 m_children.push_back(nullptr);
916 m_children.push_back(nullptr);
917 m_children.push_back(nullptr);
919 m_Extensions=nullptr;
920 m_Organization=nullptr;
921 m_pos_Signature=m_children.begin();
922 m_pos_Extensions=m_pos_Signature;
924 m_pos_Organization=m_pos_Extensions;
925 ++m_pos_Organization;
926 m_pos_ContactPerson=m_pos_Organization;
927 ++m_pos_ContactPerson;
931 list<XMLObject*>::iterator m_pos_ContactPerson;
933 RoleDescriptorImpl() {
938 virtual ~RoleDescriptorImpl() {
939 XMLString::release(&m_ID);
940 XMLString::release(&m_ProtocolSupportEnumeration);
941 XMLString::release(&m_ErrorURL);
943 delete m_CacheDuration;
946 RoleDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
947 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
951 RoleDescriptorImpl(const RoleDescriptorImpl& src)
952 : AbstractXMLObject(src), AbstractComplexElement(src),
953 AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
956 setProtocolSupportEnumeration(src.getProtocolSupportEnumeration());
957 setErrorURL(src.getErrorURL());
958 setValidUntil(src.getValidUntil());
959 setCacheDuration(src.getCacheDuration());
960 if (src.getSignature())
961 setSignature(src.getSignature()->cloneSignature());
962 if (src.getExtensions())
963 setExtensions(src.getExtensions()->cloneExtensions());
964 if (src.getOrganization())
965 setOrganization(src.getOrganization()->cloneOrganization());
967 VectorOf(KeyDescriptor) v=getKeyDescriptors();
968 for (vector<KeyDescriptor*>::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) {
970 v.push_back((*i)->cloneKeyDescriptor());
973 VectorOf(ContactPerson) w=getContactPersons();
974 for (vector<ContactPerson*>::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) {
976 w.push_back((*j)->cloneContactPerson());
981 //IMPL_TYPED_CHILD(Signature);
982 // Need customized setter.
984 Signature* m_Signature;
985 list<XMLObject*>::iterator m_pos_Signature;
987 Signature* getSignature() const {
991 void setSignature(Signature* sig) {
992 prepareForAssignment(m_Signature,sig);
993 *m_pos_Signature=m_Signature=sig;
994 // Sync content reference back up.
996 m_Signature->setContentReference(new opensaml::ContentReference(*this));
999 IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
1000 IMPL_STRING_ATTRIB(ProtocolSupportEnumeration);
1001 IMPL_STRING_ATTRIB(ErrorURL);
1002 IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
1003 IMPL_DURATION_ATTRIB(CacheDuration,0);
1004 IMPL_TYPED_CHILD(Extensions);
1005 IMPL_TYPED_CHILDREN(KeyDescriptor,m_pos_Organization);
1006 IMPL_TYPED_CHILD(Organization);
1007 IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson);
1009 bool hasSupport(const XMLCh* protocol) const {
1010 if (!protocol || !*protocol)
1012 if (m_ProtocolSupportEnumeration) {
1013 // Look for first character.
1014 xsecsize_t len=XMLString::stringLen(protocol);
1016 int index=XMLString::indexOf(m_ProtocolSupportEnumeration,protocol[0],pos);
1018 // Only possible match is if it's the first character or a space comes before it.
1019 if (index==0 || m_ProtocolSupportEnumeration[index-1]==chSpace) {
1020 // See if rest of protocol string is present.
1021 if (0==XMLString::compareNString(m_ProtocolSupportEnumeration+index+1,protocol+1,len-1)) {
1022 // Only possible match is if it's the last character or a space comes after it.
1023 if (m_ProtocolSupportEnumeration[index+len]==chNull || m_ProtocolSupportEnumeration[index+len]==chSpace)
1029 // Move past last search and start again.
1034 // Move past last search and start again.
1037 index=XMLString::indexOf(m_ProtocolSupportEnumeration,protocol[0],pos);
1043 void addSupport(const XMLCh* protocol) {
1044 if (hasSupport(protocol))
1046 if (m_ProtocolSupportEnumeration && *m_ProtocolSupportEnumeration) {
1047 #ifdef HAVE_GOOD_STL
1048 xstring pse(m_ProtocolSupportEnumeration);
1049 pse = pse + chSpace + protocol;
1050 setProtocolSupportEnumeration(pse.c_str());
1052 auto_ptr_char temp(m_ProtocolSupportEnumeration);
1053 auto_ptr_char temp2(protocol);
1054 string pse(temp.get());
1055 pse = pse + ' ' + temp2.get();
1056 auto_ptr_XMLCh temp3(pse.c_str());
1057 setProtocolSupportEnumeration(temp3.get());
1061 setProtocolSupportEnumeration(protocol);
1065 void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1066 if (!qualifiedName.hasNamespaceURI()) {
1067 if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
1071 else if (XMLString::equals(qualifiedName.getLocalPart(),PROTOCOLSUPPORTENUMERATION_ATTRIB_NAME)) {
1072 setProtocolSupportEnumeration(value);
1075 else if (XMLString::equals(qualifiedName.getLocalPart(),ERRORURL_ATTRIB_NAME)) {
1079 else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
1080 setValidUntil(value);
1083 else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
1084 setCacheDuration(value);
1088 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
1092 void prepareForMarshalling() const {
1094 declareNonVisibleNamespaces();
1097 void marshallAttributes(DOMElement* domElement) const {
1098 MARSHALL_ID_ATTRIB(ID,ID,nullptr);
1099 MARSHALL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION,nullptr);
1100 MARSHALL_STRING_ATTRIB(ErrorURL,ERRORURL,nullptr);
1101 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
1102 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
1103 marshallExtensionAttributes(domElement);
1106 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1107 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
1108 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
1109 PROC_TYPED_CHILDREN(KeyDescriptor,SAML20MD_NS,false);
1110 PROC_TYPED_CHILD(Organization,SAML20MD_NS,false);
1111 PROC_TYPED_CHILDREN(ContactPerson,SAML20MD_NS,false);
1112 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1115 void processAttribute(const DOMAttr* attribute) {
1116 PROC_ID_ATTRIB(ID,ID,nullptr);
1117 unmarshallExtensionAttribute(attribute);
1121 class SAML_DLLLOCAL RoleDescriptorTypeImpl : public virtual RoleDescriptorType, public RoleDescriptorImpl
1124 virtual ~RoleDescriptorTypeImpl() {}
1126 RoleDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1127 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1130 RoleDescriptorTypeImpl(const RoleDescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1131 VectorOf(XMLObject) v=getUnknownXMLObjects();
1132 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
1133 v.push_back((*i)->clone());
1136 IMPL_XMLOBJECT_CLONE(RoleDescriptorType);
1137 RoleDescriptor* cloneRoleDescriptor() const {
1138 return new RoleDescriptorTypeImpl(*this);
1141 IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
1144 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1145 getUnknownXMLObjects().push_back(childXMLObject);
1149 class SAML_DLLLOCAL SSODescriptorTypeImpl : public virtual SSODescriptorType, public RoleDescriptorImpl
1152 m_children.push_back(nullptr);
1153 m_children.push_back(nullptr);
1154 m_children.push_back(nullptr);
1155 m_children.push_back(nullptr);
1156 m_pos_ArtifactResolutionService=m_pos_ContactPerson;
1157 ++m_pos_ArtifactResolutionService;
1158 m_pos_SingleLogoutService=m_pos_ArtifactResolutionService;
1159 ++m_pos_SingleLogoutService;
1160 m_pos_ManageNameIDService=m_pos_SingleLogoutService;
1161 ++m_pos_ManageNameIDService;
1162 m_pos_NameIDFormat=m_pos_ManageNameIDService;
1163 ++m_pos_NameIDFormat;
1167 list<XMLObject*>::iterator m_pos_ArtifactResolutionService;
1168 list<XMLObject*>::iterator m_pos_SingleLogoutService;
1169 list<XMLObject*>::iterator m_pos_ManageNameIDService;
1170 list<XMLObject*>::iterator m_pos_NameIDFormat;
1172 SSODescriptorTypeImpl() {
1177 virtual ~SSODescriptorTypeImpl() {}
1179 SSODescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1180 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1184 SSODescriptorTypeImpl(const SSODescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1186 VectorOf(ArtifactResolutionService) v=getArtifactResolutionServices();
1187 for (vector<ArtifactResolutionService*>::const_iterator i=src.m_ArtifactResolutionServices.begin(); i!=src.m_ArtifactResolutionServices.end(); i++) {
1189 v.push_back((*i)->cloneArtifactResolutionService());
1192 VectorOf(SingleLogoutService) w=getSingleLogoutServices();
1193 for (vector<SingleLogoutService*>::const_iterator j=src.m_SingleLogoutServices.begin(); j!=src.m_SingleLogoutServices.end(); j++) {
1195 w.push_back((*j)->cloneSingleLogoutService());
1198 VectorOf(ManageNameIDService) x=getManageNameIDServices();
1199 for (vector<ManageNameIDService*>::const_iterator k=src.m_ManageNameIDServices.begin(); k!=src.m_ManageNameIDServices.end(); k++) {
1201 x.push_back((*k)->cloneManageNameIDService());
1204 VectorOf(NameIDFormat) y=getNameIDFormats();
1205 for (vector<NameIDFormat*>::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) {
1207 y.push_back((*m)->cloneNameIDFormat());
1212 IMPL_TYPED_CHILDREN(ArtifactResolutionService,m_pos_ArtifactResolutionService);
1213 IMPL_TYPED_CHILDREN(SingleLogoutService,m_pos_SingleLogoutService);
1214 IMPL_TYPED_CHILDREN(ManageNameIDService,m_pos_ManageNameIDService);
1215 IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1218 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1219 PROC_TYPED_CHILDREN(ArtifactResolutionService,SAML20MD_NS,false);
1220 PROC_TYPED_CHILDREN(SingleLogoutService,SAML20MD_NS,false);
1221 PROC_TYPED_CHILDREN(ManageNameIDService,SAML20MD_NS,false);
1222 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1223 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1227 class SAML_DLLLOCAL IDPSSODescriptorImpl : public virtual IDPSSODescriptor, public SSODescriptorTypeImpl
1229 list<XMLObject*>::iterator m_pos_SingleSignOnService;
1230 list<XMLObject*>::iterator m_pos_NameIDMappingService;
1231 list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1232 list<XMLObject*>::iterator m_pos_AttributeProfile;
1235 m_WantAuthnRequestsSigned=XML_BOOL_NULL;
1236 m_children.push_back(nullptr);
1237 m_children.push_back(nullptr);
1238 m_children.push_back(nullptr);
1239 m_children.push_back(nullptr);
1240 m_pos_SingleSignOnService=m_pos_NameIDFormat;
1241 ++m_pos_SingleSignOnService;
1242 m_pos_NameIDMappingService=m_pos_SingleSignOnService;
1243 ++m_pos_NameIDMappingService;
1244 m_pos_AssertionIDRequestService=m_pos_NameIDMappingService;
1245 ++m_pos_AssertionIDRequestService;
1246 m_pos_AttributeProfile=m_pos_AssertionIDRequestService;
1247 ++m_pos_AttributeProfile;
1251 virtual ~IDPSSODescriptorImpl() {}
1253 IDPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1254 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1258 IDPSSODescriptorImpl(const IDPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
1260 WantAuthnRequestsSigned(src.m_WantAuthnRequestsSigned);
1261 VectorOf(SingleSignOnService) v=getSingleSignOnServices();
1262 for (vector<SingleSignOnService*>::const_iterator i=src.m_SingleSignOnServices.begin(); i!=src.m_SingleSignOnServices.end(); i++) {
1264 v.push_back((*i)->cloneSingleSignOnService());
1267 VectorOf(NameIDMappingService) w=getNameIDMappingServices();
1268 for (vector<NameIDMappingService*>::const_iterator j=src.m_NameIDMappingServices.begin(); j!=src.m_NameIDMappingServices.end(); j++) {
1270 w.push_back((*j)->cloneNameIDMappingService());
1273 VectorOf(AssertionIDRequestService) x=getAssertionIDRequestServices();
1274 for (vector<AssertionIDRequestService*>::const_iterator k=src.m_AssertionIDRequestServices.begin(); k!=src.m_AssertionIDRequestServices.end(); k++) {
1276 x.push_back((*k)->cloneAssertionIDRequestService());
1279 VectorOf(AttributeProfile) y=getAttributeProfiles();
1280 for (vector<AttributeProfile*>::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) {
1282 y.push_back((*m)->cloneAttributeProfile());
1285 VectorOf(Attribute) z=getAttributes();
1286 for (vector<Attribute*>::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) {
1288 z.push_back((*n)->cloneAttribute());
1293 IMPL_XMLOBJECT_CLONE(IDPSSODescriptor);
1294 SSODescriptorType* cloneSSODescriptorType() const {
1295 return new IDPSSODescriptorImpl(*this);
1297 RoleDescriptor* cloneRoleDescriptor() const {
1298 return new IDPSSODescriptorImpl(*this);
1301 IMPL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned);
1302 IMPL_TYPED_CHILDREN(SingleSignOnService,m_pos_SingleSignOnService);
1303 IMPL_TYPED_CHILDREN(NameIDMappingService,m_pos_NameIDMappingService);
1304 IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1305 IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile);
1306 IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
1308 void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1309 if (!qualifiedName.hasNamespaceURI()) {
1310 if (XMLString::equals(qualifiedName.getLocalPart(),WANTAUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
1311 setWantAuthnRequestsSigned(value);
1315 RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
1319 void marshallAttributes(DOMElement* domElement) const {
1320 MARSHALL_BOOLEAN_ATTRIB(WantAuthnRequestsSigned,WANTAUTHNREQUESTSSIGNED,nullptr);
1321 RoleDescriptorImpl::marshallAttributes(domElement);
1324 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1325 PROC_TYPED_CHILDREN(SingleSignOnService,SAML20MD_NS,false);
1326 PROC_TYPED_CHILDREN(NameIDMappingService,SAML20MD_NS,false);
1327 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1328 PROC_TYPED_CHILDREN(AttributeProfile,SAML20MD_NS,false);
1329 PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
1330 SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
1334 class SAML_DLLLOCAL RequestedAttributeImpl : public virtual RequestedAttribute,
1335 public AbstractComplexElement,
1336 public AbstractAttributeExtensibleXMLObject,
1337 public AbstractDOMCachingXMLObject,
1338 public AbstractXMLObjectMarshaller,
1339 public AbstractXMLObjectUnmarshaller
1342 m_Name=m_NameFormat=m_FriendlyName=nullptr;
1343 m_isRequired=XML_BOOL_NULL;
1346 virtual ~RequestedAttributeImpl() {
1347 XMLString::release(&m_Name);
1348 XMLString::release(&m_NameFormat);
1349 XMLString::release(&m_FriendlyName);
1352 RequestedAttributeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1353 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1357 RequestedAttributeImpl(const RequestedAttributeImpl& src)
1358 : AbstractXMLObject(src), AbstractComplexElement(src),
1359 AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
1361 setName(src.getName());
1362 setNameFormat(src.getNameFormat());
1363 setFriendlyName(src.getFriendlyName());
1364 isRequired(src.m_isRequired);
1365 VectorOf(XMLObject) v=getAttributeValues();
1366 for (vector<XMLObject*>::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) {
1368 v.push_back((*i)->clone());
1373 IMPL_XMLOBJECT_CLONE(RequestedAttribute);
1374 Attribute* cloneAttribute() const {
1375 return new RequestedAttributeImpl(*this);
1378 IMPL_STRING_ATTRIB(Name);
1379 IMPL_STRING_ATTRIB(NameFormat);
1380 IMPL_STRING_ATTRIB(FriendlyName);
1381 IMPL_BOOLEAN_ATTRIB(isRequired);
1382 IMPL_XMLOBJECT_CHILDREN(AttributeValue,m_children.end());
1384 void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1385 if (!qualifiedName.hasNamespaceURI()) {
1386 if (XMLString::equals(qualifiedName.getLocalPart(),NAME_ATTRIB_NAME)) {
1390 else if (XMLString::equals(qualifiedName.getLocalPart(),NAMEFORMAT_ATTRIB_NAME)) {
1391 setNameFormat(value);
1394 else if (XMLString::equals(qualifiedName.getLocalPart(),FRIENDLYNAME_ATTRIB_NAME)) {
1395 setFriendlyName(value);
1398 else if (XMLString::equals(qualifiedName.getLocalPart(),ISREQUIRED_ATTRIB_NAME)) {
1399 setisRequired(value);
1403 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
1407 void marshallAttributes(DOMElement* domElement) const {
1408 MARSHALL_STRING_ATTRIB(Name,NAME,nullptr);
1409 MARSHALL_STRING_ATTRIB(NameFormat,NAMEFORMAT,nullptr);
1410 MARSHALL_STRING_ATTRIB(FriendlyName,FRIENDLYNAME,nullptr);
1411 MARSHALL_BOOLEAN_ATTRIB(isRequired,ISREQUIRED,nullptr);
1412 marshallExtensionAttributes(domElement);
1415 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1416 getAttributeValues().push_back(childXMLObject);
1419 void processAttribute(const DOMAttr* attribute) {
1420 unmarshallExtensionAttribute(attribute);
1424 class SAML_DLLLOCAL AttributeConsumingServiceImpl : public virtual AttributeConsumingService,
1425 public AbstractComplexElement,
1426 public AbstractDOMCachingXMLObject,
1427 public AbstractXMLObjectMarshaller,
1428 public AbstractXMLObjectUnmarshaller
1430 list<XMLObject*>::iterator m_pos_ServiceDescription;
1431 list<XMLObject*>::iterator m_pos_RequestedAttribute;
1435 m_isDefault=XML_BOOL_NULL;
1436 m_children.push_back(nullptr);
1437 m_children.push_back(nullptr);
1438 m_pos_ServiceDescription=m_children.begin();
1439 m_pos_RequestedAttribute=m_pos_ServiceDescription;
1440 ++m_pos_RequestedAttribute;
1444 virtual ~AttributeConsumingServiceImpl() {
1445 XMLString::release(&m_Index);
1448 AttributeConsumingServiceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1449 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1453 AttributeConsumingServiceImpl(const AttributeConsumingServiceImpl& src)
1454 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
1456 setIndex(src.m_Index);
1457 isDefault(src.m_isDefault);
1458 VectorOf(ServiceName) v=getServiceNames();
1459 for (vector<ServiceName*>::const_iterator i=src.m_ServiceNames.begin(); i!=src.m_ServiceNames.end(); i++) {
1461 v.push_back((*i)->cloneServiceName());
1464 VectorOf(ServiceDescription) w=getServiceDescriptions();
1465 for (vector<ServiceDescription*>::const_iterator j=src.m_ServiceDescriptions.begin(); j!=src.m_ServiceDescriptions.end(); j++) {
1467 w.push_back((*j)->cloneServiceDescription());
1470 VectorOf(RequestedAttribute) x=getRequestedAttributes();
1471 for (vector<RequestedAttribute*>::const_iterator k=src.m_RequestedAttributes.begin(); k!=src.m_RequestedAttributes.end(); k++) {
1473 x.push_back((*k)->cloneRequestedAttribute());
1478 IMPL_XMLOBJECT_CLONE(AttributeConsumingService);
1479 IMPL_INTEGER_ATTRIB(Index);
1480 IMPL_BOOLEAN_ATTRIB(isDefault);
1481 IMPL_TYPED_CHILDREN(ServiceName,m_pos_ServiceDescription);
1482 IMPL_TYPED_CHILDREN(ServiceDescription,m_pos_RequestedAttribute);
1483 IMPL_TYPED_CHILDREN(RequestedAttribute,m_children.end());
1486 void marshallAttributes(DOMElement* domElement) const {
1487 MARSHALL_INTEGER_ATTRIB(Index,INDEX,nullptr);
1488 MARSHALL_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,nullptr);
1491 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1492 PROC_TYPED_CHILDREN(ServiceName,SAML20MD_NS,false);
1493 PROC_TYPED_CHILDREN(ServiceDescription,SAML20MD_NS,false);
1494 PROC_TYPED_CHILDREN(RequestedAttribute,SAML20MD_NS,false);
1495 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
1498 void processAttribute(const DOMAttr* attribute) {
1499 PROC_INTEGER_ATTRIB(Index,INDEX,nullptr);
1500 PROC_BOOLEAN_ATTRIB(isDefault,ISDEFAULT,nullptr);
1501 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
1505 class SAML_DLLLOCAL SPSSODescriptorImpl : public virtual SPSSODescriptor, public SSODescriptorTypeImpl
1507 list<XMLObject*>::iterator m_pos_AssertionConsumerService;
1510 m_AuthnRequestsSigned=XML_BOOL_NULL;
1511 m_WantAssertionsSigned=XML_BOOL_NULL;
1512 m_children.push_back(nullptr);
1513 m_pos_AssertionConsumerService=m_pos_NameIDFormat;
1514 ++m_pos_AssertionConsumerService;
1518 virtual ~SPSSODescriptorImpl() {}
1520 SPSSODescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1521 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1525 SPSSODescriptorImpl(const SPSSODescriptorImpl& src) : AbstractXMLObject(src), SSODescriptorTypeImpl(src) {
1527 AuthnRequestsSigned(src.m_AuthnRequestsSigned);
1528 WantAssertionsSigned(src.m_WantAssertionsSigned);
1529 VectorOf(AssertionConsumerService) v=getAssertionConsumerServices();
1530 for (vector<AssertionConsumerService*>::const_iterator i=src.m_AssertionConsumerServices.begin(); i!=src.m_AssertionConsumerServices.end(); i++) {
1532 v.push_back((*i)->cloneAssertionConsumerService());
1535 VectorOf(AttributeConsumingService) w=getAttributeConsumingServices();
1536 for (vector<AttributeConsumingService*>::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) {
1538 w.push_back((*j)->cloneAttributeConsumingService());
1543 IMPL_XMLOBJECT_CLONE(SPSSODescriptor);
1544 SSODescriptorType* cloneSSODescriptorType() const {
1545 return cloneSPSSODescriptor();
1547 RoleDescriptor* cloneRoleDescriptor() const {
1548 return cloneSPSSODescriptor();
1551 IMPL_BOOLEAN_ATTRIB(AuthnRequestsSigned);
1552 IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned);
1553 IMPL_TYPED_CHILDREN(AssertionConsumerService,m_pos_AssertionConsumerService);
1554 IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end());
1556 void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1557 if (!qualifiedName.hasNamespaceURI()) {
1558 if (XMLString::equals(qualifiedName.getLocalPart(),AUTHNREQUESTSSIGNED_ATTRIB_NAME)) {
1559 setAuthnRequestsSigned(value);
1562 else if (XMLString::equals(qualifiedName.getLocalPart(),WANTASSERTIONSSIGNED_ATTRIB_NAME)) {
1563 setWantAssertionsSigned(value);
1567 RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
1571 void marshallAttributes(DOMElement* domElement) const {
1572 MARSHALL_BOOLEAN_ATTRIB(AuthnRequestsSigned,AUTHNREQUESTSSIGNED,nullptr);
1573 MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,nullptr);
1574 RoleDescriptorImpl::marshallAttributes(domElement);
1577 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1578 PROC_TYPED_CHILDREN(AssertionConsumerService,SAML20MD_NS,false);
1579 PROC_TYPED_CHILDREN(AttributeConsumingService,SAML20MD_NS,false);
1580 SSODescriptorTypeImpl::processChildElement(childXMLObject,root);
1584 class SAML_DLLLOCAL AuthnAuthorityDescriptorImpl : public virtual AuthnAuthorityDescriptor, public RoleDescriptorImpl
1586 list<XMLObject*>::iterator m_pos_AuthnQueryService;
1587 list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1590 m_children.push_back(nullptr);
1591 m_children.push_back(nullptr);
1592 m_pos_AuthnQueryService=m_pos_ContactPerson;
1593 ++m_pos_AuthnQueryService;
1594 m_pos_AssertionIDRequestService=m_pos_AuthnQueryService;
1595 ++m_pos_AssertionIDRequestService;
1599 virtual ~AuthnAuthorityDescriptorImpl() {}
1601 AuthnAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1602 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1606 AuthnAuthorityDescriptorImpl(const AuthnAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1608 VectorOf(AuthnQueryService) v=getAuthnQueryServices();
1609 for (vector<AuthnQueryService*>::const_iterator i=src.m_AuthnQueryServices.begin(); i!=src.m_AuthnQueryServices.end(); i++) {
1611 v.push_back((*i)->cloneAuthnQueryService());
1614 VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
1615 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1617 w.push_back((*j)->cloneAssertionIDRequestService());
1620 VectorOf(NameIDFormat) x=getNameIDFormats();
1621 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1623 x.push_back((*k)->cloneNameIDFormat());
1628 IMPL_XMLOBJECT_CLONE(AuthnAuthorityDescriptor);
1629 RoleDescriptor* cloneRoleDescriptor() const {
1630 return cloneAuthnAuthorityDescriptor();
1633 IMPL_TYPED_CHILDREN(AuthnQueryService,m_pos_AuthnQueryService);
1634 IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1635 IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
1638 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1639 PROC_TYPED_CHILDREN(AuthnQueryService,SAML20MD_NS,false);
1640 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1641 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1642 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1646 class SAML_DLLLOCAL PDPDescriptorImpl : public virtual PDPDescriptor, public RoleDescriptorImpl
1648 list<XMLObject*>::iterator m_pos_AuthzService;
1649 list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1652 m_children.push_back(nullptr);
1653 m_children.push_back(nullptr);
1654 m_pos_AuthzService=m_pos_ContactPerson;
1655 ++m_pos_AuthzService;
1656 m_pos_AssertionIDRequestService=m_pos_AuthzService;
1657 ++m_pos_AssertionIDRequestService;
1661 virtual ~PDPDescriptorImpl() {}
1663 PDPDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1664 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1668 PDPDescriptorImpl(const PDPDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1670 VectorOf(AuthzService) v=getAuthzServices();
1671 for (vector<AuthzService*>::const_iterator i=src.m_AuthzServices.begin(); i!=src.m_AuthzServices.end(); i++) {
1673 v.push_back((*i)->cloneAuthzService());
1676 VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
1677 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1679 w.push_back((*j)->cloneAssertionIDRequestService());
1682 VectorOf(NameIDFormat) x=getNameIDFormats();
1683 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1685 x.push_back((*k)->cloneNameIDFormat());
1690 IMPL_XMLOBJECT_CLONE(PDPDescriptor);
1691 RoleDescriptor* cloneRoleDescriptor() const {
1692 return clonePDPDescriptor();
1695 IMPL_TYPED_CHILDREN(AuthzService,m_pos_AuthzService);
1696 IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1697 IMPL_TYPED_CHILDREN(NameIDFormat,m_children.end());
1700 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1701 PROC_TYPED_CHILDREN(AuthzService,SAML20MD_NS,false);
1702 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1703 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1704 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1708 class SAML_DLLLOCAL AttributeAuthorityDescriptorImpl : public virtual AttributeAuthorityDescriptor, public RoleDescriptorImpl
1710 list<XMLObject*>::iterator m_pos_AttributeService;
1711 list<XMLObject*>::iterator m_pos_AssertionIDRequestService;
1712 list<XMLObject*>::iterator m_pos_NameIDFormat;
1713 list<XMLObject*>::iterator m_pos_AttributeProfile;
1716 m_children.push_back(nullptr);
1717 m_children.push_back(nullptr);
1718 m_children.push_back(nullptr);
1719 m_children.push_back(nullptr);
1720 m_pos_AttributeService=m_pos_ContactPerson;
1721 ++m_pos_AttributeService;
1722 m_pos_AssertionIDRequestService=m_pos_AttributeService;
1723 ++m_pos_AssertionIDRequestService;
1724 m_pos_NameIDFormat=m_pos_AssertionIDRequestService;
1725 ++m_pos_NameIDFormat;
1726 m_pos_AttributeProfile=m_pos_NameIDFormat;
1727 ++m_pos_AttributeProfile;
1731 virtual ~AttributeAuthorityDescriptorImpl() {}
1733 AttributeAuthorityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1734 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1738 AttributeAuthorityDescriptorImpl(const AttributeAuthorityDescriptorImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1740 VectorOf(AttributeService) v=getAttributeServices();
1741 for (vector<AttributeService*>::const_iterator i=src.m_AttributeServices.begin(); i!=src.m_AttributeServices.end(); i++) {
1743 v.push_back((*i)->cloneAttributeService());
1746 VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices();
1747 for (vector<AssertionIDRequestService*>::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) {
1749 w.push_back((*j)->cloneAssertionIDRequestService());
1752 VectorOf(NameIDFormat) x=getNameIDFormats();
1753 for (vector<NameIDFormat*>::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) {
1755 x.push_back((*k)->cloneNameIDFormat());
1758 VectorOf(AttributeProfile) y=getAttributeProfiles();
1759 for (vector<AttributeProfile*>::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) {
1761 y.push_back((*m)->cloneAttributeProfile());
1764 VectorOf(Attribute) z=getAttributes();
1765 for (vector<Attribute*>::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) {
1767 z.push_back((*n)->cloneAttribute());
1772 IMPL_XMLOBJECT_CLONE(AttributeAuthorityDescriptor);
1773 RoleDescriptor* cloneRoleDescriptor() const {
1774 return cloneAttributeAuthorityDescriptor();
1777 IMPL_TYPED_CHILDREN(AttributeService,m_pos_AttributeService);
1778 IMPL_TYPED_CHILDREN(AssertionIDRequestService,m_pos_AssertionIDRequestService);
1779 IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1780 IMPL_TYPED_CHILDREN(AttributeProfile,m_pos_AttributeProfile);
1781 IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
1784 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1785 PROC_TYPED_CHILDREN(AttributeService,SAML20MD_NS,false);
1786 PROC_TYPED_CHILDREN(AssertionIDRequestService,SAML20MD_NS,false);
1787 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1788 PROC_TYPED_CHILDREN(AttributeProfile,SAML20MD_NS,false);
1789 PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
1790 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1794 class SAML_DLLLOCAL QueryDescriptorTypeImpl : public virtual QueryDescriptorType, public RoleDescriptorImpl
1797 m_WantAssertionsSigned=XML_BOOL_NULL;
1798 m_children.push_back(nullptr);
1799 m_pos_NameIDFormat=m_pos_ContactPerson;
1800 ++m_pos_NameIDFormat;
1804 list<XMLObject*>::iterator m_pos_NameIDFormat;
1806 QueryDescriptorTypeImpl() {
1811 virtual ~QueryDescriptorTypeImpl() {}
1813 QueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1814 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1818 QueryDescriptorTypeImpl(const QueryDescriptorTypeImpl& src) : AbstractXMLObject(src), RoleDescriptorImpl(src) {
1820 WantAssertionsSigned(src.m_WantAssertionsSigned);
1821 VectorOf(NameIDFormat) y=getNameIDFormats();
1822 for (vector<NameIDFormat*>::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) {
1824 y.push_back((*m)->cloneNameIDFormat());
1829 IMPL_BOOLEAN_ATTRIB(WantAssertionsSigned);
1830 IMPL_TYPED_CHILDREN(NameIDFormat,m_pos_NameIDFormat);
1832 void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
1833 if (!qualifiedName.hasNamespaceURI()) {
1834 if (XMLString::equals(qualifiedName.getLocalPart(),WANTASSERTIONSSIGNED_ATTRIB_NAME)) {
1835 setWantAssertionsSigned(value);
1839 RoleDescriptorImpl::setAttribute(qualifiedName, value, ID);
1843 void marshallAttributes(DOMElement* domElement) const {
1844 MARSHALL_BOOLEAN_ATTRIB(WantAssertionsSigned,WANTASSERTIONSSIGNED,nullptr);
1845 RoleDescriptorImpl::marshallAttributes(domElement);
1848 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1849 PROC_TYPED_CHILDREN(NameIDFormat,SAML20MD_NS,false);
1850 RoleDescriptorImpl::processChildElement(childXMLObject,root);
1854 class SAML_DLLLOCAL AuthnQueryDescriptorTypeImpl : public virtual AuthnQueryDescriptorType, public QueryDescriptorTypeImpl
1857 virtual ~AuthnQueryDescriptorTypeImpl() {}
1859 AuthnQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1860 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1862 AuthnQueryDescriptorTypeImpl(const AuthnQueryDescriptorTypeImpl& src) : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {}
1864 IMPL_XMLOBJECT_CLONE(AuthnQueryDescriptorType);
1865 QueryDescriptorType* cloneQueryDescriptorType() const {
1866 return new AuthnQueryDescriptorTypeImpl(*this);
1868 RoleDescriptor* cloneRoleDescriptor() const {
1869 return new AuthnQueryDescriptorTypeImpl(*this);
1873 class SAML_DLLLOCAL AttributeQueryDescriptorTypeImpl : public virtual AttributeQueryDescriptorType, public QueryDescriptorTypeImpl
1876 virtual ~AttributeQueryDescriptorTypeImpl() {}
1878 AttributeQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1879 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1881 AttributeQueryDescriptorTypeImpl(const AttributeQueryDescriptorTypeImpl& src)
1882 : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {
1883 VectorOf(AttributeConsumingService) w=getAttributeConsumingServices();
1884 for (vector<AttributeConsumingService*>::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) {
1886 w.push_back((*j)->cloneAttributeConsumingService());
1891 IMPL_XMLOBJECT_CLONE(AttributeQueryDescriptorType);
1892 QueryDescriptorType* cloneQueryDescriptorType() const {
1893 return new AttributeQueryDescriptorTypeImpl(*this);
1895 RoleDescriptor* cloneRoleDescriptor() const {
1896 return new AttributeQueryDescriptorTypeImpl(*this);
1899 IMPL_TYPED_CHILDREN(AttributeConsumingService,m_children.end());
1902 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1903 PROC_TYPED_CHILDREN(AttributeConsumingService,SAML20MD_NS,false);
1904 QueryDescriptorTypeImpl::processChildElement(childXMLObject,root);
1908 class SAML_DLLLOCAL AuthzDecisionQueryDescriptorTypeImpl : public virtual AuthzDecisionQueryDescriptorType, public QueryDescriptorTypeImpl
1911 virtual ~AuthzDecisionQueryDescriptorTypeImpl() {}
1913 AuthzDecisionQueryDescriptorTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1914 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
1916 AuthzDecisionQueryDescriptorTypeImpl(const AuthzDecisionQueryDescriptorTypeImpl& src)
1917 : AbstractXMLObject(src), QueryDescriptorTypeImpl(src) {
1918 VectorOf(ActionNamespace) w=getActionNamespaces();
1919 for (vector<ActionNamespace*>::const_iterator j=src.m_ActionNamespaces.begin(); j!=src.m_ActionNamespaces.end(); j++) {
1921 w.push_back((*j)->cloneActionNamespace());
1926 IMPL_XMLOBJECT_CLONE(AuthzDecisionQueryDescriptorType);
1927 QueryDescriptorType* cloneQueryDescriptorType() const {
1928 return new AuthzDecisionQueryDescriptorTypeImpl(*this);
1930 RoleDescriptor* cloneRoleDescriptor() const {
1931 return new AuthzDecisionQueryDescriptorTypeImpl(*this);
1934 IMPL_TYPED_CHILDREN(ActionNamespace,m_children.end());
1937 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
1938 PROC_TYPED_CHILDREN(ActionNamespace,samlconstants::SAML20MD_QUERY_EXT_NS,false);
1939 QueryDescriptorTypeImpl::processChildElement(childXMLObject,root);
1943 class SAML_DLLLOCAL AffiliationDescriptorImpl : public virtual AffiliationDescriptor,
1944 public virtual SignableObject,
1945 public AbstractComplexElement,
1946 public AbstractAttributeExtensibleXMLObject,
1947 public AbstractDOMCachingXMLObject,
1948 public AbstractXMLObjectMarshaller,
1949 public AbstractXMLObjectUnmarshaller
1951 list<XMLObject*>::iterator m_pos_AffiliateMember;
1954 m_ID=m_AffiliationOwnerID=nullptr;
1955 m_ValidUntil=m_CacheDuration=nullptr;
1956 m_children.push_back(nullptr);
1957 m_children.push_back(nullptr);
1958 m_children.push_back(nullptr);
1959 m_Signature=nullptr;
1960 m_Extensions=nullptr;
1961 m_pos_Signature=m_children.begin();
1962 m_pos_Extensions=m_pos_Signature;
1964 m_pos_AffiliateMember=m_pos_Extensions;
1965 ++m_pos_AffiliateMember;
1969 virtual ~AffiliationDescriptorImpl() {
1970 XMLString::release(&m_ID);
1971 XMLString::release(&m_AffiliationOwnerID);
1972 delete m_ValidUntil;
1973 delete m_CacheDuration;
1976 AffiliationDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
1977 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
1981 AffiliationDescriptorImpl(const AffiliationDescriptorImpl& src)
1982 : AbstractXMLObject(src), AbstractComplexElement(src),
1983 AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
1986 setAffiliationOwnerID(src.getAffiliationOwnerID());
1987 setValidUntil(src.getValidUntil());
1988 setCacheDuration(src.getCacheDuration());
1989 if (src.getSignature())
1990 setSignature(src.getSignature()->cloneSignature());
1991 if (src.getExtensions())
1992 setExtensions(src.getExtensions()->cloneExtensions());
1994 VectorOf(KeyDescriptor) v=getKeyDescriptors();
1995 for (vector<KeyDescriptor*>::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) {
1997 v.push_back((*i)->cloneKeyDescriptor());
2000 VectorOf(AffiliateMember) w=getAffiliateMembers();
2001 for (vector<AffiliateMember*>::const_iterator j=src.m_AffiliateMembers.begin(); j!=src.m_AffiliateMembers.end(); j++) {
2003 w.push_back((*j)->cloneAffiliateMember());
2008 IMPL_XMLOBJECT_CLONE(AffiliationDescriptor);
2010 //IMPL_TYPED_CHILD(Signature);
2011 // Need customized setter.
2013 Signature* m_Signature;
2014 list<XMLObject*>::iterator m_pos_Signature;
2016 Signature* getSignature() const {
2020 void setSignature(Signature* sig) {
2021 prepareForAssignment(m_Signature,sig);
2022 *m_pos_Signature=m_Signature=sig;
2023 // Sync content reference back up.
2025 m_Signature->setContentReference(new opensaml::ContentReference(*this));
2028 IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
2029 IMPL_STRING_ATTRIB(AffiliationOwnerID);
2030 IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
2031 IMPL_DURATION_ATTRIB(CacheDuration,0);
2032 IMPL_TYPED_CHILD(Extensions);
2033 IMPL_TYPED_CHILDREN(AffiliateMember,m_pos_AffiliateMember);
2034 IMPL_TYPED_CHILDREN(KeyDescriptor,m_children.end());
2036 void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
2037 if (!qualifiedName.hasNamespaceURI()) {
2038 if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
2042 else if (XMLString::equals(qualifiedName.getLocalPart(),AFFILIATIONOWNERID_ATTRIB_NAME)) {
2043 setAffiliationOwnerID(value);
2046 else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
2047 setValidUntil(value);
2050 else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
2051 setCacheDuration(value);
2055 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
2059 void prepareForMarshalling() const {
2061 declareNonVisibleNamespaces();
2064 void marshallAttributes(DOMElement* domElement) const {
2065 MARSHALL_ID_ATTRIB(ID,ID,nullptr);
2066 MARSHALL_STRING_ATTRIB(AffiliationOwnerID,AFFILIATIONOWNERID,nullptr);
2067 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
2068 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
2069 marshallExtensionAttributes(domElement);
2072 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2073 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
2074 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
2075 PROC_TYPED_CHILDREN(AffiliateMember,SAML20MD_NS,false);
2076 PROC_TYPED_CHILDREN(KeyDescriptor,SAML20MD_NS,false);
2077 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2080 void processAttribute(const DOMAttr* attribute) {
2081 PROC_ID_ATTRIB(ID,ID,nullptr);
2082 unmarshallExtensionAttribute(attribute);
2086 class SAML_DLLLOCAL EntityDescriptorImpl : public virtual EntityDescriptor,
2087 public virtual SignableObject,
2088 public AbstractComplexElement,
2089 public AbstractAttributeExtensibleXMLObject,
2090 public AbstractDOMCachingXMLObject,
2091 public AbstractXMLObjectMarshaller,
2092 public AbstractXMLObjectUnmarshaller
2094 list<XMLObject*>::iterator m_pos_ContactPerson;
2097 m_ID=m_EntityID=nullptr;
2098 m_ValidUntil=m_CacheDuration=nullptr;
2099 m_children.push_back(nullptr);
2100 m_children.push_back(nullptr);
2101 m_children.push_back(nullptr);
2102 m_children.push_back(nullptr);
2103 m_children.push_back(nullptr);
2104 m_Signature=nullptr;
2105 m_Extensions=nullptr;
2106 m_AffiliationDescriptor=nullptr;
2107 m_Organization=nullptr;
2108 m_pos_Signature=m_children.begin();
2109 m_pos_Extensions=m_pos_Signature;
2111 m_pos_AffiliationDescriptor=m_pos_Extensions;
2112 ++m_pos_AffiliationDescriptor;
2113 m_pos_Organization=m_pos_AffiliationDescriptor;
2114 ++m_pos_Organization;
2115 m_pos_ContactPerson=m_pos_Organization;
2116 ++m_pos_ContactPerson;
2120 virtual ~EntityDescriptorImpl() {
2121 XMLString::release(&m_ID);
2122 XMLString::release(&m_EntityID);
2123 delete m_ValidUntil;
2124 delete m_CacheDuration;
2127 EntityDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2128 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2132 EntityDescriptorImpl(const EntityDescriptorImpl& src)
2133 : AbstractXMLObject(src), AbstractComplexElement(src),
2134 AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) {
2137 setEntityID(src.getEntityID());
2138 setValidUntil(src.getValidUntil());
2139 setCacheDuration(src.getCacheDuration());
2140 if (src.getSignature())
2141 setSignature(src.getSignature()->cloneSignature());
2142 if (src.getExtensions())
2143 setExtensions(src.getExtensions()->cloneExtensions());
2144 if (src.getAffiliationDescriptor())
2145 setAffiliationDescriptor(src.getAffiliationDescriptor()->cloneAffiliationDescriptor());
2146 if (src.getOrganization())
2147 setOrganization(src.getOrganization()->cloneOrganization());
2149 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2151 IDPSSODescriptor* idp=dynamic_cast<IDPSSODescriptor*>(*i);
2153 getIDPSSODescriptors().push_back(idp->cloneIDPSSODescriptor());
2157 SPSSODescriptor* sp=dynamic_cast<SPSSODescriptor*>(*i);
2159 getSPSSODescriptors().push_back(sp->cloneSPSSODescriptor());
2163 AuthnAuthorityDescriptor* authn=dynamic_cast<AuthnAuthorityDescriptor*>(*i);
2165 getAuthnAuthorityDescriptors().push_back(authn->cloneAuthnAuthorityDescriptor());
2169 AttributeAuthorityDescriptor* attr=dynamic_cast<AttributeAuthorityDescriptor*>(*i);
2171 getAttributeAuthorityDescriptors().push_back(attr->cloneAttributeAuthorityDescriptor());
2175 PDPDescriptor* pdp=dynamic_cast<PDPDescriptor*>(*i);
2177 getPDPDescriptors().push_back(pdp->clonePDPDescriptor());
2181 AuthnQueryDescriptorType* authnq=dynamic_cast<AuthnQueryDescriptorType*>(*i);
2183 getAuthnQueryDescriptorTypes().push_back(authnq->cloneAuthnQueryDescriptorType());
2187 AttributeQueryDescriptorType* attrq=dynamic_cast<AttributeQueryDescriptorType*>(*i);
2189 getAttributeQueryDescriptorTypes().push_back(attrq->cloneAttributeQueryDescriptorType());
2193 AuthzDecisionQueryDescriptorType* authzq=dynamic_cast<AuthzDecisionQueryDescriptorType*>(*i);
2195 getAuthzDecisionQueryDescriptorTypes().push_back(authzq->cloneAuthzDecisionQueryDescriptorType());
2199 RoleDescriptor* role=dynamic_cast<RoleDescriptor*>(*i);
2201 getRoleDescriptors().push_back(role->cloneRoleDescriptor());
2207 VectorOf(ContactPerson) v=getContactPersons();
2208 for (vector<ContactPerson*>::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) {
2210 v.push_back((*j)->cloneContactPerson());
2213 VectorOf(AdditionalMetadataLocation) w=getAdditionalMetadataLocations();
2214 for (vector<AdditionalMetadataLocation*>::const_iterator k=src.m_AdditionalMetadataLocations.begin(); k!=src.m_AdditionalMetadataLocations.end(); k++) {
2216 w.push_back((*k)->cloneAdditionalMetadataLocation());
2221 IMPL_XMLOBJECT_CLONE(EntityDescriptor);
2223 //IMPL_TYPED_CHILD(Signature);
2224 // Need customized setter.
2226 Signature* m_Signature;
2227 list<XMLObject*>::iterator m_pos_Signature;
2229 Signature* getSignature() const {
2233 void setSignature(Signature* sig) {
2234 prepareForAssignment(m_Signature,sig);
2235 *m_pos_Signature=m_Signature=sig;
2236 // Sync content reference back up.
2238 m_Signature->setContentReference(new opensaml::ContentReference(*this));
2241 IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
2242 IMPL_STRING_ATTRIB(EntityID);
2243 IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
2244 IMPL_DURATION_ATTRIB(CacheDuration,0);
2245 IMPL_TYPED_CHILD(Extensions);
2246 IMPL_TYPED_CHILDREN(RoleDescriptor,m_pos_AffiliationDescriptor);
2247 IMPL_TYPED_CHILDREN(IDPSSODescriptor,m_pos_AffiliationDescriptor);
2248 IMPL_TYPED_CHILDREN(SPSSODescriptor,m_pos_AffiliationDescriptor);
2249 IMPL_TYPED_CHILDREN(AuthnAuthorityDescriptor,m_pos_AffiliationDescriptor);
2250 IMPL_TYPED_CHILDREN(AttributeAuthorityDescriptor,m_pos_AffiliationDescriptor);
2251 IMPL_TYPED_CHILDREN(PDPDescriptor,m_pos_AffiliationDescriptor);
2252 IMPL_TYPED_CHILDREN(AuthnQueryDescriptorType,m_pos_AffiliationDescriptor);
2253 IMPL_TYPED_CHILDREN(AttributeQueryDescriptorType,m_pos_AffiliationDescriptor);
2254 IMPL_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType,m_pos_AffiliationDescriptor);
2255 IMPL_TYPED_CHILD(AffiliationDescriptor);
2256 IMPL_TYPED_CHILD(Organization);
2257 IMPL_TYPED_CHILDREN(ContactPerson,m_pos_ContactPerson);
2258 IMPL_TYPED_CHILDREN(AdditionalMetadataLocation,m_children.end());
2260 void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
2261 if (!qualifiedName.hasNamespaceURI()) {
2262 if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
2266 else if (XMLString::equals(qualifiedName.getLocalPart(),ENTITYID_ATTRIB_NAME)) {
2270 else if (XMLString::equals(qualifiedName.getLocalPart(),VALIDUNTIL_ATTRIB_NAME)) {
2271 setValidUntil(value);
2274 else if (XMLString::equals(qualifiedName.getLocalPart(),CACHEDURATION_ATTRIB_NAME)) {
2275 setCacheDuration(value);
2279 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
2282 const RoleDescriptor* getRoleDescriptor(const xmltooling::QName& qname, const XMLCh* protocol) const {
2283 // Check for "known" elements/types.
2284 if (qname == IDPSSODescriptor::ELEMENT_QNAME)
2285 return find_if(m_IDPSSODescriptors, isValidForProtocol(protocol));
2286 if (qname == SPSSODescriptor::ELEMENT_QNAME)
2287 return find_if(m_SPSSODescriptors, isValidForProtocol(protocol));
2288 if (qname == AuthnAuthorityDescriptor::ELEMENT_QNAME)
2289 return find_if(m_AuthnAuthorityDescriptors, isValidForProtocol(protocol));
2290 if (qname == AttributeAuthorityDescriptor::ELEMENT_QNAME)
2291 return find_if(m_AttributeAuthorityDescriptors, isValidForProtocol(protocol));
2292 if (qname == PDPDescriptor::ELEMENT_QNAME)
2293 return find_if(m_PDPDescriptors, isValidForProtocol(protocol));
2294 if (qname == AuthnQueryDescriptorType::TYPE_QNAME)
2295 return find_if(m_AuthnQueryDescriptorTypes, isValidForProtocol(protocol));
2296 if (qname == AttributeQueryDescriptorType::TYPE_QNAME)
2297 return find_if(m_AttributeQueryDescriptorTypes, isValidForProtocol(protocol));
2298 if (qname == AuthzDecisionQueryDescriptorType::TYPE_QNAME)
2299 return find_if(m_AuthzDecisionQueryDescriptorTypes, isValidForProtocol(protocol));
2301 vector<RoleDescriptor*>::const_iterator i =
2302 find_if(m_RoleDescriptors.begin(), m_RoleDescriptors.end(), ofTypeValidForProtocol(qname,protocol));
2303 return (i!=m_RoleDescriptors.end()) ? *i : nullptr;
2307 void prepareForMarshalling() const {
2309 declareNonVisibleNamespaces();
2312 void marshallAttributes(DOMElement* domElement) const {
2313 MARSHALL_ID_ATTRIB(ID,ID,nullptr);
2314 MARSHALL_STRING_ATTRIB(EntityID,ENTITYID,nullptr);
2315 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
2316 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
2317 marshallExtensionAttributes(domElement);
2320 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2321 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
2322 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
2323 PROC_TYPED_CHILDREN(IDPSSODescriptor,SAML20MD_NS,false);
2324 PROC_TYPED_CHILDREN(SPSSODescriptor,SAML20MD_NS,false);
2325 PROC_TYPED_CHILDREN(AuthnAuthorityDescriptor,SAML20MD_NS,false);
2326 PROC_TYPED_CHILDREN(AttributeAuthorityDescriptor,SAML20MD_NS,false);
2327 PROC_TYPED_CHILDREN(PDPDescriptor,SAML20MD_NS,false);
2328 PROC_TYPED_CHILDREN(AuthnQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
2329 PROC_TYPED_CHILDREN(AttributeQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
2330 PROC_TYPED_CHILDREN(AuthzDecisionQueryDescriptorType,samlconstants::SAML20MD_QUERY_EXT_NS,false);
2331 PROC_TYPED_CHILDREN(RoleDescriptor,SAML20MD_NS,false);
2332 PROC_TYPED_CHILD(AffiliationDescriptor,SAML20MD_NS,false);
2333 PROC_TYPED_CHILD(Organization,SAML20MD_NS,false);
2334 PROC_TYPED_CHILDREN(ContactPerson,SAML20MD_NS,false);
2335 PROC_TYPED_CHILDREN(AdditionalMetadataLocation,SAML20MD_NS,false);
2336 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2339 void processAttribute(const DOMAttr* attribute) {
2340 PROC_ID_ATTRIB(ID,ID,nullptr);
2341 unmarshallExtensionAttribute(attribute);
2345 class SAML_DLLLOCAL EntitiesDescriptorImpl : public virtual EntitiesDescriptor,
2346 public virtual SignableObject,
2347 public AbstractComplexElement,
2348 public AbstractDOMCachingXMLObject,
2349 public AbstractXMLObjectMarshaller,
2350 public AbstractXMLObjectUnmarshaller
2353 m_ID=m_Name=nullptr;
2354 m_ValidUntil=m_CacheDuration=nullptr;
2355 m_children.push_back(nullptr);
2356 m_children.push_back(nullptr);
2357 m_Signature=nullptr;
2358 m_Extensions=nullptr;
2359 m_pos_Signature=m_children.begin();
2360 m_pos_Extensions=m_pos_Signature;
2365 virtual ~EntitiesDescriptorImpl() {
2366 XMLString::release(&m_ID);
2367 XMLString::release(&m_Name);
2368 delete m_ValidUntil;
2369 delete m_CacheDuration;
2372 EntitiesDescriptorImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2373 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2377 EntitiesDescriptorImpl(const EntitiesDescriptorImpl& src)
2378 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
2381 setName(src.getName());
2382 setValidUntil(src.getValidUntil());
2383 setCacheDuration(src.getCacheDuration());
2384 if (src.getSignature())
2385 setSignature(src.getSignature()->cloneSignature());
2386 if (src.getExtensions())
2387 setExtensions(src.getExtensions()->cloneExtensions());
2389 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2391 EntityDescriptor* e=dynamic_cast<EntityDescriptor*>(*i);
2393 getEntityDescriptors().push_back(e->cloneEntityDescriptor());
2397 EntitiesDescriptor* es=dynamic_cast<EntitiesDescriptor*>(*i);
2399 getEntitiesDescriptors().push_back(es->cloneEntitiesDescriptor());
2406 IMPL_XMLOBJECT_CLONE(EntitiesDescriptor);
2408 //IMPL_TYPED_CHILD(Signature);
2409 // Need customized setter.
2411 Signature* m_Signature;
2412 list<XMLObject*>::iterator m_pos_Signature;
2414 Signature* getSignature() const {
2418 void setSignature(Signature* sig) {
2419 prepareForAssignment(m_Signature,sig);
2420 *m_pos_Signature=m_Signature=sig;
2421 // Sync content reference back up.
2423 m_Signature->setContentReference(new opensaml::ContentReference(*this));
2426 IMPL_ID_ATTRIB_EX(ID,ID,nullptr);
2427 IMPL_STRING_ATTRIB(Name);
2428 IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
2429 IMPL_DURATION_ATTRIB(CacheDuration,0);
2430 IMPL_TYPED_CHILD(Extensions);
2431 IMPL_TYPED_CHILDREN(EntityDescriptor,m_children.end());
2432 IMPL_TYPED_CHILDREN(EntitiesDescriptor,m_children.end());
2435 void prepareForMarshalling() const {
2437 declareNonVisibleNamespaces();
2440 void marshallAttributes(DOMElement* domElement) const {
2441 MARSHALL_ID_ATTRIB(ID,ID,nullptr);
2442 MARSHALL_STRING_ATTRIB(Name,NAME,nullptr);
2443 MARSHALL_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
2444 MARSHALL_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
2447 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2448 PROC_TYPED_FOREIGN_CHILD(Signature,xmlsignature,XMLSIG_NS,false);
2449 PROC_TYPED_CHILD(Extensions,SAML20MD_NS,false);
2450 PROC_TYPED_CHILDREN(EntityDescriptor,SAML20MD_NS,false);
2451 PROC_TYPED_CHILDREN(EntitiesDescriptor,SAML20MD_NS,false);
2452 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2455 void processAttribute(const DOMAttr* attribute) {
2456 PROC_ID_ATTRIB(ID,ID,nullptr);
2457 PROC_STRING_ATTRIB(Name,NAME,nullptr);
2458 PROC_DATETIME_ATTRIB(ValidUntil,VALIDUNTIL,nullptr);
2459 PROC_DATETIME_ATTRIB(CacheDuration,CACHEDURATION,nullptr);
2463 class SAML_DLLLOCAL EntityAttributesImpl : public virtual EntityAttributes,
2464 public AbstractComplexElement,
2465 public AbstractDOMCachingXMLObject,
2466 public AbstractXMLObjectMarshaller,
2467 public AbstractXMLObjectUnmarshaller
2470 virtual ~EntityAttributesImpl() {}
2472 EntityAttributesImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2473 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2476 EntityAttributesImpl(const EntityAttributesImpl& src)
2477 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
2478 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
2480 Attribute* a=dynamic_cast<Attribute*>(*i);
2482 getAttributes().push_back(a->cloneAttribute());
2486 saml2::Assertion* as=dynamic_cast<saml2::Assertion*>(*i);
2488 getAssertions().push_back(as->cloneAssertion());
2495 IMPL_XMLOBJECT_CLONE(EntityAttributes);
2497 IMPL_TYPED_FOREIGN_CHILDREN(Attribute,saml2,m_children.end());
2498 IMPL_TYPED_FOREIGN_CHILDREN(Assertion,saml2,m_children.end());
2501 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2502 PROC_TYPED_FOREIGN_CHILDREN(Attribute,saml2,SAML20_NS,false);
2503 PROC_TYPED_FOREIGN_CHILDREN(Assertion,saml2,SAML20_NS,false);
2504 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
2508 class SAML_DLLLOCAL DigestMethodImpl : public virtual DigestMethod,
2509 public AbstractComplexElement,
2510 public AbstractDOMCachingXMLObject,
2511 public AbstractXMLObjectMarshaller,
2512 public AbstractXMLObjectUnmarshaller
2515 virtual ~DigestMethodImpl() {
2516 XMLString::release(&m_Algorithm);
2519 DigestMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2520 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2521 m_Algorithm = nullptr;
2524 DigestMethodImpl(const DigestMethodImpl& src)
2525 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
2526 setAlgorithm(src.getAlgorithm());
2527 VectorOf(XMLObject) v=getUnknownXMLObjects();
2528 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
2529 v.push_back((*i)->clone());
2532 IMPL_STRING_ATTRIB(Algorithm);
2534 IMPL_XMLOBJECT_CLONE(DigestMethod);
2535 IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
2538 void marshallAttributes(DOMElement* domElement) const {
2539 MARSHALL_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
2542 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2544 getUnknownXMLObjects().push_back(childXMLObject);
2547 void processAttribute(const DOMAttr* attribute) {
2548 PROC_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
2552 class SAML_DLLLOCAL SigningMethodImpl : public virtual SigningMethod,
2553 public AbstractComplexElement,
2554 public AbstractDOMCachingXMLObject,
2555 public AbstractXMLObjectMarshaller,
2556 public AbstractXMLObjectUnmarshaller
2559 virtual ~SigningMethodImpl() {
2560 XMLString::release(&m_Algorithm);
2561 XMLString::release(&m_MinKeySize);
2562 XMLString::release(&m_MaxKeySize);
2565 SigningMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
2566 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
2567 m_Algorithm = nullptr;
2568 m_MinKeySize = nullptr;
2569 m_MaxKeySize = nullptr;
2572 SigningMethodImpl(const SigningMethodImpl& src)
2573 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
2574 setAlgorithm(src.getAlgorithm());
2575 setMinKeySize(src.m_MinKeySize);
2576 setMaxKeySize(src.m_MaxKeySize);
2577 VectorOf(XMLObject) v=getUnknownXMLObjects();
2578 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
2579 v.push_back((*i)->clone());
2582 IMPL_XMLOBJECT_CLONE(SigningMethod);
2583 IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
2585 IMPL_STRING_ATTRIB(Algorithm);
2586 IMPL_INTEGER_ATTRIB(MinKeySize);
2587 IMPL_INTEGER_ATTRIB(MaxKeySize);
2590 void marshallAttributes(DOMElement* domElement) const {
2591 MARSHALL_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
2592 MARSHALL_INTEGER_ATTRIB(MinKeySize,MINKEYSIZE,nullptr);
2593 MARSHALL_INTEGER_ATTRIB(MaxKeySize,MAXKEYSIZE,nullptr);
2596 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
2598 getUnknownXMLObjects().push_back(childXMLObject);
2601 void processAttribute(const DOMAttr* attribute) {
2602 PROC_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
2603 PROC_INTEGER_ATTRIB(MinKeySize,MINKEYSIZE,nullptr);
2604 PROC_INTEGER_ATTRIB(MaxKeySize,MAXKEYSIZE,nullptr);
2611 #if defined (_MSC_VER)
2612 #pragma warning( pop )
2615 IMPL_ELEMENT_QNAME(IDPSSODescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2616 IMPL_ELEMENT_QNAME(SPSSODescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2617 IMPL_ELEMENT_QNAME(AuthnAuthorityDescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2618 IMPL_ELEMENT_QNAME(AttributeAuthorityDescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2619 IMPL_ELEMENT_QNAME(PDPDescriptor, SAML20MD_NS, SAML20MD_PREFIX);
2620 IMPL_TYPE_QNAME(AuthnQueryDescriptorType, SAML20MD_QUERY_EXT_NS, SAML20MD_QUERY_EXT_PREFIX);
2621 IMPL_TYPE_QNAME(AttributeQueryDescriptorType, SAML20MD_QUERY_EXT_NS, SAML20MD_QUERY_EXT_PREFIX);
2622 IMPL_TYPE_QNAME(AuthzDecisionQueryDescriptorType, SAML20MD_QUERY_EXT_NS, SAML20MD_QUERY_EXT_PREFIX);
2624 // Builder Implementations
2626 IMPL_XMLOBJECTBUILDER(AdditionalMetadataLocation);
2627 IMPL_XMLOBJECTBUILDER(AffiliateMember);
2628 IMPL_XMLOBJECTBUILDER(AffiliationDescriptor);
2629 IMPL_XMLOBJECTBUILDER(ArtifactResolutionService);
2630 IMPL_XMLOBJECTBUILDER(AssertionConsumerService);
2631 IMPL_XMLOBJECTBUILDER(AssertionIDRequestService);
2632 IMPL_XMLOBJECTBUILDER(AttributeAuthorityDescriptor);
2633 IMPL_XMLOBJECTBUILDER(AttributeConsumingService);
2634 IMPL_XMLOBJECTBUILDER(AttributeProfile);
2635 IMPL_XMLOBJECTBUILDER(AttributeQueryDescriptorType);
2636 IMPL_XMLOBJECTBUILDER(AttributeService);
2637 IMPL_XMLOBJECTBUILDER(AuthnAuthorityDescriptor);
2638 IMPL_XMLOBJECTBUILDER(AuthnQueryDescriptorType);
2639 IMPL_XMLOBJECTBUILDER(AuthnQueryService);
2640 IMPL_XMLOBJECTBUILDER(AuthzDecisionQueryDescriptorType);
2641 IMPL_XMLOBJECTBUILDER(AuthzService);
2642 IMPL_XMLOBJECTBUILDER(Company);
2643 IMPL_XMLOBJECTBUILDER(ContactPerson);
2644 IMPL_XMLOBJECTBUILDER(EmailAddress);
2645 IMPL_XMLOBJECTBUILDER(EndpointType);
2646 IMPL_XMLOBJECTBUILDER(EntitiesDescriptor);
2647 IMPL_XMLOBJECTBUILDER(EntityDescriptor);
2648 IMPL_XMLOBJECTBUILDER(Extensions);
2649 IMPL_XMLOBJECTBUILDER(GivenName);
2650 IMPL_XMLOBJECTBUILDER(IDPSSODescriptor);
2651 IMPL_XMLOBJECTBUILDER(IndexedEndpointType);
2652 IMPL_XMLOBJECTBUILDER(KeyDescriptor);
2653 IMPL_XMLOBJECTBUILDER(localizedNameType);
2654 IMPL_XMLOBJECTBUILDER(localizedURIType);
2655 IMPL_XMLOBJECTBUILDER(ManageNameIDService);
2656 IMPL_XMLOBJECTBUILDER(NameIDFormat);
2657 IMPL_XMLOBJECTBUILDER(NameIDMappingService);
2658 IMPL_XMLOBJECTBUILDER(Organization);
2659 IMPL_XMLOBJECTBUILDER(OrganizationName);
2660 IMPL_XMLOBJECTBUILDER(OrganizationDisplayName);
2661 IMPL_XMLOBJECTBUILDER(OrganizationURL);
2662 IMPL_XMLOBJECTBUILDER(PDPDescriptor);
2663 IMPL_XMLOBJECTBUILDER(RequestedAttribute);
2664 IMPL_XMLOBJECTBUILDER(ServiceDescription);
2665 IMPL_XMLOBJECTBUILDER(ServiceName);
2666 IMPL_XMLOBJECTBUILDER(SingleLogoutService);
2667 IMPL_XMLOBJECTBUILDER(SingleSignOnService);
2668 IMPL_XMLOBJECTBUILDER(SPSSODescriptor);
2669 IMPL_XMLOBJECTBUILDER(SurName);
2670 IMPL_XMLOBJECTBUILDER(TelephoneNumber);
2672 IMPL_XMLOBJECTBUILDER(ActionNamespace);
2673 IMPL_XMLOBJECTBUILDER(SourceID);
2674 IMPL_XMLOBJECTBUILDER(EntityAttributes);
2675 IMPL_XMLOBJECTBUILDER(DigestMethod);
2676 IMPL_XMLOBJECTBUILDER(SigningMethod);
2678 #ifdef HAVE_COVARIANT_RETURNS
2679 RoleDescriptor* RoleDescriptorBuilder::buildObject(
2681 xmltooling::XMLObject* RoleDescriptorBuilder::buildObject(
2683 const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType
2686 return new RoleDescriptorTypeImpl(nsURI,localName,prefix,schemaType);
2689 const DigestMethod* RoleDescriptor::getDigestMethod() const
2691 bool roleLevel = false;
2692 XMLToolingConfig& conf = XMLToolingConfig::getConfig();
2694 if (getExtensions()) {
2695 const vector<XMLObject*>& exts = const_cast<const Extensions*>(getExtensions())->getUnknownXMLObjects();
2696 for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
2697 const opensaml::saml2md::DigestMethod* dm = dynamic_cast<opensaml::saml2md::DigestMethod*>(*i);
2699 if (dm->getAlgorithm() && conf.isXMLAlgorithmSupported(dm->getAlgorithm(), XMLToolingConfig::ALGTYPE_DIGEST))
2707 const EntityDescriptor* entity = dynamic_cast<EntityDescriptor*>(getParent());
2708 if (entity && entity->getExtensions()) {
2709 const vector<XMLObject*>& exts = const_cast<const Extensions*>(entity->getExtensions())->getUnknownXMLObjects();
2710 for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
2711 const opensaml::saml2md::DigestMethod* dm = dynamic_cast<opensaml::saml2md::DigestMethod*>(*i);
2712 if (dm && dm->getAlgorithm() && conf.isXMLAlgorithmSupported(dm->getAlgorithm(), XMLToolingConfig::ALGTYPE_DIGEST))
2721 pair<const SigningMethod*,const Credential*> RoleDescriptor::getSigningMethod(const CredentialResolver& resolver, CredentialCriteria& cc) const
2723 bool roleLevel = false;
2724 XMLToolingConfig& conf = XMLToolingConfig::getConfig();
2726 if (getExtensions()) {
2727 const vector<XMLObject*>& exts = const_cast<const Extensions*>(getExtensions())->getUnknownXMLObjects();
2728 for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
2729 const SigningMethod* sm = dynamic_cast<SigningMethod*>(*i);
2732 if (sm->getAlgorithm() && conf.isXMLAlgorithmSupported(sm->getAlgorithm(), XMLToolingConfig::ALGTYPE_SIGN)) {
2733 cc.setXMLAlgorithm(sm->getAlgorithm());
2734 pair<bool,int> minsize = sm->getMinKeySize(), maxsize = sm->getMaxKeySize();
2735 if (minsize.first || maxsize.first) {
2736 cc.setKeySize(minsize.first ? minsize.second : 0);
2737 cc.setMaxKeySize(maxsize.first ? maxsize.second : UINT_MAX);
2741 cc.setMaxKeySize(0);
2743 const Credential* cred = resolver.resolve(&cc);
2745 return make_pair(sm, cred);
2752 const EntityDescriptor* entity = dynamic_cast<EntityDescriptor*>(getParent());
2753 if (entity && entity->getExtensions()) {
2754 const vector<XMLObject*>& exts = const_cast<const Extensions*>(entity->getExtensions())->getUnknownXMLObjects();
2755 for (vector<XMLObject*>::const_iterator i = exts.begin(); i != exts.end(); ++i) {
2756 const SigningMethod* sm = dynamic_cast<SigningMethod*>(*i);
2758 if (sm->getAlgorithm() && conf.isXMLAlgorithmSupported(sm->getAlgorithm(), XMLToolingConfig::ALGTYPE_SIGN)) {
2759 cc.setXMLAlgorithm(sm->getAlgorithm());
2760 pair<bool,int> minsize = sm->getMinKeySize(), maxsize = sm->getMaxKeySize();
2761 if (minsize.first || maxsize.first) {
2762 cc.setKeySize(minsize.first ? minsize.second : 0);
2763 cc.setMaxKeySize(maxsize.first ? maxsize.second : UINT_MAX);
2767 cc.setMaxKeySize(0);
2769 const Credential* cred = resolver.resolve(&cc);
2771 return make_pair(sm, cred);
2779 cc.setMaxKeySize(0);
2780 cc.setXMLAlgorithm(nullptr);
2781 return pair<const SigningMethod*,const Credential*>(nullptr, resolver.resolve(&cc));
2784 const XMLCh ActionNamespace::LOCAL_NAME[] = UNICODE_LITERAL_15(A,c,t,i,o,n,N,a,m,e,s,p,a,c,e);
2785 const XMLCh AdditionalMetadataLocation::LOCAL_NAME[] = UNICODE_LITERAL_26(A,d,d,i,t,i,o,n,a,l,M,e,t,a,d,a,t,a,L,o,c,a,t,i,o,n);
2786 const XMLCh AdditionalMetadataLocation::TYPE_NAME[] = UNICODE_LITERAL_30(A,d,d,i,t,i,o,n,a,l,M,e,t,a,d,a,t,a,L,o,c,a,t,i,o,n,T,y,p,e);
2787 const XMLCh AdditionalMetadataLocation::NAMESPACE_ATTRIB_NAME[] = UNICODE_LITERAL_9(n,a,m,e,s,p,a,c,e);
2788 const XMLCh AffiliateMember::LOCAL_NAME[] = UNICODE_LITERAL_15(A,f,f,i,l,i,a,t,e,M,e,m,b,e,r);
2789 const XMLCh AffiliationDescriptor::LOCAL_NAME[] = UNICODE_LITERAL_21(A,f,f,i,l,i,a,t,i,o,n,D,e,s,c,r,i,p,t,o,r);
2790 const XMLCh AffiliationDescriptor::TYPE_NAME[] = UNICODE_LITERAL_25(A,f,f,i,l,i,a,t,i,o,n,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2791 const XMLCh AffiliationDescriptor::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,D);
2792 const XMLCh AffiliationDescriptor::AFFILIATIONOWNERID_ATTRIB_NAME[] = UNICODE_LITERAL_18(a,f,f,i,l,i,a,t,i,o,n,O,w,n,e,r,I,D);
2793 const XMLCh ArtifactResolutionService::LOCAL_NAME[] = UNICODE_LITERAL_25(A,r,t,i,f,a,c,t,R,e,s,o,l,u,t,i,o,n,S,e,r,v,i,c,e);
2794 const XMLCh AssertionConsumerService::LOCAL_NAME[] = UNICODE_LITERAL_24(A,s,s,e,r,t,i,o,n,C,o,n,s,u,m,e,r,S,e,r,v,i,c,e);
2795 const XMLCh AssertionIDRequestService::LOCAL_NAME[] = UNICODE_LITERAL_25(A,s,s,e,r,t,i,o,n,I,D,R,e,q,u,e,s,t,S,e,r,v,i,c,e);
2796 const XMLCh AttributeAuthorityDescriptor::LOCAL_NAME[] =UNICODE_LITERAL_28(A,t,t,r,i,b,u,t,e,A,u,t,h,o,r,i,t,y,D,e,s,c,r,i,p,t,o,r);
2797 const XMLCh AttributeAuthorityDescriptor::TYPE_NAME[] = UNICODE_LITERAL_32(A,t,t,r,i,b,u,t,e,A,u,t,h,o,r,i,t,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2798 const XMLCh AttributeConsumingService::LOCAL_NAME[] = UNICODE_LITERAL_25(A,t,t,r,i,b,u,t,e,C,o,n,s,u,m,i,n,g,S,e,r,v,i,c,e);
2799 const XMLCh AttributeConsumingService::TYPE_NAME[] = UNICODE_LITERAL_29(A,t,t,r,i,b,u,t,e,C,o,n,s,u,m,i,n,g,S,e,r,v,i,c,e,T,y,p,e);
2800 const XMLCh AttributeConsumingService::INDEX_ATTRIB_NAME[] = UNICODE_LITERAL_5(i,n,d,e,x);
2801 const XMLCh AttributeConsumingService::ISDEFAULT_ATTRIB_NAME[] = UNICODE_LITERAL_9(i,s,D,e,f,a,u,l,t);
2802 const XMLCh AttributeProfile::LOCAL_NAME[] = UNICODE_LITERAL_16(A,t,t,r,i,b,u,t,e,P,r,o,f,i,l,e);
2803 const XMLCh AttributeQueryDescriptorType::LOCAL_NAME[] =UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2804 const XMLCh AttributeQueryDescriptorType::TYPE_NAME[] = UNICODE_LITERAL_28(A,t,t,r,i,b,u,t,e,Q,u,e,r,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2805 const XMLCh AttributeService::LOCAL_NAME[] = UNICODE_LITERAL_16(A,t,t,r,i,b,u,t,e,S,e,r,v,i,c,e);
2806 const XMLCh AuthnAuthorityDescriptor::LOCAL_NAME[] = UNICODE_LITERAL_24(A,u,t,h,n,A,u,t,h,o,r,i,t,y,D,e,s,c,r,i,p,t,o,r);
2807 const XMLCh AuthnAuthorityDescriptor::TYPE_NAME[] = UNICODE_LITERAL_28(A,u,t,h,n,A,u,t,h,o,r,i,t,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2808 const XMLCh AuthnQueryDescriptorType::LOCAL_NAME[] = UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2809 const XMLCh AuthnQueryDescriptorType::TYPE_NAME[] = UNICODE_LITERAL_24(A,u,t,h,n,Q,u,e,r,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2810 const XMLCh AuthnQueryService::LOCAL_NAME[] = UNICODE_LITERAL_17(A,u,t,h,n,Q,u,e,r,y,S,e,r,v,i,c,e);
2811 const XMLCh AuthzDecisionQueryDescriptorType::LOCAL_NAME[] = UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2812 const XMLCh AuthzDecisionQueryDescriptorType::TYPE_NAME[] = UNICODE_LITERAL_32(A,u,t,h,z,D,e,c,i,s,i,o,n,Q,u,e,r,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2813 const XMLCh AuthzService::LOCAL_NAME[] = UNICODE_LITERAL_12(A,u,t,h,z,S,e,r,v,i,c,e);
2814 const XMLCh CacheableSAMLObject::CACHEDURATION_ATTRIB_NAME[] = UNICODE_LITERAL_13(c,a,c,h,e,D,u,r,a,t,i,o,n);
2815 const XMLCh Company::LOCAL_NAME[] = UNICODE_LITERAL_7(C,o,m,p,a,n,y);
2816 const XMLCh ContactPerson::LOCAL_NAME[] = UNICODE_LITERAL_13(C,o,n,t,a,c,t,P,e,r,s,o,n);
2817 const XMLCh ContactPerson::TYPE_NAME[] = UNICODE_LITERAL_11(C,o,n,t,a,c,t,T,y,p,e);
2818 const XMLCh ContactPerson::CONTACTTYPE_ATTRIB_NAME[] = UNICODE_LITERAL_11(c,o,n,t,a,c,t,T,y,p,e);
2819 const XMLCh ContactPerson::CONTACT_TECHNICAL[] = UNICODE_LITERAL_9(t,e,c,h,n,i,c,a,l);
2820 const XMLCh ContactPerson::CONTACT_SUPPORT[] = UNICODE_LITERAL_7(s,u,p,p,o,r,t);
2821 const XMLCh ContactPerson::CONTACT_ADMINISTRATIVE[] = UNICODE_LITERAL_14(a,d,m,i,n,i,s,t,r,a,t,i,v,e);
2822 const XMLCh ContactPerson::CONTACT_BILLING[] = UNICODE_LITERAL_7(b,i,l,l,i,n,g);
2823 const XMLCh ContactPerson::CONTACT_OTHER[] = UNICODE_LITERAL_5(o,t,h,e,r);
2824 const XMLCh DigestMethod::LOCAL_NAME[] = UNICODE_LITERAL_12(D,i,g,e,s,t,M,e,t,h,o,d);
2825 const XMLCh DigestMethod::TYPE_NAME[] = UNICODE_LITERAL_16(D,i,g,e,s,t,M,e,t,h,o,d,T,y,p,e);
2826 const XMLCh DigestMethod::ALGORITHM_ATTRIB_NAME[] = UNICODE_LITERAL_9(A,l,g,o,r,i,t,h,m);
2827 const XMLCh EmailAddress::LOCAL_NAME[] = UNICODE_LITERAL_12(E,m,a,i,l,A,d,d,r,e,s,s);
2828 const XMLCh EndpointType::LOCAL_NAME[] = {chNull};
2829 const XMLCh EndpointType::TYPE_NAME[] = UNICODE_LITERAL_12(E,n,d,p,o,i,n,t,T,y,p,e);
2830 const XMLCh EndpointType::BINDING_ATTRIB_NAME[] = UNICODE_LITERAL_7(B,i,n,d,i,n,g);
2831 const XMLCh EndpointType::LOCATION_ATTRIB_NAME[] = UNICODE_LITERAL_8(L,o,c,a,t,i,o,n);
2832 const XMLCh EndpointType::RESPONSELOCATION_ATTRIB_NAME[] = UNICODE_LITERAL_16(R,e,s,p,o,n,s,e,L,o,c,a,t,i,o,n);
2833 const XMLCh EntitiesDescriptor::LOCAL_NAME[] = UNICODE_LITERAL_18(E,n,t,i,t,i,e,s,D,e,s,c,r,i,p,t,o,r);
2834 const XMLCh EntitiesDescriptor::TYPE_NAME[] = UNICODE_LITERAL_22(E,n,t,i,t,i,e,s,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2835 const XMLCh EntitiesDescriptor::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,D);
2836 const XMLCh EntitiesDescriptor::NAME_ATTRIB_NAME[] = UNICODE_LITERAL_4(N,a,m,e);
2837 const XMLCh EntityDescriptor::LOCAL_NAME[] = UNICODE_LITERAL_16(E,n,t,i,t,y,D,e,s,c,r,i,p,t,o,r);
2838 const XMLCh EntityDescriptor::TYPE_NAME[] = UNICODE_LITERAL_20(E,n,t,i,t,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2839 const XMLCh EntityDescriptor::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,D);
2840 const XMLCh EntityDescriptor::ENTITYID_ATTRIB_NAME[] = UNICODE_LITERAL_8(e,n,t,i,t,y,I,D);
2841 const XMLCh EntityAttributes::LOCAL_NAME[] = UNICODE_LITERAL_16(E,n,t,i,t,y,A,t,t,r,i,b,u,t,e,s);
2842 const XMLCh EntityAttributes::TYPE_NAME[] = UNICODE_LITERAL_20(E,n,t,i,t,y,A,t,t,r,i,b,u,t,e,s,T,y,p,e);
2843 const XMLCh Extensions::LOCAL_NAME[] = UNICODE_LITERAL_10(E,x,t,e,n,s,i,o,n,s);
2844 const XMLCh Extensions::TYPE_NAME[] = UNICODE_LITERAL_14(E,x,t,e,n,s,i,o,n,s,T,y,p,e);
2845 const XMLCh GivenName::LOCAL_NAME[] = UNICODE_LITERAL_9(G,i,v,e,n,N,a,m,e);
2846 const XMLCh IDPSSODescriptor::LOCAL_NAME[] = UNICODE_LITERAL_16(I,D,P,S,S,O,D,e,s,c,r,i,p,t,o,r);
2847 const XMLCh IDPSSODescriptor::TYPE_NAME[] = UNICODE_LITERAL_20(I,D,P,S,S,O,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2848 const XMLCh IDPSSODescriptor::WANTAUTHNREQUESTSSIGNED_ATTRIB_NAME[] = UNICODE_LITERAL_23(W,a,n,t,A,u,t,h,n,R,e,q,u,e,s,t,s,S,i,g,n,e,d);
2849 const XMLCh IndexedEndpointType::LOCAL_NAME[] = {chNull};
2850 const XMLCh IndexedEndpointType::TYPE_NAME[] = UNICODE_LITERAL_19(I,n,d,e,x,e,d,E,n,d,p,o,i,n,t,T,y,p,e);
2851 const XMLCh IndexedEndpointType::INDEX_ATTRIB_NAME[] = UNICODE_LITERAL_5(i,n,d,e,x);
2852 const XMLCh IndexedEndpointType::ISDEFAULT_ATTRIB_NAME[] = UNICODE_LITERAL_9(i,s,D,e,f,a,u,l,t);
2853 const XMLCh KeyDescriptor::LOCAL_NAME[] = UNICODE_LITERAL_13(K,e,y,D,e,s,c,r,i,p,t,o,r);
2854 const XMLCh KeyDescriptor::TYPE_NAME[] = UNICODE_LITERAL_17(K,e,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2855 const XMLCh KeyDescriptor::USE_ATTRIB_NAME[] = UNICODE_LITERAL_3(u,s,e);
2856 const XMLCh KeyDescriptor::KEYTYPE_ENCRYPTION[] = UNICODE_LITERAL_10(e,n,c,r,y,p,t,i,o,n);
2857 const XMLCh KeyDescriptor::KEYTYPE_SIGNING[] = UNICODE_LITERAL_7(s,i,g,n,i,n,g);
2858 const XMLCh localizedNameType::LOCAL_NAME[] = {chNull};
2859 const XMLCh localizedNameType::TYPE_NAME[] = UNICODE_LITERAL_17(l,o,c,a,l,i,z,e,d,N,a,m,e,T,y,p,e);
2860 const XMLCh localizedNameType::LANG_ATTRIB_NAME[] = UNICODE_LITERAL_4(l,a,n,g);
2861 const XMLCh localizedURIType::LOCAL_NAME[] = {chNull};
2862 const XMLCh localizedURIType::TYPE_NAME[] = UNICODE_LITERAL_16(l,o,c,a,l,i,z,e,d,U,R,I,T,y,p,e);
2863 const XMLCh localizedURIType::LANG_ATTRIB_NAME[] = UNICODE_LITERAL_4(l,a,n,g);
2864 const XMLCh ManageNameIDService::LOCAL_NAME[] = UNICODE_LITERAL_19(M,a,n,a,g,e,N,a,m,e,I,D,S,e,r,v,i,c,e);
2865 const XMLCh NameIDFormat::LOCAL_NAME[] = UNICODE_LITERAL_12(N,a,m,e,I,D,F,o,r,m,a,t);
2866 const XMLCh NameIDMappingService::LOCAL_NAME[] = UNICODE_LITERAL_20(N,a,m,e,I,D,M,a,p,p,i,n,g,S,e,r,v,i,c,e);
2867 const XMLCh Organization::LOCAL_NAME[] = UNICODE_LITERAL_12(O,r,g,a,n,i,z,a,t,i,o,n);
2868 const XMLCh Organization::TYPE_NAME[] = UNICODE_LITERAL_16(O,r,g,a,n,i,z,a,t,i,o,n,T,y,p,e);
2869 const XMLCh OrganizationName::LOCAL_NAME[] = UNICODE_LITERAL_16(O,r,g,a,n,i,z,a,t,i,o,n,N,a,m,e);
2870 const XMLCh OrganizationDisplayName::LOCAL_NAME[] = UNICODE_LITERAL_23(O,r,g,a,n,i,z,a,t,i,o,n,D,i,s,p,l,a,y,N,a,m,e);
2871 const XMLCh OrganizationURL::LOCAL_NAME[] = UNICODE_LITERAL_15(O,r,g,a,n,i,z,a,t,i,o,n,U,R,L);
2872 const XMLCh PDPDescriptor::LOCAL_NAME[] = UNICODE_LITERAL_13(P,D,P,D,e,s,c,r,i,p,t,o,r);
2873 const XMLCh PDPDescriptor::TYPE_NAME[] = UNICODE_LITERAL_17(P,D,P,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2874 const XMLCh QueryDescriptorType::LOCAL_NAME[] = {chNull};
2875 const XMLCh QueryDescriptorType::TYPE_NAME[] = UNICODE_LITERAL_19(Q,u,e,r,y,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2876 const XMLCh QueryDescriptorType::WANTASSERTIONSSIGNED_ATTRIB_NAME[] = UNICODE_LITERAL_20(W,a,n,t,A,s,s,e,r,t,i,o,n,s,S,i,g,n,e,d);
2877 const XMLCh RequestedAttribute::LOCAL_NAME[] = UNICODE_LITERAL_18(R,e,q,u,e,s,t,e,d,A,t,t,r,i,b,u,t,e);
2878 const XMLCh RequestedAttribute::TYPE_NAME[] = UNICODE_LITERAL_22(R,e,q,u,e,s,t,e,d,A,t,t,r,i,b,u,t,e,T,y,p,e);
2879 const XMLCh RequestedAttribute::ISREQUIRED_ATTRIB_NAME[] = UNICODE_LITERAL_10(i,s,R,e,q,u,i,r,e,d);
2880 const XMLCh RoleDescriptor::LOCAL_NAME[] = UNICODE_LITERAL_14(R,o,l,e,D,e,s,c,r,i,p,t,o,r);
2881 const XMLCh RoleDescriptor::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,D);
2882 const XMLCh RoleDescriptor::PROTOCOLSUPPORTENUMERATION_ATTRIB_NAME[] = UNICODE_LITERAL_26(p,r,o,t,o,c,o,l,S,u,p,p,o,r,t,E,n,u,m,e,r,a,t,i,o,n);
2883 const XMLCh RoleDescriptor::ERRORURL_ATTRIB_NAME[] = UNICODE_LITERAL_8(e,r,r,o,r,U,R,L);
2884 const XMLCh ServiceDescription::LOCAL_NAME[] = UNICODE_LITERAL_18(S,e,r,v,i,c,e,D,e,s,c,r,i,p,t,i,o,n);
2885 const XMLCh ServiceName::LOCAL_NAME[] = UNICODE_LITERAL_11(S,e,r,v,i,c,e,N,a,m,e);
2886 const XMLCh SigningMethod::LOCAL_NAME[] = UNICODE_LITERAL_13(S,i,g,n,i,n,g,M,e,t,h,o,d);
2887 const XMLCh SigningMethod::TYPE_NAME[] = UNICODE_LITERAL_17(S,i,g,n,i,n,g,M,e,t,h,o,d,T,y,p,e);
2888 const XMLCh SigningMethod::ALGORITHM_ATTRIB_NAME[] = UNICODE_LITERAL_9(A,l,g,o,r,i,t,h,m);
2889 const XMLCh SigningMethod::MINKEYSIZE_ATTRIB_NAME[] = UNICODE_LITERAL_10(M,i,n,K,e,y,S,i,z,e);
2890 const XMLCh SigningMethod::MAXKEYSIZE_ATTRIB_NAME[] = UNICODE_LITERAL_10(M,a,x,K,e,y,S,i,z,e);
2891 const XMLCh SingleLogoutService::LOCAL_NAME[] = UNICODE_LITERAL_19(S,i,n,g,l,e,L,o,g,o,u,t,S,e,r,v,i,c,e);
2892 const XMLCh SingleSignOnService::LOCAL_NAME[] = UNICODE_LITERAL_19(S,i,n,g,l,e,S,i,g,n,O,n,S,e,r,v,i,c,e);
2893 const XMLCh SourceID::LOCAL_NAME[] = UNICODE_LITERAL_8(S,o,u,r,c,e,I,D);
2894 const XMLCh SPSSODescriptor::LOCAL_NAME[] = UNICODE_LITERAL_15(S,P,S,S,O,D,e,s,c,r,i,p,t,o,r);
2895 const XMLCh SPSSODescriptor::TYPE_NAME[] = UNICODE_LITERAL_19(S,P,S,S,O,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2896 const XMLCh SPSSODescriptor::AUTHNREQUESTSSIGNED_ATTRIB_NAME[] = UNICODE_LITERAL_19(A,u,t,h,n,R,e,q,u,e,s,t,s,S,i,g,n,e,d);
2897 const XMLCh SPSSODescriptor::WANTASSERTIONSSIGNED_ATTRIB_NAME[] = UNICODE_LITERAL_20(W,a,n,t,A,s,s,e,r,t,i,o,n,s,S,i,g,n,e,d);
2898 const XMLCh SSODescriptorType::LOCAL_NAME[] = {chNull};
2899 const XMLCh SSODescriptorType::TYPE_NAME[] = UNICODE_LITERAL_17(S,S,O,D,e,s,c,r,i,p,t,o,r,T,y,p,e);
2900 const XMLCh SurName::LOCAL_NAME[] = UNICODE_LITERAL_7(S,u,r,N,a,m,e);
2901 const XMLCh TelephoneNumber::LOCAL_NAME[] = UNICODE_LITERAL_15(T,e,l,e,p,h,o,n,e,N,u,m,b,e,r);
2902 const XMLCh TimeBoundSAMLObject::VALIDUNTIL_ATTRIB_NAME[] = UNICODE_LITERAL_10(v,a,l,i,d,U,n,t,i,l);