[cpp-sp] branch main updated: Remove dead code and eliminated attribute types.

Scott Cantor cantor.2 at osu.edu
Thu Oct 31 13:42:10 UTC 2024


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository cpp-sp.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=7fbcc85381c6cd0a75a0d2a1566529c868169721

The following commit(s) were added to refs/heads/main by this push:
     new 7fbcc853 Remove dead code and eliminated attribute types.
7fbcc853 is described below

commit 7fbcc85381c6cd0a75a0d2a1566529c868169721
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Oct 31 09:42:06 2024 -0400

    Remove dead code and eliminated attribute types.
---
 shibsp/Makefile.am                       |   8 +-
 shibsp/attribute/Attribute.cpp           | 125 -------------------
 shibsp/attribute/ExtensibleAttribute.cpp | 155 -----------------------
 shibsp/attribute/ExtensibleAttribute.h   |  88 --------------
 shibsp/attribute/NameIDAttribute.cpp     | 203 -------------------------------
 shibsp/attribute/NameIDAttribute.h       | 112 -----------------
 shibsp/attribute/XMLAttribute.cpp        | 122 -------------------
 shibsp/attribute/XMLAttribute.h          |  84 -------------
 8 files changed, 1 insertion(+), 896 deletions(-)

diff --git a/shibsp/Makefile.am b/shibsp/Makefile.am
index b7bc2def..dd0dfed5 100644
--- a/shibsp/Makefile.am
+++ b/shibsp/Makefile.am
@@ -36,11 +36,8 @@ libshibspinclude_HEADERS = \
 attrinclude_HEADERS = \
 	attribute/Attribute.h \
 	attribute/BinaryAttribute.h \
-	attribute/ExtensibleAttribute.h \
-	attribute/NameIDAttribute.h \
 	attribute/ScopedAttribute.h \
-	attribute/SimpleAttribute.h \
-	attribute/XMLAttribute.h
+	attribute/SimpleAttribute.h
 
 bindinclude_HEADERS = \
 	binding/ProtocolProvider.h
@@ -87,11 +84,8 @@ libshibsp_la_SOURCES = \
 	version.cpp \
 	attribute/Attribute.cpp \
 	attribute/BinaryAttribute.cpp \
-	attribute/ExtensibleAttribute.cpp \
-	attribute/NameIDAttribute.cpp \
 	attribute/SimpleAttribute.cpp \
 	attribute/ScopedAttribute.cpp \
-	attribute/XMLAttribute.cpp \
 	binding/impl/XMLProtocolProvider.cpp \
 	handler/impl/AbstractHandler.cpp \
 	handler/impl/AdminLogoutInitiator.cpp \
diff --git a/shibsp/attribute/Attribute.cpp b/shibsp/attribute/Attribute.cpp
index 6acfb8b2..da913fd4 100644
--- a/shibsp/attribute/Attribute.cpp
+++ b/shibsp/attribute/Attribute.cpp
@@ -45,140 +45,15 @@ using namespace std;
 namespace shibsp {
     SHIBSP_DLLLOCAL Attribute* SimpleAttributeFactory(DDF& in);
     SHIBSP_DLLLOCAL Attribute* ScopedAttributeFactory(DDF& in);
-    SHIBSP_DLLLOCAL Attribute* NameIDAttributeFactory(DDF& in);
-    SHIBSP_DLLLOCAL Attribute* ExtensibleAttributeFactory(DDF& in);
-    SHIBSP_DLLLOCAL Attribute* XMLAttributeFactory(DDF& in);
     SHIBSP_DLLLOCAL Attribute* BinaryAttributeFactory(DDF& in);
-
-#ifndef SHIBSP_LITE
-    SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,xmltooling::QName,const DOMElement*>::Factory StringAttributeDecoderFactory;
-    SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,xmltooling::QName,const DOMElement*>::Factory ScopedAttributeDecoderFactory;
-    SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,xmltooling::QName,const DOMElement*>::Factory NameIDAttributeDecoderFactory;
-    SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,xmltooling::QName,const DOMElement*>::Factory NameIDFromScopedAttributeDecoderFactory;
-    SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,xmltooling::QName,const DOMElement*>::Factory KeyInfoAttributeDecoderFactory;
-    SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,xmltooling::QName,const DOMElement*>::Factory DOMAttributeDecoderFactory;
-    SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,xmltooling::QName,const DOMElement*>::Factory XMLAttributeDecoderFactory;
-    SHIBSP_DLLLOCAL PluginManager<AttributeDecoder,xmltooling::QName,const DOMElement*>::Factory Base64AttributeDecoderFactory;
-
-    static const XMLCh _StringAttributeDecoder[] = UNICODE_LITERAL_22(S,t,r,i,n,g,A,t,t,r,i,b,u,t,e,D,e,c,o,d,e,r);
-    static const XMLCh _ScopedAttributeDecoder[] = UNICODE_LITERAL_22(S,c,o,p,e,d,A,t,t,r,i,b,u,t,e,D,e,c,o,d,e,r);
-    static const XMLCh _NameIDAttributeDecoder[] = UNICODE_LITERAL_22(N,a,m,e,I,D,A,t,t,r,i,b,u,t,e,D,e,c,o,d,e,r);
-    static const XMLCh _NameIDFromScopedAttributeDecoder[] = UNICODE_LITERAL_32(N,a,m,e,I,D,F,r,o,m,S,c,o,p,e,d,A,t,t,r,i,b,u,t,e,D,e,c,o,d,e,r);
-    static const XMLCh _KeyInfoAttributeDecoder[] =UNICODE_LITERAL_23(K,e,y,I,n,f,o,A,t,t,r,i,b,u,t,e,D,e,c,o,d,e,r);
-    static const XMLCh _DOMAttributeDecoder[] =    UNICODE_LITERAL_19(D,O,M,A,t,t,r,i,b,u,t,e,D,e,c,o,d,e,r);
-    static const XMLCh _XMLAttributeDecoder[] =    UNICODE_LITERAL_19(X,M,L,A,t,t,r,i,b,u,t,e,D,e,c,o,d,e,r);
-    static const XMLCh _Base64AttributeDecoder[] = {
-        chLatin_B, chLatin_a, chLatin_s, chLatin_e, chDigit_6, chDigit_4,
-        chLatin_A, chLatin_t, chLatin_t, chLatin_r, chLatin_i, chLatin_b, chLatin_u, chLatin_t, chLatin_e,
-        chLatin_D, chLatin_e, chLatin_c, chLatin_o, chLatin_d, chLatin_e, chLatin_r, chNull
-    };
-
-    static const XMLCh hashAlg[] =          UNICODE_LITERAL_7(h,a,s,h,A,l,g);
-    static const XMLCh internal[] =         UNICODE_LITERAL_8(i,n,t,e,r,n,a,l);
-    static const XMLCh langAware[] =        UNICODE_LITERAL_9(l,a,n,g,A,w,a,r,e);
-#endif
 };
 
-#ifndef SHIBSP_LITE
-xmltooling::QName shibsp::StringAttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _StringAttributeDecoder);
-xmltooling::QName shibsp::ScopedAttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _ScopedAttributeDecoder);
-xmltooling::QName shibsp::NameIDAttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _NameIDAttributeDecoder);
-xmltooling::QName shibsp::NameIDFromScopedAttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _NameIDFromScopedAttributeDecoder);
-xmltooling::QName shibsp::KeyInfoAttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _KeyInfoAttributeDecoder);
-xmltooling::QName shibsp::DOMAttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _DOMAttributeDecoder);
-xmltooling::QName shibsp::XMLAttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _XMLAttributeDecoder);
-xmltooling::QName shibsp::Base64AttributeDecoderType(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _Base64AttributeDecoder);
-
-void shibsp::registerAttributeDecoders()
-{
-    SPConfig& conf = SPConfig::getConfig();
-    conf.AttributeDecoderManager.registerFactory(StringAttributeDecoderType, StringAttributeDecoderFactory);
-    conf.AttributeDecoderManager.registerFactory(ScopedAttributeDecoderType, ScopedAttributeDecoderFactory);
-    conf.AttributeDecoderManager.registerFactory(NameIDAttributeDecoderType, NameIDAttributeDecoderFactory);
-    conf.AttributeDecoderManager.registerFactory(NameIDFromScopedAttributeDecoderType, NameIDFromScopedAttributeDecoderFactory);
-    conf.AttributeDecoderManager.registerFactory(KeyInfoAttributeDecoderType, KeyInfoAttributeDecoderFactory);
-    conf.AttributeDecoderManager.registerFactory(DOMAttributeDecoderType, DOMAttributeDecoderFactory);
-    conf.AttributeDecoderManager.registerFactory(XMLAttributeDecoderType, XMLAttributeDecoderFactory);
-    conf.AttributeDecoderManager.registerFactory(Base64AttributeDecoderType, Base64AttributeDecoderFactory);
-}
-
-AttributeDecoder::AttributeDecoder(const DOMElement *e)
-    : m_caseSensitive(XMLHelper::getCaseSensitive(e, true)),
-        m_internal(XMLHelper::getAttrBool(e, false, internal)),
-        m_langAware(XMLHelper::getAttrBool(e, false, langAware)),
-        m_hashAlg(XMLHelper::getAttrString(e, nullptr, hashAlg))
-{
-    if (m_internal) {
-        SPConfig::getConfig().deprecation().warn("<AttributeDecoder> internal option");
-    }
-    if (m_langAware) {
-        SPConfig::getConfig().deprecation().warn("<AttributeDecoder> langAware option");
-    }
-    if (!m_hashAlg.empty()) {
-        SPConfig::getConfig().deprecation().warn("<AttributeDecoder> hashAlg option");
-    }
-}
-
-AttributeDecoder::~AttributeDecoder()
-{
-}
-
-Attribute* AttributeDecoder::_decode(Attribute* attr) const
-{
-    if (attr) {
-        attr->setCaseSensitive(m_caseSensitive);
-        attr->setInternal(m_internal);
-
-        if (!m_hashAlg.empty()) {
-            // We turn the values into strings using the supplied hash algorithm and return a SimpleAttribute instead.
-            auto_ptr<SimpleAttribute> simple(new SimpleAttribute(attr->getAliases()));
-            simple->setCaseSensitive(false);
-            simple->setInternal(m_internal);
-            vector<string>& newdest = simple->getValues();
-            const vector<string>& serialized = attr->getSerializedValues();
-            for (vector<string>::const_iterator ser = serialized.begin(); ser != serialized.end(); ++ser) {
-                newdest.push_back(SecurityHelper::doHash(m_hashAlg.c_str(), ser->data(), ser->length()));
-                if (newdest.back().empty())
-                    newdest.pop_back();
-            }
-            delete attr;
-            return newdest.empty() ? nullptr : simple.release();
-        }
-
-    }
-    return attr;
-}
-
-pair<vector<XMLObject*>::const_iterator,vector<XMLObject*>::const_iterator> AttributeDecoder::valueRange(
-    const GenericRequest* request, const vector<XMLObject*>& objects
-    ) const
-{
-    if (!m_langAware || !request || objects.empty()) {
-        return make_pair(objects.begin(), objects.end());
-    }
-    else if (request && request->startLangMatching()) {
-        do {
-            for (vector<XMLObject*>::const_iterator i = objects.begin(); i != objects.end(); ++i) {
-                if (request->matchLang((*i)->getLang())) {
-                    return make_pair(i, i + 1);
-                }
-            }
-        } while (request->continueLangMatching());
-    }
-
-    return make_pair(objects.begin(), objects.begin() + 1);
-}
-#endif
-
 void shibsp::registerAttributeFactories()
 {
     Attribute::registerFactory("", SimpleAttributeFactory);
     Attribute::registerFactory("Simple", SimpleAttributeFactory);
     Attribute::registerFactory("Binary", BinaryAttributeFactory);
     Attribute::registerFactory("Scoped", ScopedAttributeFactory);
-    Attribute::registerFactory("NameID", NameIDAttributeFactory);
-    Attribute::registerFactory("Extensible", ExtensibleAttributeFactory);
-    Attribute::registerFactory("XML", XMLAttributeFactory);
 }
 
 map<string,Attribute::AttributeFactory*> Attribute::m_factoryMap;
diff --git a/shibsp/attribute/ExtensibleAttribute.cpp b/shibsp/attribute/ExtensibleAttribute.cpp
deleted file mode 100644
index 2d4fe545..00000000
--- a/shibsp/attribute/ExtensibleAttribute.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- * Licensed to the University Corporation for Advanced Internet
- * Development, Inc. (UCAID) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for
- * additional information regarding copyright ownership.
- *
- * UCAID licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the
- * License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific
- * language governing permissions and limitations under the License.
- */
-
-/**
- * shibsp/attribute/ExtensibleAttribute.cpp
- *
- * An Attribute whose values are arbitrary structures.
- */
-
-#include "internal.h"
-#include "SPConfig.h"
-#include "attribute/ExtensibleAttribute.h"
-#include "util/SPConstants.h"
-
-#include <boost/algorithm/string/trim.hpp>
-
-using namespace shibsp;
-using namespace xmltooling;
-using namespace std;
-
-namespace shibsp {
-    SHIBSP_DLLLOCAL Attribute* ExtensibleAttributeFactory(DDF& in) {
-        return new ExtensibleAttribute(in);
-    }
-};
-
-ExtensibleAttribute::ExtensibleAttribute(const vector<string>& ids, const char* formatter) : Attribute(ids)
-{
-    m_obj = Attribute::marshall();
-    m_obj.name("Extensible");
-    m_obj.addmember("_formatter").string(formatter);
-}
-
-ExtensibleAttribute::ExtensibleAttribute(DDF& in) : Attribute(in), m_obj(in.copy())
-{
-}
-
-ExtensibleAttribute::~ExtensibleAttribute()
-{
-    m_obj.destroy();
-}
-
-DDF ExtensibleAttribute::getValues()
-{
-    return m_obj.first();
-}
-
-size_t ExtensibleAttribute::valueCount() const
-{
-    return m_obj.first().integer();
-}
-
-void ExtensibleAttribute::clearSerializedValues()
-{
-    m_serialized.clear();
-}
-
-const char* ExtensibleAttribute::getString(size_t index) const
-{
-    return m_obj.first()[static_cast<unsigned long>(index)].string();
-}
-
-const char* ExtensibleAttribute::getScope(size_t index) const
-{
-    return nullptr;
-}
-
-void ExtensibleAttribute::removeValue(size_t index)
-{
-    Attribute::removeValue(index);
-    DDF vals = m_obj.first();
-    if (index < static_cast<size_t>(vals.integer()))
-        vals[static_cast<unsigned long>(index)].remove().destroy();
-}
-
-const vector<string>& ExtensibleAttribute::getSerializedValues() const
-{
-    if (m_serialized.empty()) {
-        const char* formatter = m_obj["_formatter"].string();
-        if (formatter) {
-            string msg = formatter;
-            DDF val = m_obj.first().first();
-            while (!val.isnull()) {
-
-                static const char* legal="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_-.[]";
-
-                m_serialized.push_back(string());
-                string& processed = m_serialized.back();
-
-                string::size_type i=0,start=0;
-                while (start != string::npos && start < msg.length() && (i = msg.find("$",start)) != string::npos) {
-                    if (i>start)
-                        processed += msg.substr(start, i-start);    // append everything in between
-                    start = i+1;                                    // move start to the beginning of the token name
-                    i = msg.find_first_not_of(legal, start);        // find token delimiter
-                    if (i == start) {                               // append a non legal character
-                       processed += msg[start++];
-                       continue;
-                    }
-                    
-                    string tag = msg.substr(start, (i==string::npos) ? i : i-start);
-                    if (tag == "_string" && val.string()) {
-                        processed += val.string();
-                        start = i;
-                    }
-                    else {
-                        DDF child = val.getmember(tag.c_str());
-                        if (child.string())
-                            processed += child.string();
-                        else if (child.isstruct() && child["_string"].string())
-                            processed += child["_string"].string();
-                        start = i;
-                    }
-                }
-                if (start != string::npos && start < msg.length())
-                    processed += msg.substr(start,i);    // append rest of string
-                boost::trim(processed);
-
-                val = m_obj.first().next();
-            }
-        }
-    }
-    return Attribute::getSerializedValues();
-}
-
-DDF ExtensibleAttribute::marshall() const
-{
-    DDF ddf = Attribute::marshall();
-    ddf.name("Extensible");
-    ddf.addmember("_formatter").string(m_obj["_formatter"].string());
-    DDF val = m_obj.first().first();
-    while (!val.isnull()) {
-        DDF dup = val.copy();
-        ddf.first().add(dup);
-        val = m_obj.first().next();
-    }
-    return ddf;
-}
diff --git a/shibsp/attribute/ExtensibleAttribute.h b/shibsp/attribute/ExtensibleAttribute.h
deleted file mode 100644
index 716cac03..00000000
--- a/shibsp/attribute/ExtensibleAttribute.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Licensed to the University Corporation for Advanced Internet
- * Development, Inc. (UCAID) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for
- * additional information regarding copyright ownership.
- *
- * UCAID licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the
- * License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific
- * language governing permissions and limitations under the License.
- */
-
-/**
- * @file shibsp/attribute/ExtensibleAttribute.h
- *
- * An Attribute whose values are arbitrary structures.
- */
-
-#ifndef __shibsp_extattr_h__
-#define __shibsp_extattr_h__
-
-#include <shibsp/attribute/Attribute.h>
-
-namespace shibsp {
-
-#if defined (_MSC_VER)
-    #pragma warning( push )
-    #pragma warning( disable : 4251 )
-#endif
-
-    /**
-     * An Attribute whose values are arbitrary structures.
-     */
-    class SHIBSP_API ExtensibleAttribute : public Attribute
-    {
-    public:
-        /**
-         * Constructor.
-         *
-         * @param ids       array with primary identifier in first position, followed by any aliases
-         * @param formatter template for serialization of values
-         */
-        ExtensibleAttribute(const std::vector<std::string>& ids, const char* formatter);
-
-        /**
-         * Constructs based on a remoted ExtensibleAttribute.
-         *
-         * @param in    input object containing marshalled ExtensibleAttribute
-         */
-        ExtensibleAttribute(DDF& in);
-
-        virtual ~ExtensibleAttribute();
-
-        /**
-         * Returns the set of values in a DDF list.
-         *
-         * @return  a mutable list object containing the values
-         */
-        DDF getValues();
-
-        // Virtual function overrides.
-        size_t valueCount() const;
-        void clearSerializedValues();
-        const char* getString(size_t index) const;
-        const char* getScope(size_t index) const;
-        void removeValue(size_t index);
-        const std::vector<std::string>& getSerializedValues() const;
-        DDF marshall() const;
-
-    private:
-        mutable DDF m_obj;
-    };
-
-#if defined (_MSC_VER)
-    #pragma warning( pop )
-#endif
-
-};
-
-#endif /* __shibsp_nameidattr_h__ */
diff --git a/shibsp/attribute/NameIDAttribute.cpp b/shibsp/attribute/NameIDAttribute.cpp
deleted file mode 100644
index f8ff1292..00000000
--- a/shibsp/attribute/NameIDAttribute.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-/**
- * Licensed to the University Corporation for Advanced Internet
- * Development, Inc. (UCAID) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for
- * additional information regarding copyright ownership.
- *
- * UCAID licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the
- * License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific
- * language governing permissions and limitations under the License.
- */
-
-/**
- * NameIDAttribute.cpp
- *
- * An Attribute whose values are derived from or mappable to a SAML NameID.
- */
-
-#include "internal.h"
-#include "ServiceProvider.h"
-#include "attribute/NameIDAttribute.h"
-#include "remoting/ListenerService.h"
-
-#include <boost/algorithm/string/trim.hpp>
-#include <xmltooling/exceptions.h>
-#include <xmltooling/security/SecurityHelper.h>
-
-using namespace shibsp;
-using namespace xmltooling::logging;
-using namespace xmltooling;
-using namespace std;
-
-namespace shibsp {
-    SHIBSP_DLLLOCAL Attribute* NameIDAttributeFactory(DDF& in) {
-        return new NameIDAttribute(in);
-    }
-};
-
-NameIDAttribute::NameIDAttribute(const vector<string>& ids, const char* formatter, const char* hashAlg)
-    : Attribute(ids), m_formatter(formatter), m_hashAlg(hashAlg ? hashAlg : "")
-{
-}
-
-NameIDAttribute::NameIDAttribute(DDF& in) : Attribute(in)
-{
-    DDF val = in["_formatter"];
-    if (val.isstring() && val.string())
-        m_formatter = val.string();
-    else
-        m_formatter = DEFAULT_NAMEID_FORMATTER;
-    val = in["_hashalg"];
-    if (val.isstring() && val.string())
-        m_hashAlg = val.string();
-    const char* pch;
-    val = in.first().first();
-    while (!val.isnull()) {
-        m_values.push_back(Value());
-        Value& v = m_values.back();
-        // There are two serializations supported. The new one is in 2.5.1 and fixes SPPCPP-504.
-        // The original is the first branch and was vulnerable to non-ASCII characters in the value.
-        // Supporting both means at least minimal support for rolling upgrades if a shibd instance is
-        // shared.
-        if (val.name()) {
-            v.m_Name = val.name();
-        }
-        else {
-            pch = val["Name"].string();
-            if (pch)
-                v.m_Name = pch;
-        }
-        pch = val["Format"].string();
-        if (pch)
-            v.m_Format = pch;
-        pch = val["NameQualifier"].string();
-        if (pch)
-            v.m_NameQualifier = pch;
-        pch = val["SPNameQualifier"].string();
-        if (pch)
-            v.m_SPNameQualifier = pch;
-        pch = val["SPProvidedID"].string();
-        if (pch)
-            v.m_SPProvidedID = pch;
-        val = in.first().next();
-    }
-}
-
-NameIDAttribute::~NameIDAttribute()
-{
-}
-
-vector<NameIDAttribute::Value>& NameIDAttribute::getValues()
-{
-    return m_values;
-}
-
-const vector<NameIDAttribute::Value>& NameIDAttribute::getValues() const
-{
-    return m_values;
-}
-
-size_t NameIDAttribute::valueCount() const
-{
-    return m_values.size();
-}
-
-void NameIDAttribute::clearSerializedValues()
-{
-    m_serialized.clear();
-}
-
-const char* NameIDAttribute::getString(size_t index) const
-{
-    return m_values[index].m_Name.c_str();
-}
-
-const char* NameIDAttribute::getScope(size_t index) const
-{
-    return m_values[index].m_NameQualifier.c_str();
-}
-
-void NameIDAttribute::removeValue(size_t index)
-{
-    Attribute::removeValue(index);
-    if (index < m_values.size())
-        m_values.erase(m_values.begin() + index);
-}
-
-const vector<string>& NameIDAttribute::getSerializedValues() const
-{
-    if (m_serialized.empty()) {
-        for (vector<Value>::const_iterator i = m_values.begin(); i != m_values.end(); ++i) {
-            // This is kind of a hack, but it's a good way to reuse some code.
-            XMLToolingException e(
-                m_formatter,
-                namedparams(
-                    5,
-                    "Name", i->m_Name.c_str(),
-                    "Format", i->m_Format.c_str(),
-                    "NameQualifier", i->m_NameQualifier.c_str(),
-                    "SPNameQualifier", i->m_SPNameQualifier.c_str(),
-                    "SPProvidedID", i->m_SPProvidedID.c_str()
-                    )
-                );
-            if (m_hashAlg.empty()) {
-                m_serialized.push_back(e.what());
-                boost::trim(m_serialized.back());
-            }
-            else {
-                string trimmed(e.what());
-                boost::trim(trimmed);
-#ifndef SHIBSP_LITE
-                m_serialized.push_back(SecurityHelper::doHash(m_hashAlg.c_str(), trimmed.c_str(), strlen(e.what())));
-#else
-                try {
-                    DDF out, in("hash");
-                    DDFJanitor jin(in), jout(out);
-                    in.addmember("alg").string(m_hashAlg.c_str());
-                    in.addmember("data").unsafe_string(trimmed.c_str());
-                    out = SPConfig::getConfig().getServiceProvider()->getListenerService()->send(in);
-                    if (out.isstring() && out.string())
-                        m_serialized.push_back(out.string());
-                }
-                catch (exception& ex) {
-                    Category::getInstance(SHIBSP_LOGCAT ".Attribute.NameID").error("exception remoting hash operation: %s", ex.what());
-                }
-#endif
-            }
-        }
-    }
-    return Attribute::getSerializedValues();
-}
-
-DDF NameIDAttribute::marshall() const
-{
-    DDF ddf = Attribute::marshall();
-    ddf.name("NameID");
-    ddf.addmember("_formatter").string(m_formatter.c_str());
-    if (!m_hashAlg.empty())
-        ddf.addmember("_hashalg").string(m_hashAlg.c_str());
-    DDF vlist = ddf.first();
-    for (vector<Value>::const_iterator i=m_values.begin(); i!=m_values.end(); ++i) {
-        DDF val = DDF(nullptr).structure();
-        val.addmember("Name").string(i->m_Name.c_str());
-        if (!i->m_Format.empty())
-            val.addmember("Format").string(i->m_Format.c_str());
-        if (!i->m_NameQualifier.empty())
-            val.addmember("NameQualifier").string(i->m_NameQualifier.c_str());
-        if (!i->m_SPNameQualifier.empty())
-            val.addmember("SPNameQualifier").string(i->m_SPNameQualifier.c_str());
-        if (!i->m_SPProvidedID.empty())
-            val.addmember("SPProvidedID").string(i->m_SPProvidedID.c_str());
-        vlist.add(val);
-    }
-    return ddf;
-}
diff --git a/shibsp/attribute/NameIDAttribute.h b/shibsp/attribute/NameIDAttribute.h
deleted file mode 100644
index e7f5d7ed..00000000
--- a/shibsp/attribute/NameIDAttribute.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * Licensed to the University Corporation for Advanced Internet
- * Development, Inc. (UCAID) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for
- * additional information regarding copyright ownership.
- *
- * UCAID licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the
- * License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific
- * language governing permissions and limitations under the License.
- */
-
-/**
- * @file shibsp/attribute/NameIDAttribute.h
- * 
- * An Attribute whose values are derived from or mappable to a SAML NameID.
- */
-
-#ifndef __shibsp_nameidattr_h__
-#define __shibsp_nameidattr_h__
-
-#include <shibsp/attribute/Attribute.h>
-
-namespace shibsp {
-
-#if defined (_MSC_VER)
-    #pragma warning( push )
-    #pragma warning( disable : 4251 )
-#endif
-
-    /** Default serialization format for NameIDs */
-    #define DEFAULT_NAMEID_FORMATTER    "$Name!!$NameQualifier!!$SPNameQualifier"
-
-    /**
-     * An Attribute whose values are derived from or mappable to a SAML NameID.
-     */
-    class SHIBSP_API NameIDAttribute : public Attribute
-    {
-    public:
-        /**
-         * Constructor.
-         * 
-         * @param ids       array with primary identifier in first position, followed by any aliases
-         * @param formatter template for serialization of tuple
-         * @param hashAlg   hash algorithm to apply in producing serialized values
-         */
-        NameIDAttribute(const std::vector<std::string>& ids, const char* formatter=DEFAULT_NAMEID_FORMATTER, const char* hashAlg=nullptr);
-
-        /**
-         * Constructs based on a remoted NameIDAttribute.
-         * 
-         * @param in    input object containing marshalled NameIDAttribute
-         */
-        NameIDAttribute(DDF& in);
-        
-        virtual ~NameIDAttribute();
-        
-        /**
-         * Holds all the fields associated with a NameID.
-         */
-        struct SHIBSP_API Value
-        {
-            std::string m_Name;
-            std::string m_Format;
-            std::string m_NameQualifier;
-            std::string m_SPNameQualifier;
-            std::string m_SPProvidedID;
-        };
-        
-        /**
-         * Returns the set of values encoded as UTF-8 strings.
-         * 
-         * @return  a mutable vector of the values
-         */
-        std::vector<Value>& getValues();
-
-        /**
-         * Returns the set of values encoded as UTF-8 strings.
-         * 
-         * @return  an immutable vector of the values
-         */
-        const std::vector<Value>& getValues() const;
-
-        // Virtual function overrides.
-        size_t valueCount() const;
-        void clearSerializedValues();
-        const char* getString(size_t index) const;
-        const char* getScope(size_t index) const;
-        void removeValue(size_t index);
-        const std::vector<std::string>& getSerializedValues() const;
-        DDF marshall() const;
-    
-    private:
-        std::vector<Value> m_values;
-        std::string m_formatter,m_hashAlg;
-    };
-
-#if defined (_MSC_VER)
-    #pragma warning( pop )
-#endif
-
-};
-
-#endif /* __shibsp_nameidattr_h__ */
diff --git a/shibsp/attribute/XMLAttribute.cpp b/shibsp/attribute/XMLAttribute.cpp
deleted file mode 100644
index 23aa8937..00000000
--- a/shibsp/attribute/XMLAttribute.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * Licensed to the University Corporation for Advanced Internet
- * Development, Inc. (UCAID) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for
- * additional information regarding copyright ownership.
- *
- * UCAID licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the
- * License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific
- * language governing permissions and limitations under the License.
- */
-
-/**
- * XMLAttribute.cpp
- *
- * An Attribute whose values are serialized XML.
- */
-
-#include "internal.h"
-#include "attribute/XMLAttribute.h"
-
-#include <xercesc/util/Base64.hpp>
-
-#ifndef SHIBSP_LITE
-# include <xsec/framework/XSECDefs.hpp>
-#endif
-
-using namespace shibsp;
-using namespace std;
-
-namespace shibsp {
-    SHIBSP_DLLLOCAL Attribute* XMLAttributeFactory(DDF& in) {
-        return new XMLAttribute(in);
-    }
-};
-
-XMLAttribute::XMLAttribute(const vector<string>& ids) : Attribute(ids)
-{
-}
-
-XMLAttribute::XMLAttribute(DDF& in) : Attribute(in)
-{
-    DDF val = in.first().first();
-    while (val.string()) {
-        m_values.push_back(val.string());
-        val = in.first().next();
-    }
-}
-
-XMLAttribute::~XMLAttribute()
-{
-}
-
-vector<string>& XMLAttribute::getValues()
-{
-    return m_values;
-}
-
-const vector<string>& XMLAttribute::getValues() const
-{
-    return m_values;
-}
-
-size_t XMLAttribute::valueCount() const
-{
-    return m_values.size();
-}
-
-void XMLAttribute::clearSerializedValues()
-{
-    m_serialized.clear();
-}
-
-const char* XMLAttribute::getString(size_t index) const
-{
-    return m_values[index].c_str();
-}
-
-void XMLAttribute::removeValue(size_t index)
-{
-    Attribute::removeValue(index);
-    if (index < m_values.size())
-        m_values.erase(m_values.begin() + index);
-}
-
-const vector<string>& XMLAttribute::getSerializedValues() const
-{
-    XMLSize_t len;
-    XMLByte *pos, *pos2;
-    if (m_serialized.empty()) {
-        for (vector<string>::const_iterator i=m_values.begin(); i!=m_values.end(); ++i) {
-            XMLByte* enc = Base64::encode(reinterpret_cast<const XMLByte*>(i->data()), i->size(), &len);
-            if (enc) {
-                for (pos=enc, pos2=enc; *pos2; pos2++)
-                    if (isgraph(*pos2))
-                        *pos++=*pos2;
-                *pos=0;
-                m_serialized.push_back(reinterpret_cast<char*>(enc));
-                XMLString::release((char**)&enc);
-            }
-        }
-    }
-    return Attribute::getSerializedValues();
-}
-
-DDF XMLAttribute::marshall() const
-{
-    DDF ddf = Attribute::marshall();
-    ddf.name("XML");
-    DDF vlist = ddf.first();
-    for (vector<string>::const_iterator i=m_values.begin(); i!=m_values.end(); ++i)
-        vlist.add(DDF(nullptr).string(i->c_str()));
-    return ddf;
-}
diff --git a/shibsp/attribute/XMLAttribute.h b/shibsp/attribute/XMLAttribute.h
deleted file mode 100644
index 928db4b7..00000000
--- a/shibsp/attribute/XMLAttribute.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Licensed to the University Corporation for Advanced Internet
- * Development, Inc. (UCAID) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for
- * additional information regarding copyright ownership.
- *
- * UCAID licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the
- * License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific
- * language governing permissions and limitations under the License.
- */
-
-/**
- * @file shibsp/attribute/XMLAttribute.h
- *
- * An Attribute whose values are serialized XML.
- */
-
-#ifndef __shibsp_xmlattr_h__
-#define __shibsp_xmlattr_h__
-
-#include <shibsp/attribute/Attribute.h>
-
-namespace shibsp {
-
-    /**
-     * An Attribute whose values are serialized XML.
-     */
-    class SHIBSP_API XMLAttribute : public Attribute
-    {
-    public:
-        /**
-         * Constructor.
-         *
-         * @param ids   array with primary identifier in first position, followed by any aliases
-         */
-        XMLAttribute(const std::vector<std::string>& ids);
-
-        /**
-         * Constructs based on a remoted XMLAttribute.
-         *
-         * @param in    input object containing marshalled XMLAttribute
-         */
-        XMLAttribute(DDF& in);
-
-        virtual ~XMLAttribute();
-
-        /**
-         * Returns the set of values encoded as XML.
-         *
-         * @return  a mutable vector of the values
-         */
-        std::vector<std::string>& getValues();
-
-        /**
-         * Returns the set of values encoded as XML.
-         *
-         * @return  an immutable vector of the values
-         */
-        const std::vector<std::string>& getValues() const;
-
-        // Virtual function overrides.
-        size_t valueCount() const;
-        void clearSerializedValues();
-        const char* getString(size_t index) const;
-        void removeValue(size_t index);
-        const std::vector<std::string>& getSerializedValues() const;
-        DDF marshall() const;
-
-    private:
-        std::vector<std::string> m_values;
-    };
-
-};
-
-#endif /* __shibsp_xmlattr_h__ */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list