Added abstract metadata base, chaining trust and metadata plugins.
[shibboleth/cpp-opensaml.git] / saml / saml2 / core / SAML2ArtifactType0004.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/saml2/core/SAML2ArtifactType0004.h\r
19  * \r
20  * Type 0x0004 SAML 2.0 artifact class\r
21  */\r
22 \r
23 #ifndef __saml_artifacttype0004_h__\r
24 #define __saml_artifacttype0004_h__\r
25 \r
26 #include <saml/saml2/core/SAML2Artifact.h>\r
27 \r
28 namespace opensaml {\r
29     namespace saml2p {\r
30         \r
31         /**\r
32          * Type 0x0004 SAML 2.0 artifact class\r
33          */\r
34         class SAML_API SAML2ArtifactType0004 : public SAML2Artifact\r
35         {\r
36             SAML2ArtifactType0004& operator=(const SAML2ArtifactType0004& src);\r
37         public:\r
38             /**\r
39              * Decodes a base64-encoded type 0x0004 artifact\r
40              * \r
41              * @param s NULL-terminated base64-encoded string \r
42              */        \r
43             SAML2ArtifactType0004(const char* s);\r
44 \r
45             /**\r
46              * Constructs an artifact with the specified source ID and index, but a random message handle.\r
47              * \r
48              * @param sourceid  SOURCEID_LENGTH bytes of binary data\r
49              * @param index     endpoint index\r
50              */        \r
51             SAML2ArtifactType0004(const std::string& sourceid, int index);\r
52 \r
53             /**\r
54              * Constructs an artifact with the specified source ID and assertion handle.\r
55              * \r
56              * @param sourceid  SOURCEID_LENGTH bytes of binary data\r
57              * @param index     endpoint index\r
58              * @param handle    HANDLE_LENGTH bytes of binary data \r
59              */        \r
60             SAML2ArtifactType0004(const std::string& sourceid, int index, const std::string& handle);\r
61     \r
62             virtual ~SAML2ArtifactType0004() {}\r
63             \r
64             virtual SAML2ArtifactType0004* clone() const {\r
65                 return new SAML2ArtifactType0004(*this);\r
66             }\r
67             \r
68             virtual std::string getSource() const {\r
69                 return toHex(getSourceID());\r
70             }\r
71 \r
72             /**\r
73              * Returns the binary data that identifies the source.\r
74              * The result MAY contain embedded null characters.\r
75              * \r
76              * @return the binary source ID\r
77              */\r
78             virtual std::string getSourceID() const {\r
79                 return m_raw.substr(TYPECODE_LENGTH + INDEX_LENGTH, SOURCEID_LENGTH);    // bytes 5-24\r
80             }\r
81             \r
82             virtual std::string getMessageHandle() const {\r
83                 return m_raw.substr(TYPECODE_LENGTH + INDEX_LENGTH + SOURCEID_LENGTH, HANDLE_LENGTH);    // bytes 25-44\r
84             }\r
85 \r
86             /** Length of source ID */            \r
87             static const unsigned int SOURCEID_LENGTH;\r
88 \r
89             /** Length of message handle */            \r
90             static const unsigned int HANDLE_LENGTH;\r
91     \r
92         protected:\r
93             SAML2ArtifactType0004(const SAML2ArtifactType0004& src) : SAML2Artifact(src) {}\r
94         };\r
95         \r
96     };\r
97 };\r
98 \r
99 #endif /* __saml_artifacttype0004_h__ */\r