5c5f373b0197b9c8ebcfd1334d0f418c8e794996
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / MetadataFilter.h
1 /*
2  *  Copyright 2001-2006 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 MetadataFilter.h
19  * 
20  * Processes metadata after it's been unmarshalled.
21  */
22
23 #ifndef __saml2_metadatafilt_h__
24 #define __saml2_metadatafilt_h__
25
26 #include <saml/saml2/metadata/Metadata.h>
27
28 namespace opensaml {
29
30     namespace saml2md {
31         
32         /**
33          * A metadata filter is used to process metadata after resolution and unmarshalling.
34          * 
35          * Some filters might remove everything but identity provider roles, decreasing the data a service provider
36          * needs to work with, or a filter could be used to perform integrity checking on the retrieved metadata by
37          * verifying a digital signature.
38          */
39         class SAML_API MetadataFilter
40         {
41             MAKE_NONCOPYABLE(MetadataFilter);
42             
43         public:
44             virtual ~MetadataFilter() {}
45             
46             /**
47              * Returns an identifying string for the filter.
48              * 
49              * @return the ID string
50              */
51             virtual const char* getId() const=0;
52             
53             /**
54              * Filters the given metadata. Exceptions should generally not be thrown to
55              * signal the removal of information, only for systemic processing failure.
56              * 
57              * @param xmlObject the metadata to be filtered.
58              * @throws FilterException thrown if an error occurs during the filtering process
59              */
60             virtual void doFilter(xmltooling::XMLObject& xmlObject) const=0;
61         };
62
63     };
64 };
65
66 #endif /* __saml2_metadatafilt_h__ */