2 * Copyright 2001-2007 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 xmltooling/security/CredentialResolver.h
20 * An API for resolving keys and certificates based on application criteria.
23 #if !defined(__xmltooling_credres_h__) && !defined(XMLTOOLING_NO_XMLSEC)
24 #define __xmltooling_credres_h__
26 #include <xmltooling/Lockable.h>
28 namespace xmltooling {
30 class XMLTOOL_API Credential;
31 class XMLTOOL_API CredentialCriteria;
34 * An API for resolving keys and certificates based on application criteria.
36 class XMLTOOL_API CredentialResolver : public virtual Lockable
38 MAKE_NONCOPYABLE(CredentialResolver);
43 virtual ~CredentialResolver();
46 * Returns a single Credential according to the supplied criteria.
48 * @param criteria an optional CredentialCriteria object
49 * @return a Credential, or NULL if none could be found
51 virtual const Credential* resolve(const CredentialCriteria* criteria=NULL) const=0;
54 * Returns all matching Credentials according to the supplied criteria.
56 * @param results array to store matching Credentials
57 * @param criteria an optional CredentialCriteria object
58 * @return number of credentials found
60 virtual std::vector<const Credential*>::size_type resolve(
61 std::vector<const Credential*>& results, const CredentialCriteria* criteria=NULL
66 * Registers CredentialResolver classes into the runtime.
68 void XMLTOOL_API registerCredentialResolvers();
70 /** CredentialResolver based on local files with no criteria support. */
71 #define FILESYSTEM_CREDENTIAL_RESOLVER "File"
73 /** CredentialResolver based on chaining together other resolvers. */
74 #define CHAINING_CREDENTIAL_RESOLVER "Chaining"
77 #endif /* __xmltooling_credres_h__ */