Factor out LogoutInitiator class, simpler API to get ACS by binding.
[shibboleth/cpp-sp.git] / shibsp / handler / SessionInitiator.h
index 1013454..33b310a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2009 Internet2
+ *  Copyright 2001-2010 Internet2
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * Pluggable runtime functionality that handles initiating sessions.
  */
 
-#ifndef __shibsp_initiator_h__
-#define __shibsp_initiator_h__
+#ifndef __shibsp_sesinitiator_h__
+#define __shibsp_sesinitiator_h__
 
 #include <shibsp/handler/Handler.h>
 
+#include <map>
+#include <set>
+#include <string>
+
 namespace shibsp {
 
     /**
@@ -40,10 +44,32 @@ namespace shibsp {
         /** Property remapper for configuration compatibility. */
         static std::map<std::string,std::string> m_remapper;
 
-        SessionInitiator() {}
+        /** Set of optional settings supported by handler. */
+        std::set<std::string> m_supportedOptions;
+
+        SessionInitiator();
+
+        /**
+         * Examines the request and applicable settings to determine whether
+         * the handler is able to support the request.
+         * <p>If the handler is within a chain, the method will return false,
+         * otherwise an exception will be raised.
+         *
+         * @param request   SP request context
+         * @param isHandler true iff executing in the context of a direct handler invocation
+         * @return  true iff the request appears to be compatible
+         */
+        bool checkCompatibility(SPRequest& request, bool isHandler) const;
 
     public:
-        virtual ~SessionInitiator() {}
+        virtual ~SessionInitiator();
+
+        /**
+         * Indicates the set of optional settings supported by the handler.
+         *
+         * @return  a set of the optional settings supported
+         */
+        virtual const std::set<std::string>& getSupportedOptions() const;
 
         /**
          * Executes an incoming request.
@@ -61,9 +87,7 @@ namespace shibsp {
         std::pair<bool,long> run(SPRequest& request, bool isHandler=true) const;
 
 #ifndef SHIBSP_LITE
-        const char* getType() const {
-            return "SessionInitiator";
-        }
+        const char* getType() const;
 #endif
     };
     
@@ -95,4 +119,4 @@ namespace shibsp {
     #define COOKIE_SESSION_INITIATOR "Cookie"
 };
 
-#endif /* __shibsp_initiator_h__ */
+#endif /* __shibsp_sesinitiator_h__ */