Fix backslashes in SHIBSP_PREFIX variable by manually creating it during the script...
[shibboleth/sp.git] / shibsp / AccessControl.h
1 /*
2  *  Copyright 2001-2007 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/AccessControl.h
19  * 
20  * Interface to an access control plugin
21  */
22
23 #ifndef __shibsp_acl_h__
24 #define __shibsp_acl_h__
25
26 #include <shibsp/base.h>
27 #include <xmltooling/Lockable.h>
28
29 namespace shibsp {
30
31     class SHIBSP_API Session;
32     class SHIBSP_API SPRequest;
33
34      /**
35      * Interface to an access control plugin
36      * 
37      * Access control plugins return authorization decisions based on the intersection
38      * of the resource request and the active session. They can be implemented through
39      * cross-platform or platform-specific mechanisms.
40      */
41     class SHIBSP_API AccessControl : public virtual xmltooling::Lockable
42     {
43         MAKE_NONCOPYABLE(AccessControl);
44     protected:
45         AccessControl() {}
46     public:
47         virtual ~AccessControl() {}
48
49         /**
50          * Possible results from an access control decision.
51          */
52         enum aclresult_t {
53             shib_acl_true,
54             shib_acl_false,
55             shib_acl_indeterminate
56         };
57         
58         /**
59          * Perform an authorization check.
60          * 
61          * @param request   SP request information
62          * @param session   active user session, if any
63          * @return true iff access should be granted
64          */
65         virtual aclresult_t authorized(const SPRequest& request, const Session* session) const=0;
66     };
67
68     /**
69      * Registers AccessControl classes into the runtime.
70      */
71     void SHIBSP_API registerAccessControls();
72
73     /** AccessControl based on rudimentary XML syntax. */
74     #define XML_ACCESS_CONTROL  "XML"
75
76     /** Reserved for Apache-style .htaccess support. */
77     #define HT_ACCESS_CONTROL   "htaccess"
78 };
79
80 #endif /* __shibsp_acl_h__ */