Baby steps. First replacement of old code, link to new libs.
authorScott Cantor <cantor.2@osu.edu>
Sun, 10 Dec 2006 02:05:45 +0000 (02:05 +0000)
committerScott Cantor <cantor.2@osu.edu>
Sun, 10 Dec 2006 02:05:45 +0000 (02:05 +0000)
shib-target/CommonDomainCookie.cpp [deleted file]
shib-target/internal.h
shib-target/shib-handlers.cpp
shib-target/shib-target.h
shib-target/shibtarget.vcproj

diff --git a/shib-target/CommonDomainCookie.cpp b/shib-target/CommonDomainCookie.cpp
deleted file mode 100644 (file)
index aa57418..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- *  Copyright 2001-2005 Internet2
- * 
- * Licensed 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.
- */
-
-/*
- * CommonDomainCookie.cpp -- SAML 2.0 discovery cookie implementation
- *
- * Scott Cantor
- * 5/17/2005
- */
-
-#include "internal.h"
-#include <xercesc/util/Base64.hpp>
-
-using namespace std;
-using namespace shibtarget;
-using namespace log4cpp;
-
-const char CommonDomainCookie::CDCName[] = "_saml_idp";
-
-CommonDomainCookie::CommonDomainCookie(const char* cookie)
-{
-    if (!cookie)
-        return;
-
-    Category& log=Category::getInstance(SHIBT_LOGCAT".CommonDomainCookie");
-
-    // Copy it so we can URL-decode it.
-    char* b64=strdup(cookie);
-    ShibTarget::url_decode(b64);
-
-    // Chop it up and save off elements.
-    vector<string> templist;
-    char* ptr=b64;
-    while (*ptr) {
-        while (*ptr && isspace(*ptr)) ptr++;
-        char* end=ptr;
-        while (*end && !isspace(*end)) end++;
-        templist.push_back(string(ptr,end-ptr));
-        ptr=end;
-    }
-    free(b64);
-
-    // Now Base64 decode the list.
-    for (vector<string>::iterator i=templist.begin(); i!=templist.end(); i++) {
-        unsigned int len;
-        XMLByte* decoded=Base64::decode(reinterpret_cast<const XMLByte*>(i->c_str()),&len);
-        if (decoded && *decoded) {
-            m_list.push_back(reinterpret_cast<char*>(decoded));
-            XMLString::release(&decoded);
-        }
-        else
-            log.warn("cookie element does not appear to be base64-encoded");
-    }
-}
-
-const char* CommonDomainCookie::set(const char* providerId)
-{
-    // First scan the list for this IdP.
-    for (vector<string>::iterator i=m_list.begin(); i!=m_list.end(); i++) {
-        if (*i == providerId) {
-            m_list.erase(i);
-            break;
-        }
-    }
-    
-    // Append it to the end.
-    m_list.push_back(providerId);
-    
-    // Now rebuild the delimited list.
-    string delimited;
-    for (vector<string>::const_iterator j=m_list.begin(); j!=m_list.end(); j++) {
-        if (!delimited.empty()) delimited += ' ';
-        
-        unsigned int len;
-        XMLByte* b64=Base64::encode(reinterpret_cast<const XMLByte*>(j->c_str()),j->length(),&len);
-        XMLByte *pos, *pos2;
-        for (pos=b64, pos2=b64; *pos2; pos2++)
-            if (isgraph(*pos2))
-                *pos++=*pos2;
-        *pos=0;
-        
-        delimited += reinterpret_cast<char*>(b64);
-        XMLString::release(&b64);
-    }
-    
-    m_encoded=ShibTarget::url_encode(delimited.c_str());
-    return m_encoded.c_str();
-}
index d8522b4..13c6b65 100644 (file)
@@ -25,9 +25,9 @@
 #ifndef __shibtarget_internal_h__
 #define __shibtarget_internal_h__
 
+#include <saml/base.h>
+
 #ifdef WIN32
-# define _CRT_NONSTDC_NO_DEPRECATE 1
-# define _CRT_SECURE_NO_DEPRECATE 1
 # define SHIBTARGET_EXPORTS __declspec(dllexport)
 #endif
 
index f6582e4..f2c322a 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include "internal.h"
+#include <saml/util/CommonDomainCookie.h>
 
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
@@ -35,6 +36,8 @@ using namespace shibboleth;
 using namespace shibtarget;
 using namespace log4cpp;
 
+using opensaml::CommonDomainCookie;
+
 namespace {
   class SessionInitiator : virtual public IHandler
   {
index ff5bcf9..b5137cd 100644 (file)
@@ -390,21 +390,6 @@ namespace shibtarget {
         unsigned long m_features;
     };
 
-    // Helper class for SAML 2.0 Common Domain Cookie operations
-    class CommonDomainCookie
-    {
-    public:
-        CommonDomainCookie(const char* cookie);
-        ~CommonDomainCookie() {}
-        saml::Iterator<std::string> get() {return m_list;}
-        const char* set(const char* providerId);
-        static const char CDCName[];
-    private:
-        std::string m_encoded;
-        std::vector<std::string> m_list;
-    };
-
-
     class ShibTargetPriv;
     class SHIBTARGET_EXPORTS ShibTarget {
     public:
index 1cb75d0..e0fd3ac 100644 (file)
@@ -47,7 +47,7 @@
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml1&quot;"
+                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="_WINDOWS;WANT_TCP_SHAR;WIN32;_DEBUG"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib saml_5D.lib wsock32.lib libeay32_0_9_8D.lib ssleay32_0_9_8D.lib"
+                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib saml_5D.lib saml2D.lib xmltooling1D.lib wsock32.lib libeay32_0_9_8D.lib ssleay32_0_9_8D.lib"
                                OutputFile="Debug/shibtarget_5D.dll"
                                LinkIncremental="2"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Debug&quot;;&quot;..\..\cpp-opensaml2\Debug&quot;;&quot;..\..\cpp-xmltooling\Debug&quot;"
                                GenerateDebugInformation="true"
                                ImportLibrary=".\Debug/shibtarget_5D.lib"
                                TargetMachine="1"
                                Name="VCCLCompilerTool"
                                Optimization="2"
                                InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories=".;..;..\..\..\opensaml\c"
+                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="NDEBUG;_WINDOWS;WIN32;WANT_TCP_SHAR"
                                StringPooling="true"
                                RuntimeLibrary="2"
                        </FileConfiguration>
                </File>
                <File
-                       RelativePath=".\CommonDomainCookie.cpp"
-                       >
-               </File>
-               <File
                        RelativePath=".\ddf.cpp"
                        >
                </File>