944a59c8476eefcd0197e091d5ac772ded58c545
[shibboleth/sp.git] / shibsp / attribute / AttributeDecoder.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 shibsp/attribute/AttributeDecoder.h
19  * 
20  * Decodes SAML NameID/Attribute objects into resolved Attributes.
21  */
22
23 #ifndef __shibsp_attrdecoder_h__
24 #define __shibsp_attrdecoder_h__
25
26 #include <shibsp/attribute/Attribute.h>
27 #include <xmltooling/XMLObject.h>
28
29 namespace shibsp {
30
31     /**
32      * Decodes XML objects into resolved Attributes.
33      */
34     class SHIBSP_API AttributeDecoder
35     {
36         MAKE_NONCOPYABLE(AttributeDecoder);
37     protected:
38         AttributeDecoder() {}
39     public:
40         virtual ~AttributeDecoder() {}
41         
42         /**
43          * Decodes an XMLObject into a resolved Attribute.
44          * 
45          * @param id        ID of resolved attribute
46          * @param xmlObject XMLObject to decode
47          * @return a resolved Attribute
48          */
49         virtual Attribute* decode(const char* id, const xmltooling::XMLObject* xmlObject) const=0;
50     };
51
52     /** Decodes SimpleAttributes */
53     #define SIMPLE_ATTRIBUTE_DECODER "Simple"
54     
55     /** Decodes ScopedAttributes */
56     #define SCOPED_ATTRIBUTE_DECODER "Scoped"
57
58     /** Decodes NameIDAttributes */
59     #define NAMEID_ATTRIBUTE_DECODER "NameID"
60
61     /** Registers built-in AttributeDecoders into the runtime. */
62     void registerAttributeDecoders();
63 };
64
65 #endif /* __shibsp_attrdecoder_h__ */