0357e82cec85206a986490b3f05c5b9910c1f339
[shibboleth/sp.git] / shibsp / security / SecurityPolicy.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/security/SecurityPolicy.h
19  *
20  * SP-specific SecurityPolicy subclass.
21  */
22
23 #ifndef __shibsp_secpol_h__
24 #define __shibsp_secpol_h__
25
26 #include <shibsp/base.h>
27 #include <saml/saml2/profile/SAML2AssertionPolicy.h>
28
29 namespace shibsp {
30
31     class SHIBSP_API Application;
32
33     /**
34      * SP-specific SecurityPolicy subclass.
35      */
36     class SHIBSP_API SecurityPolicy : public opensaml::saml2::SAML2AssertionPolicy
37     {
38     public:
39         /**
40          * Constructor for policy.
41          *
42          * @param application       an Application instance
43          * @param role              identifies the role (generally IdP or SP) of the policy peer
44          * @param validate          true iff XML parsing should be done with validation
45          * @param policyId          identifies policy rules to auto-attach, defaults to the application's set
46          */
47         SecurityPolicy(const Application& application, const xmltooling::QName* role=NULL, bool validate=true, const char* policyId=NULL);
48
49         virtual ~SecurityPolicy();
50
51         opensaml::saml2md::MetadataProvider::Criteria& getMetadataProviderCriteria() const;
52
53         /**
54          * Returns the Application associated with the policy.
55          *
56          * @return the associated Application
57          */
58         const Application& getApplication() const;
59
60     private:
61         const Application& m_application;
62     };
63
64 };
65
66 #endif /* __shibsp_secpol_h__ */