2 * Copyright 2001-2006 Internet2
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file saml/binding/SecurityPolicyRule.h
20 * Policy rules that secure and authenticate bindings.
23 #ifndef __saml_secrule_h__
24 #define __saml_secrule_h__
26 #include <saml/binding/SecurityPolicy.h>
31 * A rule that a protocol request and message must meet in order to be valid and secure.
33 * <p>Rules must be stateless and thread-safe across evaluations. Evaluation should not
34 * result in an exception if the request/message properties do not apply to the rule
35 * (e.g. particular security mechanisms that are not present).
37 class SAML_API SecurityPolicyRule
39 MAKE_NONCOPYABLE(SecurityPolicyRule);
41 SecurityPolicyRule() {}
43 virtual ~SecurityPolicyRule() {}
46 * Evaluates the rule against the given request and message.
48 * <p>Exceptions should be reserved for fatal request processing errors;
49 * otherwise rules should return false to indicate they were not applicable
52 * @param message the incoming message
53 * @param request the protocol request
54 * @param policy SecurityPolicy to provide various components and track message data
55 * @return true iff the rule ran successfully, false otherwise
57 * @throws BindingException thrown if the request/message is invalid in some way
59 virtual bool evaluate(
60 const xmltooling::XMLObject& message, const GenericRequest* request, SecurityPolicy& policy
65 * Registers SecurityPolicyRule plugins into the runtime.
67 void SAML_API registerSecurityPolicyRules();
70 * SecurityPolicyRule for processing SAML 1.x messages.
72 * Extracts message ID, timestamp, and issuer information.
74 #define SAML1MESSAGE_POLICY_RULE "org.opensaml.saml1.binding.SAML1MessageRule"
77 * SecurityPolicyRule for processing SAML 2.0 messages.
79 * Extracts message ID, timestamp, and issuer information.
81 #define SAML2MESSAGE_POLICY_RULE "org.opensaml.saml2.binding.SAML2MessageRule"
84 * SecurityPolicyRule for TLS client certificate authentication.
86 * Evaluates client certificates against the issuer's metadata.
88 #define CLIENTCERTAUTH_POLICY_RULE "org.opensaml.binding.ClientCertAuthRule"
91 * SecurityPolicyRule for replay detection and freshness checking.
93 * <p>A ReplayCache instance must be available from the runtime, unless
94 * a "checkReplay" XML attribute is set to "0" or "false" when instantiating
97 * <p>Messages must have been issued in the past, but no more than 60 seconds ago,
98 * or up to a number of seconds set by an "expires" XML attribute when
99 * instantiating the policy rule.
101 #define MESSAGEFLOW_POLICY_RULE "org.opensaml.binding.MessageFlowRule"
104 * SecurityPolicyRule for protocol message "blob" signing.
106 * Allows the message issuer to be authenticated using a non-XML digital signature
107 * over the message body. The transport layer is not considered.
109 #define SIMPLESIGNING_POLICY_RULE "org.opensaml.binding.SimpleSigningRule"
112 * SecurityPolicyRule for protocol message XML signing.
114 * Allows the message issuer to be authenticated using an XML digital signature
115 * over the message. The transport layer is not considered.
117 #define XMLSIGNING_POLICY_RULE "org.opensaml.binding.XMLSigningRule"
120 #endif /* __saml_secrule_h__ */