Convert from NULL macro to nullptr, remove unused zlib code.
[shibboleth/cpp-opensaml.git] / saml / saml2 / profile / SAML2AssertionPolicy.h
1 /*
2  *  Copyright 2009-2010 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 saml/saml2/profile/SAML2AssertionPolicy.h
19  *
20  * Policy subclass to track SAML 2.0 Assertion SubjectConfirmation.
21  */
22
23 #ifndef __saml_saml2asspol_h__
24 #define __saml_saml2asspol_h__
25
26 #include <saml/binding/SecurityPolicy.h>
27
28 #if defined (_MSC_VER)
29     #pragma warning( push )
30     #pragma warning( disable : 4250 4251 )
31 #endif
32
33 namespace opensaml {
34
35     namespace saml2 {
36         class SAML_API SubjectConfirmation;
37
38         /**
39          * Policy subclass to track SAML 2.0 Assertion SubjectConfirmation.
40          */
41         class SAML_API SAML2AssertionPolicy : virtual public SecurityPolicy
42         {
43         public:
44             /**
45              * Constructor for policy.
46              *
47              * @param metadataProvider  locked MetadataProvider instance
48              * @param role              identifies the role (generally IdP or SP) of the policy peer
49              * @param trustEngine       TrustEngine to authenticate policy peer
50              * @param validate          true iff XML parsing should be done with validation
51              */
52             SAML2AssertionPolicy(
53                 const saml2md::MetadataProvider* metadataProvider=nullptr,
54                 const xmltooling::QName* role=nullptr,
55                 const xmltooling::TrustEngine* trustEngine=nullptr,
56                 bool validate=true
57                 );
58
59             virtual ~SAML2AssertionPolicy();
60
61             virtual void reset(bool messageOnly=false);
62             void _reset(bool messageOnly=false);
63
64             /**
65              * Returns the subject confirmation that was successfully accepted by the policy.
66              *
67              * @return a successfully evaluated SubjectConfirmation
68              */
69             const saml2::SubjectConfirmation* getSubjectConfirmation() const;
70
71             /**
72              * Sets the SubjectConfirmation that was successfully accepted by the policy.
73              *
74              * <p>The lifetime of the SubjectConfirmation object <strong>MUST</strong> be longer
75              * than the lifetime of the policy object.
76              *
77              * @param confirmation the successfully evaluated SubjectConfirmation
78              */
79             void setSubjectConfirmation(const saml2::SubjectConfirmation* confirmation);
80
81         private:
82             const saml2::SubjectConfirmation* m_confirmation;
83         };
84     };
85 };
86
87 #if defined (_MSC_VER)
88     #pragma warning( pop )
89 #endif
90
91 #endif /* __saml_saml2asspol_h__ */