From 93b06f8b77047b399dc173d810d200864abdc4fc Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Sat, 29 Sep 2007 23:57:39 +0000 Subject: [PATCH] Method to add protocol to a role. --- saml/saml2/metadata/Metadata.h | 2 ++ saml/saml2/metadata/impl/MetadataImpl.cpp | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/saml/saml2/metadata/Metadata.h b/saml/saml2/metadata/Metadata.h index 9fcb4e2..ae28ce6 100644 --- a/saml/saml2/metadata/Metadata.h +++ b/saml/saml2/metadata/Metadata.h @@ -163,6 +163,8 @@ namespace opensaml { DECL_STRING_ATTRIB(ProtocolSupportEnumeration,PROTOCOLSUPPORTENUMERATION); /** Searches the ProtocolSupportEnumeration attribute for the indicated protocol. */ virtual bool hasSupport(const XMLCh* protocol) const=0; + /** Adds the indicated protocol to the ProtocolSupportEnumeration attribute. */ + virtual void addSupport(const XMLCh* protocol)=0; DECL_STRING_ATTRIB(ErrorURL,ERRORURL); DECL_TYPED_CHILD(Extensions); DECL_TYPED_CHILDREN(KeyDescriptor); diff --git a/saml/saml2/metadata/impl/MetadataImpl.cpp b/saml/saml2/metadata/impl/MetadataImpl.cpp index 43162ec..d6f4ce9 100644 --- a/saml/saml2/metadata/impl/MetadataImpl.cpp +++ b/saml/saml2/metadata/impl/MetadataImpl.cpp @@ -996,6 +996,27 @@ namespace opensaml { } return false; } + + void addSupport(const XMLCh* protocol) { + if (hasSupport(protocol)) + return; + if (m_ProtocolSupportEnumeration && *m_ProtocolSupportEnumeration) { +#ifdef HAVE_GOOD_STL + xstring pse(m_ProtocolSupportEnumeration); + pse = pse + chSpace + protocol; + setProtocolSupportEnumeration(pse.c_str()); +#else + auto_ptr_char temp(m_ProtocolSupportEnumeration); + string pse(temp.get()); + pse = pse + ' ' + protocol; + auto_ptr_XMLCh temp2(pse.c_str()); + setProtocolSupportEnumeration(temp2.get()); +#endif + } + else { + setProtocolSupportEnumeration(protocol); + } + } void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) { if (!qualifiedName.hasNamespaceURI()) { -- 2.1.4