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