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