2 * Copyright 2001-2007 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @file shibsp/SPConfig.h
20 * Library configuration
23 #ifndef __shibsp_config_h__
24 #define __shibsp_config_h__
26 #include <shibsp/base.h>
28 # include <saml/binding/MessageDecoder.h>
30 #include <xmltooling/PluginManager.h>
31 #include <xercesc/dom/DOM.hpp>
35 * Shibboleth Service Provider Library
39 class SHIBSP_API AccessControl;
40 class SHIBSP_API Handler;
41 class SHIBSP_API ListenerService;
42 class SHIBSP_API RequestMapper;
43 class SHIBSP_API ServiceProvider;
44 class SHIBSP_API SessionCache;
45 class SHIBSP_API SessionInitiator;
48 class SHIBSP_API AttributeDecoder;
49 class SHIBSP_API AttributeExtractor;
50 class SHIBSP_API AttributeFilter;
51 class SHIBSP_API AttributeResolver;
52 class SHIBSP_API FilterPolicyContext;
53 class SHIBSP_API MatchFunctor;
56 #if defined (_MSC_VER)
57 #pragma warning( push )
58 #pragma warning( disable : 4250 4251 )
62 * Singleton object that manages library startup/shutdown.
64 class SHIBSP_API SPConfig
66 MAKE_NONCOPYABLE(SPConfig);
68 virtual ~SPConfig() {}
71 * Returns the global configuration object for the library.
73 * @return reference to the global library configuration object
75 static SPConfig& getConfig();
78 * Bitmask values representing subsystems of the library.
87 AttributeResolution = 32,
96 * Set a bitmask of subsystems to activate.
98 * @param enabled bitmask of component constants
100 void setFeatures(unsigned long enabled) {
101 m_features = enabled;
105 * Test whether a subsystem is enabled.
107 * @param feature subsystem/component to test
108 * @return true iff feature is enabled
110 bool isEnabled(components_t feature) {
111 return (m_features & feature)>0;
115 * Initializes library
117 * Each process using the library MUST call this function exactly once
118 * before using any library classes.
120 * @param catalog_path delimited set of schema catalog files to load
121 * @return true iff initialization was successful
123 virtual bool init(const char* catalog_path)=0;
128 * Each process using the library SHOULD call this function exactly once
129 * before terminating itself.
131 virtual void term()=0;
134 * Sets the global ServiceProvider instance.
135 * This method must be externally synchronized with any code that uses the object.
136 * Any previously set object is destroyed.
138 * @param serviceProvider new ServiceProvider instance to store
140 void setServiceProvider(ServiceProvider* serviceProvider);
143 * Returns the global ServiceProvider instance.
145 * @return global ServiceProvider or NULL
147 ServiceProvider* getServiceProvider() const {
148 return m_serviceProvider;
153 * Sets the global ArtifactResolver instance.
155 * <p>This method must be externally synchronized with any code that uses the object.
156 * Any previously set object is destroyed.
158 * @param artifactResolver new ArtifactResolver instance to store
160 void setArtifactResolver(opensaml::MessageDecoder::ArtifactResolver* artifactResolver) {
161 delete m_artifactResolver;
162 m_artifactResolver = artifactResolver;
166 * Returns the global ArtifactResolver instance.
168 * @return global ArtifactResolver or NULL
170 opensaml::MessageDecoder::ArtifactResolver* getArtifactResolver() const {
171 return m_artifactResolver;
175 /** Separator for serialized values of multi-valued attributes. */
176 char attribute_value_delimeter;
179 * Manages factories for AccessControl plugins.
181 xmltooling::PluginManager<AccessControl,std::string,const xercesc::DOMElement*> AccessControlManager;
185 * Manages factories for AttributeDecoder plugins.
187 xmltooling::PluginManager<AttributeDecoder,xmltooling::QName,const xercesc::DOMElement*> AttributeDecoderManager;
190 * Manages factories for AttributeExtractor plugins.
192 xmltooling::PluginManager<AttributeExtractor,std::string,const xercesc::DOMElement*> AttributeExtractorManager;
195 * Manages factories for AttributeFilter plugins.
197 xmltooling::PluginManager<AttributeFilter,std::string,const xercesc::DOMElement*> AttributeFilterManager;
200 * Manages factories for AttributeResolver plugins.
202 xmltooling::PluginManager<AttributeResolver,std::string,const xercesc::DOMElement*> AttributeResolverManager;
205 * Manages factories for MatchFunctor plugins.
207 xmltooling::PluginManager< MatchFunctor,xmltooling::QName,std::pair<const FilterPolicyContext*,const xercesc::DOMElement*> > MatchFunctorManager;
211 * Manages factories for Handler plugins that implement AssertionConsumerService functionality.
213 xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > AssertionConsumerServiceManager;
216 * Manages factories for Handler plugins that implement customized functionality.
218 xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > HandlerManager;
221 * Manages factories for ListenerService plugins.
223 xmltooling::PluginManager<ListenerService,std::string,const xercesc::DOMElement*> ListenerServiceManager;
226 * Manages factories for Handler plugins that implement ManageNameIDService functionality.
228 xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > ManageNameIDServiceManager;
231 * Manages factories for RequestMapper plugins.
233 xmltooling::PluginManager<RequestMapper,std::string,const xercesc::DOMElement*> RequestMapperManager;
236 * Manages factories for ServiceProvider plugins.
238 xmltooling::PluginManager<ServiceProvider,std::string,const xercesc::DOMElement*> ServiceProviderManager;
241 * Manages factories for SessionCache plugins.
243 xmltooling::PluginManager<SessionCache,std::string,const xercesc::DOMElement*> SessionCacheManager;
246 * Manages factories for Handler plugins that implement SessionInitiator functionality.
248 xmltooling::PluginManager< SessionInitiator,std::string,std::pair<const xercesc::DOMElement*,const char*> > SessionInitiatorManager;
251 * Manages factories for Handler plugins that implement SingleLogoutService functionality.
253 xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > SingleLogoutServiceManager;
256 SPConfig() : attribute_value_delimeter(';'), m_serviceProvider(NULL),
258 m_artifactResolver(NULL),
262 /** Global ServiceProvider instance. */
263 ServiceProvider* m_serviceProvider;
266 /** Global ArtifactResolver instance. */
267 opensaml::MessageDecoder::ArtifactResolver* m_artifactResolver;
271 unsigned long m_features;
274 #if defined (_MSC_VER)
275 #pragma warning( pop )
280 #endif /* __shibsp_config_h__ */