2 * Copyright 2001-2006 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>
27 #include <xmltooling/PluginManager.h>
28 #include <xercesc/dom/DOM.hpp>
32 * Shibboleth Service Provider Library
36 class SHIBSP_API AccessControl;
37 class SHIBSP_API Handler;
38 class SHIBSP_API ListenerService;
39 class SHIBSP_API RequestMapper;
40 class SHIBSP_API ServiceProvider;
41 class SHIBSP_API SessionCache;
43 #if defined (_MSC_VER)
44 #pragma warning( push )
45 #pragma warning( disable : 4250 4251 )
49 * Singleton object that manages library startup/shutdown.
51 class SHIBSP_API SPConfig
53 MAKE_NONCOPYABLE(SPConfig);
55 virtual ~SPConfig() {}
58 * Returns the global configuration object for the library.
60 * @return reference to the global library configuration object
62 static SPConfig& getConfig();
65 * Bitmask values representing subsystems of the library.
81 * Set a bitmask of subsystems to activate.
83 * @param enabled bitmask of component constants
85 void setFeatures(unsigned long enabled) {
90 * Test whether a subsystem is enabled.
92 * @param feature subsystem/component to test
93 * @return true iff feature is enabled
95 bool isEnabled(components_t feature) {
96 return (m_features & feature)>0;
100 * Initializes library
102 * Each process using the library MUST call this function exactly once
103 * before using any library classes.
105 * @param catalog_path delimited set of schema catalog files to load
106 * @return true iff initialization was successful
108 virtual bool init(const char* catalog_path)=0;
113 * Each process using the library SHOULD call this function exactly once
114 * before terminating itself.
116 virtual void term()=0;
119 * Sets the global ServiceProvider instance.
120 * This method must be externally synchronized with any code that uses the object.
121 * Any previously set object is destroyed.
123 * @param serviceProvider new ServiceProvider instance to store
125 void setServiceProvider(ServiceProvider* serviceProvider);
128 * Returns the global ServiceProvider instance.
130 * @return global ServiceProvider or NULL
132 ServiceProvider* getServiceProvider() const {
133 return m_serviceProvider;
137 * Manages factories for AccessControl plugins.
139 xmltooling::PluginManager<AccessControl,const xercesc::DOMElement*> AccessControlManager;
142 * Manages factories for Handler plugins that implement AssertionConsumerService functionality.
144 xmltooling::PluginManager<Handler,const xercesc::DOMElement*> AssertionConsumerServiceManager;
147 * Manages factories for Handler plugins that implement customized functionality.
149 xmltooling::PluginManager<Handler,const xercesc::DOMElement*> HandlerManager;
152 * Manages factories for ListenerService plugins.
154 xmltooling::PluginManager<ListenerService,const xercesc::DOMElement*> ListenerServiceManager;
157 * Manages factories for Handler plugins that implement ManageNameIDService functionality.
159 xmltooling::PluginManager<Handler,const xercesc::DOMElement*> ManageNameIDServiceManager;
162 * Manages factories for RequestMapper plugins.
164 xmltooling::PluginManager<RequestMapper,const xercesc::DOMElement*> RequestMapperManager;
167 * Manages factories for ServiceProvider plugins.
169 xmltooling::PluginManager<ServiceProvider,const xercesc::DOMElement*> ServiceProviderManager;
172 * Manages factories for SessionCache plugins.
174 xmltooling::PluginManager<SessionCache,const xercesc::DOMElement*> SessionCacheManager;
177 * Manages factories for Handler plugins that implement SessionInitiator functionality.
179 xmltooling::PluginManager<Handler,const xercesc::DOMElement*> SessionInitiatorManager;
182 * Manages factories for Handler plugins that implement SingleLogoutService functionality.
184 xmltooling::PluginManager<Handler,const xercesc::DOMElement*> SingleLogoutServiceManager;
187 SPConfig() : m_serviceProvider(NULL) {}
189 /** Global ServiceProvider instance. */
190 ServiceProvider* m_serviceProvider;
193 unsigned long m_features;
196 #if defined (_MSC_VER)
197 #pragma warning( pop )
202 #endif /* __shibsp_config_h__ */