2 * Copyright 2001-2006 Internet2
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
18 * @file saml/security/ChainingTrustEngine.h
\r
20 * X509TrustEngine that uses multiple engines in sequence.
\r
23 #ifndef __saml_chaintrust_h__
\r
24 #define __saml_chaintrust_h__
\r
26 #include <saml/security/X509TrustEngine.h>
\r
28 namespace opensaml {
\r
31 * X509TrustEngine that uses multiple engines in sequence.
\r
33 class SAML_API ChainingTrustEngine : public X509TrustEngine {
\r
38 * If a DOM is supplied, the following XML content is supported:
\r
41 * <li><TrustEngine> elements with a type attribute
\r
44 * XML namespaces are ignored in the processing of this content.
\r
46 * @param e DOM to supply configuration for provider
\r
48 ChainingTrustEngine(const DOMElement* e=NULL);
\r
51 * Destructor will delete any embedded engines.
\r
53 virtual ~ChainingTrustEngine();
\r
56 * Adds a trust engine for future calls.
\r
58 * @param newEngine trust engine to add
\r
60 void addTrustEngine(X509TrustEngine* newEngine) {
\r
61 m_engines.push_back(newEngine);
\r
65 * Removes a trust engine. The caller must delete the engine if necessary.
\r
67 * @param oldEngine trust engine to remove
\r
68 * @return the old engine
\r
70 X509TrustEngine* removeTrustEngine(X509TrustEngine* oldEngine) {
\r
71 for (std::vector<X509TrustEngine*>::iterator i=m_engines.begin(); i!=m_engines.end(); i++) {
\r
72 if (oldEngine==(*i)) {
\r
80 virtual bool validate(
\r
81 xmlsignature::Signature& sig,
\r
82 const saml2md::RoleDescriptor& role,
\r
83 const xmlsignature::KeyResolver* keyResolver=NULL
\r
85 virtual bool validate(
\r
86 XSECCryptoX509* certEE,
\r
87 const std::vector<XSECCryptoX509*>& certChain,
\r
88 const saml2md::RoleDescriptor& role,
\r
89 bool checkName=true,
\r
90 const xmlsignature::KeyResolver* keyResolver=NULL
\r
94 std::vector<X509TrustEngine*> m_engines;
\r
99 #endif /* __saml_chaintrust_h__ */
\r