Rework decoder handling in simple resolver, add IdP/SP names to decoder API, hook...
[shibboleth/cpp-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          * @param assertingParty    name of the party asserting the attribute
48          * @param relyingParty      name of the party relying on the attribute
49          * @return a resolved Attribute
50          */
51         virtual Attribute* decode(
52             const char* id, const xmltooling::XMLObject* xmlObject, const char* assertingParty=NULL, const char* relyingParty=NULL
53             ) const=0;
54     };
55
56     /** Decodes SimpleAttributes */
57     #define SIMPLE_ATTRIBUTE_DECODER "Simple"
58     
59     /** Decodes ScopedAttributes */
60     #define SCOPED_ATTRIBUTE_DECODER "Scoped"
61
62     /** Decodes NameIDAttributes */
63     #define NAMEID_ATTRIBUTE_DECODER "NameID"
64
65     /** Registers built-in AttributeDecoders into the runtime. */
66     void registerAttributeDecoders();
67 };
68
69 #endif /* __shibsp_attrdecoder_h__ */