Reducing header overuse, non-inlining selected methods (CPPOST-35).
[shibboleth/cpp-opensaml.git] / saml / saml1 / profile / AssertionValidator.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 saml/saml1/profile/AssertionValidator.h
19  *
20  * SAML 1.x basic assertion validator.
21  */
22
23 #ifndef __saml1_assval_h__
24 #define __saml1_assval_h__
25
26 #include <saml/base.h>
27
28 #include <ctime>
29 #include <vector>
30 #include <xmltooling/validation/Validator.h>
31
32 namespace opensaml {
33     namespace saml1 {
34
35         class SAML_API Assertion;
36         class SAML_API Condition;
37
38         /**
39          * @deprecated
40          * SAML 1.x basic assertion validator provides time and audience condition checking.
41          */
42         class SAML_API AssertionValidator : public virtual xmltooling::Validator
43         {
44         public:
45             /**
46              * Constructor
47              *
48              * @param recipient name of assertion recipient (implicit audience)
49              * @param audiences additional audience values
50              * @param ts        timestamp to evaluate assertion conditions, or 0 to bypass check
51              */
52             AssertionValidator(const XMLCh* recipient, const std::vector<const XMLCh*>* audiences=NULL, time_t ts=0);
53
54             virtual ~AssertionValidator();
55
56             void validate(const xmltooling::XMLObject* xmlObject) const;
57
58             /**
59              * Type-safe validation method.
60              *
61              * @param assertion assertion to validate
62              */
63             virtual void validateAssertion(const Assertion& assertion) const;
64
65             /**
66              * Condition validation.
67              *
68              * <p>The base class version only understands AudienceRestrictionConditions.
69              * All other condition types will be rejected and require subclassing to
70              * prevent validation failure.
71              *
72              * @param condition condition to validate
73              */
74             virtual void validateCondition(const Condition* condition) const;
75
76         protected:
77             /** Name of recipient (implicit audience). */
78             const XMLCh* m_recipient;
79
80             /** Additional audience values. */
81             const std::vector<const XMLCh*>* m_audiences;
82
83             /** Timestamp to evaluate assertion conditions. */
84             time_t m_ts;
85         };
86
87     };
88 };
89
90 #endif /* __saml1_assval_h__ */