Fix linefeeds
[shibboleth/cpp-opensaml.git] / saml / security / X509TrustEngine.h
1 /*
2  *  Copyright 2001-2006 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/security/X509TrustEngine.h
19  * 
20  * Extended TrustEngine interface that adds validation of X.509 credentials.
21  */
22
23 #ifndef __saml_x509trust_h__
24 #define __saml_x509trust_h__
25
26 #include <saml/security/TrustEngine.h>
27
28 namespace opensaml {
29
30     /**
31      * Extended TrustEngine interface that adds validation of X.509 credentials.
32      */
33     class SAML_API X509TrustEngine : public TrustEngine {
34     protected:
35         /**
36          * Constructor.
37          * 
38          * If a DOM is supplied, the following XML content is supported:
39          * 
40          * <ul>
41          *  <li>&lt;KeyResolver&gt; elements with a type attribute
42          * </ul>
43          * 
44          * XML namespaces are ignored in the processing of this content.
45          * 
46          * @param e DOM to supply configuration for provider
47          */
48         X509TrustEngine(const DOMElement* e=NULL) : TrustEngine(e) {}
49         
50     public:
51         virtual ~X509TrustEngine() {}
52         
53         /**
54          * Determines whether an X.509 credential is valid with respect
55          * to the information known about the peer.
56          * 
57          * A custom KeyResolver can be supplied from outside the TrustEngine.
58          * Alternatively, one may be specified to the plugin constructor.
59          * A non-caching, inline resolver will be used as a fallback.
60          * 
61          * @param certEE        end-entity certificate to validate
62          * @param certChain     the complete set of certificates presented for validation (includes certEE)
63          * @param role          metadata role supplying key information
64          * @param checkName     true iff certificate subject/name checking has <b>NOT</b> already occurred
65          * @param keyResolver   optional externally supplied KeyResolver, or NULL
66          */
67         virtual bool validate(
68             XSECCryptoX509* certEE,
69             const std::vector<XSECCryptoX509*>& certChain,
70             const saml2md::RoleDescriptor& role,
71             bool checkName=true,
72             const xmlsignature::KeyResolver* keyResolver=NULL
73             ) const=0;
74     };
75     
76 };
77
78 #endif /* __saml_x509trust_h__ */