2 * Copyright 2009 Internet2
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file saml/saml2/profile/SAML2AssertionPolicy.h
20 * Policy subclass to track SAML 2.0 Assertion SubjectConfirmation.
23 #ifndef __saml_saml2asspol_h__
24 #define __saml_saml2asspol_h__
26 #include <saml/binding/SecurityPolicy.h>
28 #if defined (_MSC_VER)
29 #pragma warning( push )
30 #pragma warning( disable : 4250 4251 )
36 class SAML_API SubjectConfirmation;
40 * Policy subclass to track SAML 2.0 Assertion SubjectConfirmation.
42 class SAML_API SAML2AssertionPolicy : virtual public SecurityPolicy
46 * Constructor for policy.
48 * @param metadataProvider locked MetadataProvider instance
49 * @param role identifies the role (generally IdP or SP) of the policy peer
50 * @param trustEngine TrustEngine to authenticate policy peer
51 * @param validate true iff XML parsing should be done with validation
54 const saml2md::MetadataProvider* metadataProvider=NULL,
55 const xmltooling::QName* role=NULL,
56 const xmltooling::TrustEngine* trustEngine=NULL,
58 ) : SecurityPolicy(metadataProvider, role, trustEngine, validate) {
61 virtual ~SAML2AssertionPolicy() {}
63 virtual void reset(bool messageOnly=false);
64 void _reset(bool messageOnly=false) {
65 m_confirmation = false;
69 * Returns the subject confirmation that was successfully accepted by the policy.
71 * @return a successfully evaluated SubjectConfirmation
73 const saml2::SubjectConfirmation* getSubjectConfirmation() const {
74 return m_confirmation;
78 * Sets the SubjectConfirmation that was successfully accepted by the policy.
80 * <p>The lifetime of the SubjectConfirmation object <strong>MUST</strong> be longer
81 * than the lifetime of the policy object.
83 * @param confirmation the successfully evaluated SubjectConfirmation
85 void setSubjectConfirmation(const saml2::SubjectConfirmation* confirmation) {
86 m_confirmation = confirmation;
90 const saml2::SubjectConfirmation* m_confirmation;
95 #if defined (_MSC_VER)
96 #pragma warning( pop )
99 #endif /* __saml_saml2asspol_h__ */