Path resolution for error templates.
[shibboleth/sp.git] / shibsp / SPConfig.h
index 431b753..81499cd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2006 Internet2
+ *  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.
@@ -24,6 +24,9 @@
 #define __shibsp_config_h__
 
 #include <shibsp/base.h>
+#ifndef SHIBSP_LITE
+# include <saml/binding/MessageDecoder.h>
+#endif
 #include <xmltooling/PluginManager.h>
 #include <xercesc/dom/DOM.hpp>
 
@@ -39,6 +42,16 @@ namespace shibsp {
     class SHIBSP_API RequestMapper;
     class SHIBSP_API ServiceProvider;
     class SHIBSP_API SessionCache;
+    class SHIBSP_API SessionInitiator;
+
+#ifndef SHIBSP_LITE
+    class SHIBSP_API AttributeDecoder;
+    class SHIBSP_API AttributeExtractor;
+    class SHIBSP_API AttributeFilter;
+    class SHIBSP_API AttributeResolver;
+    class SHIBSP_API FilterPolicyContext;
+    class SHIBSP_API MatchFunctor;
+#endif
 
 #if defined (_MSC_VER)
     #pragma warning( push )
@@ -50,8 +63,14 @@ namespace shibsp {
      */
     class SHIBSP_API SPConfig
     {
-    MAKE_NONCOPYABLE(SPConfig);
+        MAKE_NONCOPYABLE(SPConfig);
     public:
+        SPConfig() : attribute_value_delimeter(';'), m_serviceProvider(NULL),
+#ifndef SHIBSP_LITE
+            m_artifactResolver(NULL),
+#endif
+            m_features(0) {}
+
         virtual ~SPConfig() {}
 
         /**
@@ -67,14 +86,17 @@ namespace shibsp {
         enum components_t {
             Listener = 1,
             Caching = 2,
+#ifndef SHIBSP_LITE
             Metadata = 4,
             Trust = 8,
             Credentials = 16,
-            AAP = 32,
+            AttributeResolution = 32,
+#endif
             RequestMapping = 64,
             OutOfProcess = 128,
             InProcess = 256,
-            Logging = 512
+            Logging = 512,
+            Handlers = 1024
         };
         
         /**
@@ -103,9 +125,10 @@ namespace shibsp {
          * before using any library classes.
          * 
          * @param catalog_path  delimited set of schema catalog files to load
+         * @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=NULL, const char* inst_prefix=NULL);
         
         /**
          * Shuts down library
@@ -113,7 +136,7 @@ namespace shibsp {
          * 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.
@@ -133,62 +156,129 @@ namespace shibsp {
             return m_serviceProvider;
         }
 
+#ifndef SHIBSP_LITE
+        /**
+         * Sets the global ArtifactResolver instance.
+         *
+         * <p>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;
+        }
+        
+        /**
+         * Returns the global ArtifactResolver instance.
+         * 
+         * @return  global ArtifactResolver or NULL
+         */
+        opensaml::MessageDecoder::ArtifactResolver* getArtifactResolver() const {
+            return m_artifactResolver;
+        }
+#endif
+
+        /** Separator for serialized values of multi-valued attributes. */
+        char attribute_value_delimeter;
+        
         /**
          * Manages factories for AccessControl plugins.
          */
-        xmltooling::PluginManager<AccessControl,const xercesc::DOMElement*> AccessControlManager;
+        xmltooling::PluginManager<AccessControl,std::string,const xercesc::DOMElement*> AccessControlManager;
+
+#ifndef SHIBSP_LITE
+        /**
+         * Manages factories for AttributeDecoder plugins.
+         */
+        xmltooling::PluginManager<AttributeDecoder,xmltooling::QName,const xercesc::DOMElement*> AttributeDecoderManager;
+
+        /**
+         * Manages factories for AttributeExtractor plugins.
+         */
+        xmltooling::PluginManager<AttributeExtractor,std::string,const xercesc::DOMElement*> AttributeExtractorManager;
+
+        /**
+         * Manages factories for AttributeFilter plugins.
+         */
+        xmltooling::PluginManager<AttributeFilter,std::string,const xercesc::DOMElement*> AttributeFilterManager;
+
+        /**
+         * Manages factories for AttributeResolver plugins.
+         */
+        xmltooling::PluginManager<AttributeResolver,std::string,const xercesc::DOMElement*> AttributeResolverManager;
+
+        /**
+         * Manages factories for MatchFunctor plugins.
+         */
+        xmltooling::PluginManager< MatchFunctor,xmltooling::QName,std::pair<const FilterPolicyContext*,const xercesc::DOMElement*> > MatchFunctorManager;
+#endif
+
+        /**
+         * Manages factories for Handler plugins that implement ArtifactResolutionService functionality.
+         */
+        xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > ArtifactResolutionServiceManager;
 
         /**
          * Manages factories for Handler plugins that implement AssertionConsumerService functionality.
          */
-        xmltooling::PluginManager<Handler,const xercesc::DOMElement*> AssertionConsumerServiceManager;
+        xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > AssertionConsumerServiceManager;
 
         /**
          * Manages factories for Handler plugins that implement customized functionality.
          */
-        xmltooling::PluginManager<Handler,const xercesc::DOMElement*> HandlerManager;
+        xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > HandlerManager;
 
         /**
          * Manages factories for ListenerService plugins.
          */
-        xmltooling::PluginManager<ListenerService,const xercesc::DOMElement*> ListenerServiceManager;
+        xmltooling::PluginManager<ListenerService,std::string,const xercesc::DOMElement*> ListenerServiceManager;
+
+        /**
+         * Manages factories for Handler plugins that implement LogoutInitiator functionality.
+         */
+        xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > LogoutInitiatorManager;
 
         /**
          * Manages factories for Handler plugins that implement ManageNameIDService functionality.
          */
-        xmltooling::PluginManager<Handler,const xercesc::DOMElement*> ManageNameIDServiceManager;
+        xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > ManageNameIDServiceManager;
 
         /**
          * Manages factories for RequestMapper plugins.
          */
-        xmltooling::PluginManager<RequestMapper,const xercesc::DOMElement*> RequestMapperManager;
+        xmltooling::PluginManager<RequestMapper,std::string,const xercesc::DOMElement*> RequestMapperManager;
 
         /**
          * Manages factories for ServiceProvider plugins.
          */
-        xmltooling::PluginManager<ServiceProvider,const xercesc::DOMElement*> ServiceProviderManager;
+        xmltooling::PluginManager<ServiceProvider,std::string,const xercesc::DOMElement*> ServiceProviderManager;
 
         /**
          * Manages factories for SessionCache plugins.
          */
-        xmltooling::PluginManager<SessionCache,const xercesc::DOMElement*> SessionCacheManager;
+        xmltooling::PluginManager<SessionCache,std::string,const xercesc::DOMElement*> SessionCacheManager;
 
         /**
          * Manages factories for Handler plugins that implement SessionInitiator functionality.
          */
-        xmltooling::PluginManager<Handler,const xercesc::DOMElement*> SessionInitiatorManager;
+        xmltooling::PluginManager< SessionInitiator,std::string,std::pair<const xercesc::DOMElement*,const char*> > SessionInitiatorManager;
 
         /**
          * Manages factories for Handler plugins that implement SingleLogoutService functionality.
          */
-        xmltooling::PluginManager<Handler,const xercesc::DOMElement*> SingleLogoutServiceManager;
+        xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > SingleLogoutServiceManager;
 
     protected:
-        SPConfig() : m_serviceProvider(NULL) {}
-        
         /** Global ServiceProvider instance. */
         ServiceProvider* m_serviceProvider;
 
+#ifndef SHIBSP_LITE
+        /** Global ArtifactResolver instance. */
+        opensaml::MessageDecoder::ArtifactResolver* m_artifactResolver;
+#endif
+
     private:
         unsigned long m_features;
     };