2 * Copyright 2001-2006 Internet2
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file shibsp/SPRequest.h
20 * Interface to server request being processed
23 #ifndef __shibsp_req_h__
24 #define __shibsp_req_h__
26 #include <shibsp/base.h>
27 #include <saml/binding/HTTPRequest.h>
28 #include <saml/binding/HTTPResponse.h>
32 class SHIBSP_API Application;
35 * Interface to server request being processed
37 * <p>To supply information from the surrounding web server environment,
38 * a shim must be supplied in the form of this interface to adapt the
39 * library to different proprietary server APIs.
41 * <p>This interface need not be threadsafe.
43 class SHIBSP_API SPRequest : public virtual opensaml::HTTPRequest, public virtual opensaml::HTTPResponse
48 virtual ~SPRequest() {}
51 * Returns the Application governing the request.
53 * @return reference to Application
55 virtual const Application& getSPApplication() const=0;
58 * Returns the effective base Handler URL for a resource,
59 * or the current request URL.
61 * @param resource resource URL to compute handler for
62 * @return base location of handler
64 virtual const char* getHandlerURL(const char* resource=NULL) const=0;
67 * Get a cookie value supplied by the client.
69 * @param name name of cookie
70 * @return cookie value or NULL
72 virtual const char* getCookie(const char* name) const=0;
75 * Returns a non-spoofable request header value, if possible.
76 * Platforms that support environment export can redirect header
77 * lookups by overriding this method.
79 * @param name the name of the secure header to return
80 * @return the header's value, or an empty string
82 virtual std::string getSecureHeader(const char* name) const {
83 return getHeader(name);
87 * Ensures no value exists for a request header.
89 * @param name name of header to clear
91 virtual void clearHeader(const char* name)=0;
94 * Sets a value for a request header.
96 * @param name name of header to set
97 * @param value value to set
99 virtual void setHeader(const char* name, const char* value)=0;
102 * Establish REMOTE_USER identity in request.
104 * @param user REMOTE_USER value to set or NULL to clear
106 virtual void setRemoteUser(const char* user)=0;
108 /** Portable logging levels. */
118 * Log to native server environment.
120 * @param level logging level
121 * @param msg message to log
123 virtual void log(SPLogLevel level, const std::string& msg) const=0;
126 * Test logging level.
128 * @param level logging level
129 * @return true iff logging level is enabled
131 virtual bool isPriorityEnabled(SPLogLevel level) const=0;
135 #endif /* __shibsp_req_h__ */