#endif
#include "shib-target.h"
+#include "hresult.h"
#include <log4cpp/Category.hh>
+#include <log4cpp/FixedContextCategory.hh>
#define SHIBT_L(s) shibtarget::XML::Literals::s
#define SHIBT_L_QNAME(p,s) shibtarget::XML::Literals::p##_##s
+#define SHIBTRAN_LOGCAT "Shibboleth-TRANSACTION"
+
+// Controls default logging level of console tools and other situations
+// where full shibboleth.xml-based logging isn't used.
+#define SHIB_LOGGING "WARN"
namespace shibtarget {
RPC();
~RPC() {delete m_handle;}
RPCHandle* operator->() {return m_handle;}
- void pool() {m_pool.put(m_handle); m_handle=NULL;}
+ void pool() {if (m_handle) m_pool.put(m_handle); m_handle=NULL;}
private:
RPCHandlePool& m_pool;
RPCHandle* m_handle;
};
+
+ // 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.
const IPropertySet* getPropertySet(const char* name, const char* ns="urn:mace:shibboleth:target:config:1.0") const;
const DOMElement* getElement() const {return m_root;}
- protected:
- void load(const DOMElement* e, log4cpp::Category& log, DOMNodeFilter* filter);
+ void load(
+ const DOMElement* e, // root element of property set
+ log4cpp::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
+ );
private:
const DOMElement* m_root;
std::map<std::string,std::pair<char*,const XMLCh*> > m_map;
std::map<std::string,IPropertySet*> m_nested;
};
+
+ // ST-aware class that maps SAML artifacts to appropriate binding information
+ 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);
+
+ 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;
+ };
class STConfig : public ShibTargetConfig
{
public:
- STConfig() {}
+ STConfig() : m_tranLog(NULL), m_tranLogLock(NULL), m_rpcpool(NULL) {}
~STConfig() {}
bool init(const char* schemadir, const char* config);
void shutdown();
- RPCHandlePool& getRPCHandlePool() {return m_rpcpool;}
+ RPCHandlePool& getRPCHandlePool() {return *m_rpcpool;}
+ log4cpp::Category& getTransactionLog() { m_tranLogLock->lock(); return *m_tranLog; }
+ void releaseTransactionLog() { m_tranLogLock->unlock();}
private:
- RPCHandlePool m_rpcpool;
+ RPCHandlePool* m_rpcpool;
+ log4cpp::FixedContextCategory* m_tranLog;
+ shibboleth::Mutex* m_tranLogLock;
static IConfig* ShibTargetConfigFactory(const DOMElement* e);
};
{
public:
static const XMLCh SHIBTARGET_SCHEMA_ID[];
+ static const XMLCh SAML2ASSERT_NS[];
+ static const XMLCh SAML2ASSERT_SCHEMA_ID[];
+ static const XMLCh SAML2META_NS[];
+ static const XMLCh SAML2META_SCHEMA_ID[];
+ static const XMLCh XMLENC_NS[];
+ static const XMLCh XMLENC_SCHEMA_ID[];
static const char htaccessType[];
static const char MemorySessionCacheType[];
static const char MySQLSessionCacheType[];
+ static const char MemoryReplayCacheType[];
+ static const char MySQLReplayCacheType[];
+ static const char LegacyRequestMapType[];
static const char RequestMapType[];
static const char TCPListenerType[];
static const char UnixListenerType[];
static const XMLCh applicationId[];
static const XMLCh Application[];
static const XMLCh Applications[];
+ static const XMLCh AssertionConsumerService[];
static const XMLCh CredentialsProvider[];
static const XMLCh CredentialUse[];
static const XMLCh Extensions[];
static const XMLCh fatal[];
static const XMLCh FederationProvider[];
+ static const XMLCh Global[];
static const XMLCh Host[];
static const XMLCh htaccess[];
static const XMLCh Implementation[];
+ static const XMLCh index[];
+ static const XMLCh isDefault[];
static const XMLCh Library[];
static const XMLCh Listener[];
+ static const XMLCh Local[];
static const XMLCh logger[];
static const XMLCh MemorySessionCache[];
+ static const XMLCh MySQLReplayCache[];
static const XMLCh MySQLSessionCache[];
static const XMLCh name[];
static const XMLCh Name[];
static const XMLCh Path[];
static const XMLCh path[];
static const XMLCh RelyingParty[];
+ static const XMLCh ReplayCache[];
static const XMLCh RequestMap[];
static const XMLCh RequestMapProvider[];
static const XMLCh require[];
static const XMLCh RevocationProvider[];
static const XMLCh Rule[];
static const XMLCh SessionCache[];
+ static const XMLCh SessionInitiator[];
static const XMLCh SHAR[];
static const XMLCh ShibbolethTargetConfig[];
static const XMLCh SHIRE[];
static const XMLCh Signing[];
+ static const XMLCh SingleLogoutService[];
+ static const XMLCh SPConfig[];
static const XMLCh TCPListener[];
static const XMLCh TLS[];
static const XMLCh TrustProvider[];