2 * Copyright 2001-2009 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>
30 # include <saml/binding/MessageDecoder.h>
31 # include <saml/binding/MessageEncoder.h>
33 #include <xmltooling/PluginManager.h>
34 #include <xmltooling/QName.h>
35 #include <xercesc/dom/DOM.hpp>
39 * Shibboleth Service Provider Library
43 class SHIBSP_API AccessControl;
44 class SHIBSP_API Handler;
45 class SHIBSP_API ListenerService;
46 class SHIBSP_API RequestMapper;
47 class SHIBSP_API ServiceProvider;
48 class SHIBSP_API SessionCache;
49 class SHIBSP_API SessionInitiator;
52 class SHIBSP_API AttributeDecoder;
53 class SHIBSP_API AttributeExtractor;
54 class SHIBSP_API AttributeFilter;
55 class SHIBSP_API AttributeResolver;
56 class SHIBSP_API FilterPolicyContext;
57 class SHIBSP_API MatchFunctor;
60 #if defined (_MSC_VER)
61 #pragma warning( push )
62 #pragma warning( disable : 4250 4251 )
66 * Singleton object that manages library startup/shutdown.
68 class SHIBSP_API SPConfig
70 MAKE_NONCOPYABLE(SPConfig);
77 * Returns the global configuration object for the library.
79 * @return reference to the global library configuration object
81 static SPConfig& getConfig();
84 * Bitmask values representing subsystems of the library.
93 AttributeResolution = 32,
103 * Set a bitmask of subsystems to activate.
105 * @param enabled bitmask of component constants
107 void setFeatures(unsigned long enabled);
110 * Test whether a subsystem is enabled.
112 * @param feature subsystem/component to test
113 * @return true iff feature is enabled
115 bool isEnabled(components_t feature);
118 * Initializes library
120 * Each process using the library MUST call this function exactly once
121 * before using any library classes.
123 * @param catalog_path delimited set of schema catalog files to load
124 * @param inst_prefix installation prefix for software
125 * @return true iff initialization was successful
127 virtual bool init(const char* catalog_path=NULL, const char* inst_prefix=NULL);
132 * Each process using the library SHOULD call this function exactly once
133 * before terminating itself.
138 * Sets the global ServiceProvider instance.
139 * This method must be externally synchronized with any code that uses the object.
140 * Any previously set object is destroyed.
142 * @param serviceProvider new ServiceProvider instance to store
144 void setServiceProvider(ServiceProvider* serviceProvider);
147 * Returns the global ServiceProvider instance.
149 * @return global ServiceProvider or NULL
151 ServiceProvider* getServiceProvider() const;
154 * Instantiates and installs a ServiceProvider instance based on an XML configuration string
155 * or a configuration pathname.
157 * @param config a snippet of XML to parse (it <strong>MUST</strong> contain a type attribute) or a pathname
158 * @param rethrow true iff caught exceptions should be rethrown instead of just returning the status
159 * @return true iff instantiation was successful
161 virtual bool instantiate(const char* config=NULL, bool rethrow=false);
165 * Sets the global ArtifactResolver instance.
167 * <p>This method must be externally synchronized with any code that uses the object.
168 * Any previously set object is destroyed.
170 * @param artifactResolver new ArtifactResolver instance to store
172 void setArtifactResolver(opensaml::MessageDecoder::ArtifactResolver* artifactResolver);
175 * Returns the global ArtifactResolver instance.
177 * @return global ArtifactResolver or NULL
179 const opensaml::MessageDecoder::ArtifactResolver* getArtifactResolver() const;
182 /** Separator for serialized values of multi-valued attributes. */
183 char attribute_value_delimeter;
186 * Manages factories for AccessControl plugins.
188 xmltooling::PluginManager<AccessControl,std::string,const xercesc::DOMElement*> AccessControlManager;
192 * Manages factories for AttributeDecoder plugins.
194 xmltooling::PluginManager<AttributeDecoder,xmltooling::QName,const xercesc::DOMElement*> AttributeDecoderManager;
197 * Manages factories for AttributeExtractor plugins.
199 xmltooling::PluginManager<AttributeExtractor,std::string,const xercesc::DOMElement*> AttributeExtractorManager;
202 * Manages factories for AttributeFilter plugins.
204 xmltooling::PluginManager<AttributeFilter,std::string,const xercesc::DOMElement*> AttributeFilterManager;
207 * Manages factories for AttributeResolver plugins.
209 xmltooling::PluginManager<AttributeResolver,std::string,const xercesc::DOMElement*> AttributeResolverManager;
212 * Manages factories for MatchFunctor plugins.
214 xmltooling::PluginManager< MatchFunctor,xmltooling::QName,std::pair<const FilterPolicyContext*,const xercesc::DOMElement*> > MatchFunctorManager;
218 * Manages factories for Handler plugins that implement ArtifactResolutionService functionality.
220 xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > ArtifactResolutionServiceManager;
223 * Manages factories for Handler plugins that implement AssertionConsumerService functionality.
225 xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > AssertionConsumerServiceManager;
228 * Manages factories for Handler plugins that implement customized functionality.
230 xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > HandlerManager;
233 * Manages factories for ListenerService plugins.
235 xmltooling::PluginManager<ListenerService,std::string,const xercesc::DOMElement*> ListenerServiceManager;
238 * Manages factories for Handler plugins that implement LogoutInitiator functionality.
240 xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > LogoutInitiatorManager;
243 * Manages factories for Handler plugins that implement ManageNameIDService functionality.
245 xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > ManageNameIDServiceManager;
248 * Manages factories for RequestMapper plugins.
250 xmltooling::PluginManager<RequestMapper,std::string,const xercesc::DOMElement*> RequestMapperManager;
253 * Manages factories for ServiceProvider plugins.
255 xmltooling::PluginManager<ServiceProvider,std::string,const xercesc::DOMElement*> ServiceProviderManager;
258 * Manages factories for SessionCache plugins.
260 xmltooling::PluginManager<SessionCache,std::string,const xercesc::DOMElement*> SessionCacheManager;
263 * Manages factories for Handler plugins that implement SessionInitiator functionality.
265 xmltooling::PluginManager< SessionInitiator,std::string,std::pair<const xercesc::DOMElement*,const char*> > SessionInitiatorManager;
268 * Manages factories for Handler plugins that implement SingleLogoutService functionality.
270 xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > SingleLogoutServiceManager;
273 /** Global ServiceProvider instance. */
274 ServiceProvider* m_serviceProvider;
277 /** Global ArtifactResolver instance. */
278 opensaml::MessageDecoder::ArtifactResolver* m_artifactResolver;
282 unsigned long m_features;
283 xercesc::DOMDocument* m_configDoc;
286 #if defined (_MSC_VER)
287 #pragma warning( pop )
292 #endif /* __shibsp_config_h__ */