Draft artifact resolver.
[shibboleth/sp.git] / shibsp / handler / AbstractHandler.h
index 31a5cbf..5e12fc1 100644 (file)
 #include <shibsp/util/DOMPropertySet.h>
 
 #include <log4cpp/Category.hh>
-#include <saml/binding/HTTPRequest.h>
+#ifndef SHIBSP_LITE
+# include <saml/saml2/core/Protocols.h>
+#endif
 #include <xmltooling/XMLObject.h>
+#include <xmltooling/io/HTTPRequest.h>
+#include <xmltooling/io/HTTPResponse.h>
 
 namespace shibsp {
 
+    class SHIBSP_API Application;
     class SHIBSP_API SPRequest;
 
 #if defined (_MSC_VER)
@@ -53,12 +58,13 @@ namespace shibsp {
          * @param remapper  optional map of property rename rules for legacy property support
          */
         AbstractHandler(
-            const DOMElement* e,
+            const xercesc::DOMElement* e,
             log4cpp::Category& log,
-            DOMNodeFilter* filter=NULL,
+            xercesc::DOMNodeFilter* filter=NULL,
             const std::map<std::string,std::string>* remapper=NULL
             );
 
+#ifndef SHIBSP_LITE
         /**
          * Examines a protocol response message for errors and raises an annotated exception
          * if an error is found.
@@ -68,18 +74,31 @@ namespace shibsp {
          * @param response      a response message of some known protocol
          */
         virtual void checkError(const xmltooling::XMLObject* response) const;
-        
+
+        /**
+         * Prepares Status information in a SAML 2.0 response.
+         * 
+         * @param response  a SAML 2.0 response message
+         * @param code      SAML status code
+         * @param ex        optional message to pass back
+         */
+        void prepareResponse(
+            opensaml::saml2p::StatusResponseType& response, const XMLCh* code, const XMLCh* subcode=NULL, const char* msg=NULL
+            ) const;
+#endif
+
         /**
          * Implements various mechanisms to preserve RelayState,
          * such as cookies or StorageService-backed keys.
          * 
          * <p>If a supported mechanism can be identified, the input parameter will be
-         * replaced with a suitable state key, URL-encoded.
+         * replaced with a suitable state key.
          * 
-         * @param request       the active SPRequest
+         * @param application   the associated Application
+         * @param response      outgoing HTTP response
          * @param relayState    RelayState token to supply with message
          */
-        virtual void preserveRelayState(SPRequest& request, std::string& relayState) const;
+        virtual void preserveRelayState(const Application& application, xmltooling::HTTPResponse& response, std::string& relayState) const;
 
         /**
          * Implements various mechanisms to recover RelayState,
@@ -88,14 +107,21 @@ namespace shibsp {
          * <p>If a supported mechanism can be identified, the input parameter will be
          * replaced with the recovered state information.
          * 
-         * @param httpRequest   incoming HTTP request
+         * @param application   the associated Application
+         * @param request       incoming HTTP request
          * @param relayState    RelayState token supplied with message
+         * @param clear         true iff the token state should be cleared
          */
-        virtual void recoverRelayState(opensaml::HTTPRequest& httpRequest, std::string& relayState) const;
+        virtual void recoverRelayState(
+            const Application& application, xmltooling::HTTPRequest& request, std::string& relayState, bool clear=true
+            ) const;
         
         /** Logging object. */
         log4cpp::Category& m_log;
         
+        /** Configuration namespace for custom properties. */
+        xmltooling::auto_ptr_char m_configNS;
+
     public:
         virtual ~AbstractHandler() {}
     };