ad3c269eccac29de5184891ff21820fb1c5e621c
[shibboleth/cpp-sp.git] / shibsp / AbstractSPRequest.h
1 /*
2  *  Copyright 2001-2007 Internet2
3  * 
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 /**
18  * @file shibsp/AbstractSPRequest.h
19  * 
20  * Abstract base for SPRequest implementations  
21  */
22
23 #ifndef __shibsp_abstreq_h__
24 #define __shibsp_abstreq_h__
25
26 #include <shibsp/exceptions.h>
27 #include <shibsp/SPRequest.h>
28 #include <saml/util/CGIParser.h>
29
30 namespace shibsp {
31     
32     /**
33      * Abstract base for SPRequest implementations
34      */
35     class SHIBSP_API AbstractSPRequest : public virtual SPRequest
36     {
37     protected:
38         AbstractSPRequest();
39         
40     public:
41         virtual ~AbstractSPRequest();
42
43         const ServiceProvider& getServiceProvider() const {
44             return *m_sp;
45         }
46
47         RequestMapper::Settings getRequestSettings() const;
48
49         const Application& getApplication() const;
50         
51         Session* getSession() const;
52
53         const char* getRequestURL() const;
54         
55         const char* getParameter(const char* name) const;
56
57         std::vector<const char*>::size_type getParameters(const char* name, std::vector<const char*>& values) const;
58
59         const char* getCookie(const char* name) const;
60
61         const char* getHandlerURL(const char* resource=NULL) const;
62
63         void log(SPLogLevel level, const std::string& msg) const;
64
65         bool isPriorityEnabled(SPLogLevel level) const;
66
67     private:
68         ServiceProvider* m_sp;
69         mutable RequestMapper* m_mapper;
70         mutable RequestMapper::Settings m_settings;
71         mutable const Application* m_app;
72         mutable bool m_sessionTried;
73         mutable Session* m_session;
74         mutable std::string m_url;
75         void* m_log; // declared void* to avoid log4cpp header conflicts in Apache
76         mutable std::string m_handlerURL;
77         mutable std::map<std::string,std::string> m_cookieMap;
78         mutable opensaml::CGIParser* m_parser;
79     };
80 };
81
82 #endif /* __shibsp_abstreq_h__ */