Convert logging to log4shib via compile time switch.
[shibboleth/opensaml2.git] / saml / binding / impl / NullSecurityRule.cpp
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  * NullSecurityRule.cpp
19  * 
20  * SecurityPolicyRule that "disables" security. 
21  */
22
23 #include "internal.h"
24 #include "binding/SecurityPolicyRule.h"
25
26 #include <xmltooling/logging.h>
27
28 using namespace opensaml;
29 using namespace xmltooling::logging;
30 using namespace xmltooling;
31 using namespace std;
32
33 namespace opensaml {
34     class SAML_DLLLOCAL NullSecurityRule : public SecurityPolicyRule
35     {
36     public:
37         NullSecurityRule(const DOMElement* e) : m_log(Category::getInstance(SAML_LOGCAT".SecurityPolicyRule.NullSecurity")) {}
38         virtual ~NullSecurityRule() {}
39         
40         void evaluate(const XMLObject& message, const GenericRequest* request, SecurityPolicy& policy) const;
41
42     private:
43         Category& m_log;
44     };
45
46     SecurityPolicyRule* SAML_DLLLOCAL NullSecurityRuleFactory(const DOMElement* const & e)
47     {
48         return new NullSecurityRule(e);
49     }
50 };
51
52 void NullSecurityRule::evaluate(const XMLObject& message, const GenericRequest* request, SecurityPolicy& policy) const
53 {
54     m_log.warn("security enforced using NULL policy rule, be sure you know what you're doing");
55     policy.setSecure(true);
56 }