https://bugs.internet2.edu/jira/browse/SSPCPP-320
[shibboleth/sp.git] / shibsp / RequestMapper.h
1 /*
2  *  Copyright 2001-2009 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/RequestMapper.h
19  * 
20  * Interface to a request mapping plugin
21  */
22
23 #ifndef __shibsp_reqmap_h__
24 #define __shibsp_reqmap_h__
25
26 #include <shibsp/base.h>
27 #include <xmltooling/Lockable.h>
28
29 namespace xmltooling {
30     class XMLTOOL_API HTTPRequest;
31 };
32
33 namespace shibsp {
34
35     class SHIBSP_API AccessControl;
36     class SHIBSP_API PropertySet;
37
38     /**
39      * Interface to a request mapping plugin
40      * 
41      * Request mapping plugins return configuration settings that apply to resource requests.
42      * They can be implemented through cross-platform or platform-specific mechanisms.
43      */
44     class SHIBSP_API RequestMapper : public virtual xmltooling::Lockable
45     {
46         MAKE_NONCOPYABLE(RequestMapper);
47     protected:
48         RequestMapper();
49     public:
50         virtual ~RequestMapper();
51
52         /** Combination of configuration settings and effective access control. */
53         typedef std::pair<const PropertySet*,AccessControl*> Settings;
54
55         /**
56          * Map request to settings.
57          * 
58          * @param request   SP request
59          * @return configuration settings and effective AccessControl plugin, if any
60          */        
61         virtual Settings getSettings(const xmltooling::HTTPRequest& request) const=0;
62     };
63
64     /**
65      * Registers RequestMapper classes into the runtime.
66      */
67     void SHIBSP_API registerRequestMappers();
68
69     /** XML-based RequestMapper implementation. */
70     #define XML_REQUEST_MAPPER      "XML"
71
72     /** Hybrid of XML and platform-specific configuration. */
73     #define NATIVE_REQUEST_MAPPER   "Native"
74 };
75
76 #endif /* __shibsp_reqmap_h__ */