SSPCPP-671 - Handling of partial success in LogoutResponse needs work
[shibboleth/cpp-sp.git] / shibsp / handler / SecuredHandler.h
1 /**
2  * Licensed to the University Corporation for Advanced Internet
3  * Development, Inc. (UCAID) under one or more contributor license
4  * agreements. See the NOTICE file distributed with this work for
5  * additional information regarding copyright ownership.
6  *
7  * UCAID licenses this file to you under the Apache License,
8  * Version 2.0 (the "License"); you may not use this file except
9  * in compliance with the License. You may obtain a copy of the
10  * License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17  * either express or implied. See the License for the specific
18  * language governing permissions and limitations under the License.
19  */
20
21 /**
22  * @file shibsp/handler/SecuredHandler.h
23  * 
24  * Pluggable runtime functionality that is protected by simple access control.
25  */
26
27 #ifndef __shibsp_securedhandler_h__
28 #define __shibsp_securedhandler_h__
29
30 #include <shibsp/handler/AbstractHandler.h>
31 #include <shibsp/util/IPRange.h>
32
33 #include <vector>
34
35 namespace shibsp {
36
37 #if defined (_MSC_VER)
38     #pragma warning( push )
39     #pragma warning( disable : 4250 )
40 #endif
41
42     /**
43      * Pluggable runtime functionality that is protected by simple access control.
44      */
45     class SHIBSP_API SecuredHandler : public AbstractHandler
46     {
47     protected:
48         /**
49          * Constructor
50          * 
51          * @param e             DOM element to load as property set
52          * @param log           logging category to use
53          * @param aclProperty   name of IP/CIDR ACL property
54          * @param defaultACL    IP/CIDR ACL to apply if no acl property is set
55          * @param filter        optional filter controls what child elements to include as nested PropertySets
56          * @param remapper      optional map of property rename rules for legacy property support
57          */
58         SecuredHandler(
59             const xercesc::DOMElement* e,
60             xmltooling::logging::Category& log,
61             const char* aclProperty="acl",
62             const char* defaultACL=nullptr,
63             xercesc::DOMNodeFilter* filter=nullptr,
64             const std::map<std::string,std::string>* remapper=nullptr
65             );
66
67     public:
68         virtual ~SecuredHandler();
69
70         std::pair<bool,long> run(SPRequest& request, bool isHandler=true) const;
71
72     private:
73         void parseACL(const std::string& acl);
74         std::vector<IPRange> m_acl;
75     };
76
77 #if defined (_MSC_VER)
78     #pragma warning( pop )
79 #endif
80
81 };
82
83 #endif /* __shibsp_securedhandler_h__ */