Change license header.
[shibboleth/sp.git] / shibsp / attribute / filtering / impl / DummyAttributeFilter.cpp
1 /**
2  * Licensed to the University Corporation for Advanced Internet
3  * Development, Inc. (UCAID) under one or more contributor license
4  * agreements. See the NOTICE file distributed with this work for
5  * additional information regarding copyright ownership.
6  *
7  * UCAID licenses this file to you under the Apache License,
8  * Version 2.0 (the "License"); you may not use this file except
9  * in compliance with the License. You may obtain a copy of the
10  * License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17  * either express or implied. See the License for the specific
18  * language governing permissions and limitations under the License.
19  */\r
20 \r
21 /**\r
22  * DummyAttributeFilter.cpp\r
23  * \r
24  * Pathological AttributeFilter that rejects all attributes.\r
25  */\r
26 \r
27 #include "internal.h"\r
28 #include "attribute/Attribute.h"\r
29 #include "attribute/filtering/AttributeFilter.h"\r
30 \r
31 using namespace shibsp;\r
32 using namespace xmltooling;\r
33 using namespace std;\r
34 \r
35 namespace shibsp {\r
36 \r
37     class SHIBSP_DLLLOCAL DummyAttributeFilter : public AttributeFilter\r
38     {\r
39     public:\r
40         DummyAttributeFilter(const DOMElement* e) {\r
41         }\r
42         virtual ~DummyAttributeFilter() {\r
43         }\r
44         \r
45         Lockable* lock() {\r
46             return this;\r
47         }\r
48         void unlock() {\r
49         }\r
50         \r
51         void filterAttributes(const FilteringContext& context, vector<Attribute*>& attributes) const {\r
52             Category::getInstance(SHIBSP_LOGCAT".AttributeFilter.Dummy").warn("filtering out all attributes");\r
53             for_each(attributes.begin(), attributes.end(), xmltooling::cleanup<Attribute>());\r
54             attributes.clear();\r
55         }\r
56     };\r
57 \r
58     AttributeFilter* SHIBSP_DLLLOCAL DummyAttributeFilterFactory(const DOMElement* const & e)\r
59     {\r
60         return new DummyAttributeFilter(e);\r
61     }\r
62 };\r