From 4ad805325a28a192f7000c2a6bbfa2343adad2cb Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Tue, 6 Mar 2007 17:53:00 +0000 Subject: [PATCH] Null security rule for disabling security checks. --- saml/Makefile.am | 1 + saml/binding/impl/NullSecurityRule.cpp | 56 ++++++++++++++++++++++++++++++++++ saml/saml.vcproj | 4 +++ 3 files changed, 61 insertions(+) create mode 100644 saml/binding/impl/NullSecurityRule.cpp diff --git a/saml/Makefile.am b/saml/Makefile.am index 61cca51..8183f96 100644 --- a/saml/Makefile.am +++ b/saml/Makefile.am @@ -98,6 +98,7 @@ libsaml_la_SOURCES = \ binding/impl/MessageDecoder.cpp \ binding/impl/MessageEncoder.cpp \ binding/impl/MessageFlowRule.cpp \ + binding/impl/NullSecurityRule.cpp \ binding/impl/SAMLArtifact.cpp \ binding/impl/SecurityPolicy.cpp \ binding/impl/SimpleSigningRule.cpp \ diff --git a/saml/binding/impl/NullSecurityRule.cpp b/saml/binding/impl/NullSecurityRule.cpp new file mode 100644 index 0000000..e861072 --- /dev/null +++ b/saml/binding/impl/NullSecurityRule.cpp @@ -0,0 +1,56 @@ +/* + * Copyright 2001-2007 Internet2 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * NullSecurityRule.cpp + * + * SecurityPolicyRule that "disables" security. + */ + +#include "internal.h" +#include "binding/SecurityPolicyRule.h" + +#include + +using namespace opensaml; +using namespace xmltooling; +using namespace log4cpp; +using namespace std; + +namespace opensaml { + class SAML_DLLLOCAL NullSecurityRule : public SecurityPolicyRule + { + public: + NullSecurityRule(const DOMElement* e) : m_log(Category::getInstance(SAML_LOGCAT".SecurityPolicyRule.NullSecurity")) {} + virtual ~NullSecurityRule() {} + + void evaluate(const XMLObject& message, const GenericRequest* request, SecurityPolicy& policy) const; + + private: + Category& m_log; + }; + + SecurityPolicyRule* SAML_DLLLOCAL NullSecurityRuleFactory(const DOMElement* const & e) + { + return new NullSecurityRule(e); + } +}; + +void NullSecurityRule::evaluate(const XMLObject& message, const GenericRequest* request, SecurityPolicy& policy) const +{ + m_log.warn("security enforced using NULL policy rule, be sure you know what you're doing"); + policy.setSecure(true); +} diff --git a/saml/saml.vcproj b/saml/saml.vcproj index b1d48ab..107ae93 100644 --- a/saml/saml.vcproj +++ b/saml/saml.vcproj @@ -496,6 +496,10 @@ > + + -- 2.1.4