31bcc0e6385560723f7e5abe1e3c32c16d333041
[shibboleth/cpp-xmltooling.git] / xmltooling / security / KeyInfoCredentialContext.h
1 /*
2  *  Copyright 2001-2007 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 xmltooling/security/KeyInfoCredentialContext.h
19  * 
20  * Context for credentials resolved out of a KeyInfo.
21  */
22
23 #if !defined(__xmltooling_keyinfocredctx_h__) && !defined(XMLTOOLING_NO_XMLSEC)
24 #define __xmltooling_keyinfocredctx_h__
25
26 #include <xmltooling/security/CredentialContext.h>
27 #include <xmltooling/signature/Signature.h>
28 #include <xsec/dsig/DSIGKeyInfoList.hpp>
29
30 namespace xmlsignature {
31     class XMLTOOL_API KeyInfo;
32 }
33
34 namespace xmltooling {
35
36     /**
37      * Context for credentials resolved out of a KeyInfo.
38      */
39     class XMLTOOL_API KeyInfoCredentialContext : public CredentialContext
40     {
41     public:
42         /**
43          * Constructor
44          */
45         KeyInfoCredentialContext(const xmlsignature::KeyInfo* keyInfo=NULL) : m_keyInfo(keyInfo), m_nativeKeyInfo(NULL) {
46         }
47
48         /**
49          * Constructor
50          */
51         KeyInfoCredentialContext(DSIGKeyInfoList* keyInfo) : m_keyInfo(NULL), m_nativeKeyInfo(keyInfo) {
52         }
53
54         virtual ~KeyInfoCredentialContext() {}
55
56         /**
57          * Gets the KeyInfo context.
58          * 
59          * @return the KeyInfo context
60          */
61         const xmlsignature::KeyInfo* getKeyInfo() const {
62             return m_keyInfo;
63         }
64
65         /**
66          * Gets the native KeyInfo context.
67          * 
68          * @return the native KeyInfo context
69          */
70         DSIGKeyInfoList* getNativeKeyInfo() const {
71             return m_nativeKeyInfo;
72         }
73
74     private:
75         const xmlsignature::KeyInfo* m_keyInfo;
76         DSIGKeyInfoList* m_nativeKeyInfo;
77     };
78 };
79
80 #endif /* __xmltooling_keyinfocredctx_h__ */