2 * Copyright 2001-2007 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 saml/binding/GenericRequest.h
20 * Interface to generic protocol requests that transport SAML messages.
23 #ifndef __saml_genreq_h__
24 #define __saml_genreq_h__
26 #include <saml/base.h>
29 #include <xsec/enc/XSECCryptoX509.hpp>
34 * Interface to caller-supplied shim for accessing generic transport
37 * <p>This interface need not be threadsafe.
39 class SAML_API GenericRequest {
40 MAKE_NONCOPYABLE(GenericRequest);
44 virtual ~GenericRequest() {}
47 * Returns the URL scheme of the request (http, https, ftp, ldap, etc.)
49 * @return the URL scheme
51 virtual const char* getScheme() const=0;
54 * Returns true iff the request is over a confidential channel.
56 * @return confidential channel indicator
58 virtual bool isSecure() const=0;
61 * Returns hostname of service that received request.
63 * @return hostname of service
65 virtual const char* getHostname() const=0;
68 * Returns incoming port.
70 * @return incoming port
72 virtual int getPort() const=0;
75 * Returns the MIME type of the request, if known.
77 * @return the MIME type, or an empty string
79 virtual std::string getContentType() const=0;
82 * Returns the length of the request body, if known.
84 * @return the content length, or -1 if unknown
86 virtual long getContentLength() const=0;
89 * Returns the raw request body.
91 * @return the request body, or NULL
93 virtual const char* getRequestBody() const=0;
96 * Returns a decoded named parameter value from the request.
97 * If a parameter has multiple values, only one will be returned.
99 * @param name the name of the parameter to return
100 * @return a single parameter value or NULL
102 virtual const char* getParameter(const char* name) const=0;
105 * Returns all of the decoded values of a named parameter from the request.
106 * All values found will be returned.
108 * @param name the name of the parameter to return
109 * @param values a vector in which to return pointers to the decoded values
110 * @return the number of values returned
112 virtual std::vector<const char*>::size_type getParameters(
113 const char* name, std::vector<const char*>& values
117 * Returns the transport-authenticated identity associated with the request,
118 * if authentication is solely handled by the transport.
120 * @return the authenticated username or an empty string
122 virtual std::string getRemoteUser() const=0;
125 * Returns the IP address of the client.
127 * @return the client's IP address
129 virtual std::string getRemoteAddr() const=0;
132 * Returns the chain of certificates sent by the client.
133 * They are not guaranteed to be valid according to any particular definition.
135 * @return the client's certificate chain
137 virtual const std::vector<XSECCryptoX509*>& getClientCertificates() const=0;
141 #endif /* __saml_genreq_h__ */