2 * Licensed to the University Corporation for Advanced Internet
3 * Development, Inc. (UCAID) under one or more contributor license
4 * agreements. See the NOTICE file distributed with this work for
5 * additional information regarding copyright ownership.
7 * UCAID licenses this file to you under the Apache License,
8 * Version 2.0 (the "License"); you may not use this file except
9 * in compliance with the License. You may obtain a copy of the
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17 * either express or implied. See the License for the specific
18 * language governing permissions and limitations under the License.
22 * @file shibsp/AbstractSPRequest.h
24 * Abstract base for SPRequest implementations.
27 #ifndef __shibsp_abstreq_h__
28 #define __shibsp_abstreq_h__
30 #include <shibsp/SPRequest.h>
31 #include <boost/scoped_ptr.hpp>
35 class SHIBSP_API CGIParser;
37 #if defined (_MSC_VER)
38 #pragma warning( push )
39 #pragma warning( disable : 4251 )
43 * Abstract base for SPRequest implementations
45 class SHIBSP_API AbstractSPRequest : public virtual SPRequest
51 * @param category logging category to use
53 AbstractSPRequest(const char* category);
56 * Stores a normalized request URI to ensure it contains no %-encoded characters
57 * or other undesirable artifacts.
59 * @param uri the request URI as obtained from the client
61 void setRequestURI(const char* uri);
64 virtual ~AbstractSPRequest();
66 // Virtual function overrides.
67 const ServiceProvider& getServiceProvider() const;
68 RequestMapper::Settings getRequestSettings() const;
69 const Application& getApplication() const;
70 Session* getSession(bool checkTimeout=true, bool ignoreAddress=false, bool cache=true);
71 const char* getRequestURI() const;
72 const char* getRequestURL() const;
73 std::string getRemoteAddr() const;
74 const char* getParameter(const char* name) const;
75 std::vector<const char*>::size_type getParameters(const char* name, std::vector<const char*>& values) const;
76 const char* getHandlerURL(const char* resource=nullptr) const;
77 void log(SPLogLevel level, const std::string& msg) const;
78 bool isPriorityEnabled(SPLogLevel level) const;
81 ServiceProvider* m_sp;
82 mutable RequestMapper* m_mapper;
83 mutable RequestMapper::Settings m_settings;
84 mutable const Application* m_app;
85 mutable bool m_sessionTried;
86 mutable Session* m_session;
88 mutable std::string m_url;
89 void* m_log; // declared void* to avoid log4cpp header conflicts in Apache
90 mutable std::string m_handlerURL;
91 mutable boost::scoped_ptr<CGIParser> m_parser;
94 #if defined (_MSC_VER)
95 #pragma warning( pop )
100 #endif /* __shibsp_abstreq_h__ */