/*
- * The Shibboleth License, Version 1.
- * Copyright (c) 2002
- * University Corporation for Advanced Internet Development, Inc.
- * All rights reserved
+ * 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
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution, if any, must include
- * the following acknowledgment: "This product includes software developed by
- * the University Corporation for Advanced Internet Development
- * <http://www.ucaid.edu>Internet2 Project. Alternately, this acknowledegement
- * may appear in the software itself, if and wherever such third-party
- * acknowledgments normally appear.
- *
- * Neither the name of Shibboleth nor the names of its contributors, nor
- * Internet2, nor the University Corporation for Advanced Internet Development,
- * Inc., nor UCAID may be used to endorse or promote products derived from this
- * software without specific prior written permission. For written permission,
- * please contact shibboleth@shibboleth.org
- *
- * Products derived from this software may not be called Shibboleth, Internet2,
- * UCAID, or the University Corporation for Advanced Internet Development, nor
- * may Shibboleth appear in their name, without prior written permission of the
- * University Corporation for Advanced Internet Development.
- *
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND WITH ALL FAULTS. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, AND NON-INFRINGEMENT ARE DISCLAIMED AND THE ENTIRE RISK
- * OF SATISFACTORY QUALITY, PERFORMANCE, ACCURACY, AND EFFORT IS WITH LICENSEE.
- * IN NO EVENT SHALL THE COPYRIGHT OWNER, CONTRIBUTORS OR THE UNIVERSITY
- * CORPORATION FOR ADVANCED INTERNET DEVELOPMENT, INC. BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 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.
*/
-
/* internal.h - internally visible declarations
Scott Cantor
#include "shib-target.h"
#include "hresult.h"
-#include <log4cpp/Category.hh>
-#include <log4cpp/FixedContextCategory.hh>
+#if defined(HAVE_LOG4SHIB)
+# include <log4shib/Category.hh>
+# include <log4shib/CategoryStream.hh>
+# include <log4shib/FixedContextCategory.hh>
+namespace shibtarget {
+ namespace logging = log4shib;
+};
+#elif defined(HAVE_LOG4CPP)
+# include <log4cpp/Category.hh>
+# include <log4cpp/CategoryStream.hh>
+# include <log4cpp/FixedContextCategory.hh>
+namespace shibtarget {
+ namespace logging = log4cpp;
+};
+#else
+# error "Supported logging library not available."
+#endif
#define SHIBT_L(s) shibtarget::XML::Literals::s
#define SHIBT_L_QNAME(p,s) shibtarget::XML::Literals::p##_##s
virtual void* getClientHandle(ShibSocket& s, u_long program, u_long version) const=0;
protected:
- log4cpp::Category* log;
+ logging::Category* log;
private:
mutable RPCHandlePool* m_rpcpool;
};
- // Helper class for SAML 2.0 Common Domain Cookie operations
- class CommonDomainCookie
- {
- public:
- CommonDomainCookie(const char* cookie);
- ~CommonDomainCookie();
- saml::Iterator<const char*> get() {return m_list;}
- const char* set(const char* providerId);
- static const char CDCName[];
- private:
- XMLByte* m_decoded;
- std::string m_encoded;
- std::vector<const char*> m_list;
- std::vector<std::string> m_additions;
- };
-
// Generic class, which handles the IPropertySet configuration interface.
// Most of the basic configuration details are exposed via this interface.
// This implementation extracts the XML tree structure and caches it in a map
void load(
const DOMElement* e, // root element of property set
- log4cpp::Category& log, // log object for tracing
+ logging::Category& log, // log object for tracing
DOMNodeFilter* filter, // control what subelements to include
const std::map<std::string,std::string>* remapper=NULL // on the fly property renaming for legacy support
);
class STArtifactMapper : public virtual saml::SAMLBrowserProfile::ArtifactMapper
{
public:
- STArtifactMapper(const IApplication* application)
- : m_app(application), m_localcopy(application->getMetadataProviders()), m_metadata(m_localcopy), m_ctx(NULL) {}
- virtual ~STArtifactMapper() {delete m_ctx;}
-
- saml::SAMLBrowserProfile::ArtifactMapper::ArtifactMapperResponse map(const saml::SAMLArtifact* artifact);
+ STArtifactMapper(const IApplication* application) : m_app(application) {}
+ virtual ~STArtifactMapper() {}
+ saml::SAMLResponse* resolve(saml::SAMLRequest* request);
private:
const IApplication* m_app;
- saml::Iterator<shibboleth::IMetadata*> m_localcopy;
- shibboleth::Metadata m_metadata; // scopes lock around use of role descriptor by hook context
- shibboleth::ShibHTTPHook::ShibHTTPHookCallContext* m_ctx;
};
// Error template class
- class ShibMLPPriv;
class ShibMLP {
public:
- ShibMLP();
- ~ShibMLP();
+ ShibMLP() {}
+ ~ShibMLP() {}
- void insert (const std::string& key, const std::string& value);
+ void insert (const std::string& key, const std::string& value) {
+ m_map[key] = value;
+ }
void insert (const std::string& key, const char* value) {
- std::string v = value;
- insert (key, v);
+ m_map[key] = value;
}
void insert (const char* key, const std::string& value) {
- std::string k = key;
- insert (k, value);
+ m_map[key] = value;
}
void insert (const char* key, const char* value) {
- std::string k = key, v = value;
- insert(k,v);
+ m_map[key] = value;
}
void insert (saml::SAMLException& e);
- void clear () { m_map.clear(); }
+ void clear () {
+ m_map.clear();
+ }
const char* run (std::istream& s, const IPropertySet* props=NULL, std::string* output=NULL);
const char* run (const std::string& input, const IPropertySet* props=NULL, std::string* output=NULL);
}
private:
- ShibMLPPriv *m_priv;
+ static void html_encode(std::string& os, const char* start);
+
std::map<std::string,std::string> m_map;
std::string m_generated;
};
bool load(const char* config);
void shutdown();
- log4cpp::Category& getTransactionLog() { m_tranLogLock->lock(); return *m_tranLog; }
+ logging::Category& getTransactionLog() { m_tranLogLock->lock(); return *m_tranLog; }
void releaseTransactionLog() { m_tranLogLock->unlock();}
private:
- log4cpp::FixedContextCategory* m_tranLog;
+ logging::FixedContextCategory* m_tranLog;
shibboleth::Mutex* m_tranLogLock;
static IConfig* ShibTargetConfigFactory(const DOMElement* e);
};