Update copyright.
[shibboleth/cpp-opensaml.git] / saml / signature / ContentReference.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 saml/signature/ContentReference.h
19  * 
20  * SAML-specific signature reference profile 
21  */
22
23 #ifndef __saml_sigref_h__
24 #define __saml_sigref_h__
25
26 #include <saml/base.h>
27 #include <xmltooling/signature/ContentReference.h>
28
29 #include <string>
30
31 namespace opensaml {
32
33     class SAML_API SignableObject;
34
35     /**
36      * SAML-specific signature reference profile.
37      */
38     class SAML_API ContentReference : public virtual xmlsignature::ContentReference
39     {
40     public:
41         /**
42          * Constructor.
43          * 
44          * @param signableObject    reference to object being signed
45          */
46         ContentReference(const SignableObject& signableObject) : m_signableObject(signableObject) {
47         }
48     
49         virtual ~ContentReference() {}
50
51         /**
52          * Given a "blank" native signature, creates signature reference
53          * appropriate for the SAML object being signed.
54          * 
55          * @param sig   native signature interface
56          */
57         virtual void createReferences(DSIGSignature* sig);
58         
59         /**
60          * Adds a namespace prefix for "inclusive" processing by the
61          * Exclusive C14N Transform applied to the object.
62          * An empty string will be transformed into "#default".
63          * 
64          * @param prefix    the prefix to add 
65          */
66         void addInclusivePrefix(const char* prefix) {
67             m_prefixes.push_back(prefix);
68         }
69
70     protected:
71         /** Reference to object to sign. */
72         const SignableObject& m_signableObject;
73
74         /** Inclusive prefixes. */
75         std::vector<std::string> m_prefixes;
76     };
77
78 };
79
80 #endif /* __saml_sigref_h__ */