X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=shibsp%2FSPConfig.h;h=2c80561848b3e58fe741fae10eea101a1018e1bc;hb=7a8806efca2d7135ef9a3900b47329dbc5674f72;hp=b3a4e2357dd2eb32146d777cb0ef9d008e13db62;hpb=9a1663d9b197783f710ee3702933a777fadae78e;p=shibboleth%2Fcpp-sp.git diff --git a/shibsp/SPConfig.h b/shibsp/SPConfig.h index b3a4e23..2c80561 100644 --- a/shibsp/SPConfig.h +++ b/shibsp/SPConfig.h @@ -1,33 +1,42 @@ -/* - * Copyright 2001-2007 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 +/** + * 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 + * 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. + * 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/SPConfig.h - * - * Library configuration + * + * Library configuration. */ #ifndef __shibsp_config_h__ #define __shibsp_config_h__ #include + +#include #ifndef SHIBSP_LITE +# include # include +# include #endif #include +#include #include /** @@ -40,6 +49,7 @@ namespace shibsp { class SHIBSP_API Handler; class SHIBSP_API ListenerService; class SHIBSP_API RequestMapper; + class SHIBSP_API ProtocolProvider; class SHIBSP_API ServiceProvider; class SHIBSP_API SessionCache; class SHIBSP_API SessionInitiator; @@ -51,6 +61,7 @@ namespace shibsp { class SHIBSP_API AttributeResolver; class SHIBSP_API FilterPolicyContext; class SHIBSP_API MatchFunctor; + class SHIBSP_API SecurityPolicyProvider; #endif #if defined (_MSC_VER) @@ -63,13 +74,15 @@ namespace shibsp { */ class SHIBSP_API SPConfig { - MAKE_NONCOPYABLE(SPConfig); + MAKE_NONCOPYABLE(SPConfig); public: - virtual ~SPConfig() {} + SPConfig(); + + virtual ~SPConfig(); /** * Returns the global configuration object for the library. - * + * * @return reference to the global library configuration object */ static SPConfig& getConfig(); @@ -89,64 +102,78 @@ namespace shibsp { RequestMapping = 64, OutOfProcess = 128, InProcess = 256, - Logging = 512 + Logging = 512, + Handlers = 1024 }; - + /** * Set a bitmask of subsystems to activate. - * + * * @param enabled bitmask of component constants */ - void setFeatures(unsigned long enabled) { - m_features = enabled; - } + void setFeatures(unsigned long enabled); + + + /** + * Gets the bitmask of subsystems being activated. + * + * @return bitmask of component constants + */ + unsigned long getFeatures() const; /** * Test whether a subsystem is enabled. - * + * * @param feature subsystem/component to test * @return true iff feature is enabled */ - bool isEnabled(components_t feature) { - return (m_features & feature)>0; - } - + bool isEnabled(components_t feature) const; + /** * Initializes library - * + * * Each process using the library MUST call this function exactly once * before using any library classes. - * + * * @param catalog_path delimited set of schema catalog files to load - * @return true iff initialization was successful + * @param inst_prefix installation prefix for software + * @return true iff initialization was successful */ - virtual bool init(const char* catalog_path)=0; - + virtual bool init(const char* catalog_path=nullptr, const char* inst_prefix=nullptr); + /** * Shuts down library - * + * * Each process using the library SHOULD call this function exactly once * before terminating itself. */ - virtual void term()=0; - + virtual void term(); + /** * Sets the global ServiceProvider instance. * This method must be externally synchronized with any code that uses the object. * Any previously set object is destroyed. - * + * * @param serviceProvider new ServiceProvider instance to store */ void setServiceProvider(ServiceProvider* serviceProvider); - + /** * Returns the global ServiceProvider instance. - * - * @return global ServiceProvider or NULL + * + * @return global ServiceProvider or nullptr */ - ServiceProvider* getServiceProvider() const { - return m_serviceProvider; - } + ServiceProvider* getServiceProvider() const; + + /** + * Instantiates and installs a ServiceProvider instance based on an XML configuration string + * or a configuration pathname. + * + * @param config a snippet of XML to parse (it MUST contain a type attribute) or a pathname + * @param rethrow true iff caught exceptions should be rethrown instead of just returning the status + * @return true iff instantiation was successful + */ + virtual bool instantiate(const char* config=nullptr, bool rethrow=false); #ifndef SHIBSP_LITE /** @@ -154,27 +181,22 @@ namespace shibsp { * *

This method must be externally synchronized with any code that uses the object. * Any previously set object is destroyed. - * + * * @param artifactResolver new ArtifactResolver instance to store */ - void setArtifactResolver(opensaml::MessageDecoder::ArtifactResolver* artifactResolver) { - delete m_artifactResolver; - m_artifactResolver = artifactResolver; - } - + void setArtifactResolver(opensaml::MessageDecoder::ArtifactResolver* artifactResolver); + /** * Returns the global ArtifactResolver instance. - * - * @return global ArtifactResolver or NULL + * + * @return global ArtifactResolver or nullptr */ - opensaml::MessageDecoder::ArtifactResolver* getArtifactResolver() const { - return m_artifactResolver; - } + const opensaml::MessageDecoder::ArtifactResolver* getArtifactResolver() const; #endif /** Separator for serialized values of multi-valued attributes. */ char attribute_value_delimeter; - + /** * Manages factories for AccessControl plugins. */ @@ -202,9 +224,19 @@ namespace shibsp { xmltooling::PluginManager AttributeResolverManager; /** + * Manages factories for Event plugins. + */ + xmltooling::PluginManager EventManager; + + /** * Manages factories for MatchFunctor plugins. */ xmltooling::PluginManager< MatchFunctor,xmltooling::QName,std::pair > MatchFunctorManager; + + /** + * Manages factories for SecurityPolicyProvider plugins. + */ + xmltooling::PluginManager SecurityPolicyProviderManager; #endif /** @@ -228,11 +260,21 @@ namespace shibsp { xmltooling::PluginManager ListenerServiceManager; /** + * Manages factories for Handler plugins that implement LogoutInitiator functionality. + */ + xmltooling::PluginManager< Handler,std::string,std::pair > LogoutInitiatorManager; + + /** * Manages factories for Handler plugins that implement ManageNameIDService functionality. */ xmltooling::PluginManager< Handler,std::string,std::pair > ManageNameIDServiceManager; /** + * Manages factories for ProtocolProvider plugins. + */ + xmltooling::PluginManager ProtocolProviderManager; + + /** * Manages factories for RequestMapper plugins. */ xmltooling::PluginManager RequestMapperManager; @@ -258,12 +300,6 @@ namespace shibsp { xmltooling::PluginManager< Handler,std::string,std::pair > SingleLogoutServiceManager; protected: - SPConfig() : attribute_value_delimeter(';'), m_serviceProvider(NULL), -#ifndef SHIBSP_LITE - m_artifactResolver(NULL), -#endif - m_features(0) {} - /** Global ServiceProvider instance. */ ServiceProvider* m_serviceProvider; @@ -274,6 +310,7 @@ namespace shibsp { private: unsigned long m_features; + xercesc::DOMDocument* m_configDoc; }; #if defined (_MSC_VER)