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 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 the MIME type of the request, if known.
63 * @return the MIME type, or an empty string
65 virtual std::string getContentType() const=0;
68 * Returns the length of the request body, if known.
70 * @return the content length, or -1 if unknown
72 virtual long getContentLength() const=0;
75 * Returns the raw request body.
77 * @return the request body, or NULL
79 virtual const char* getRequestBody() const=0;
82 * Returns a decoded named parameter value from the request.
83 * If a parameter has multiple values, only one will be returned.
85 * @param name the name of the parameter to return
86 * @return a single parameter value or NULL
88 virtual const char* getParameter(const char* name) const=0;
91 * Returns all of the decoded values of a named parameter from the request.
92 * All values found will be returned.
94 * @param name the name of the parameter to return
95 * @param values a vector in which to return pointers to the decoded values
96 * @return the number of values returned
98 virtual std::vector<const char*>::size_type getParameters(
99 const char* name, std::vector<const char*>& values
103 * Returns the transport-authenticated identity associated with the request,
104 * if authentication is solely handled by the transport.
106 * @return the authenticated username or an empty string
108 virtual std::string getRemoteUser() const=0;
111 * Returns the IP address of the client.
113 * @return the client's IP address
115 virtual std::string getRemoteAddr() const=0;
118 * Returns the chain of certificates sent by the client.
119 * They are not guaranteed to be valid according to any particular definition.
121 * @return the client's certificate chain
123 virtual const std::vector<XSECCryptoX509*>& getClientCertificates() const=0;
127 #endif /* __saml_genreq_h__ */