2 * Copyright 2001-2009 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 * Returns the rule's class/type.
48 * @return the class/type of the object
50 virtual const char* getType() const=0;
53 * Evaluates the rule against the given request and message.
55 * <p>An exception will be raised if the message is fatally invalid according to
58 * <p>The return value is used to indicate whether a message was ignored or
59 * successfully processed. A false value signals that the rule wasn't successful
60 * because the rule was inapplicable to the message, but allows other rules to
61 * return an alternate result.
63 * @param message the incoming message
64 * @param request the protocol request
65 * @param policy SecurityPolicy to provide various components and track message data
66 * @return indicator as to whether a message was understood and processed
68 virtual bool evaluate(
69 const xmltooling::XMLObject& message,
70 const xmltooling::GenericRequest* request,
71 SecurityPolicy& policy
76 * Registers SecurityPolicyRule plugins into the runtime.
78 void SAML_API registerSecurityPolicyRules();
81 * SecurityPolicyRule for evaluation of SAML AudienceRestriction Conditions.
83 #define AUDIENCE_POLICY_RULE "Audience"
86 * SecurityPolicyRule for evaluation of SAML DelegationRestriction Conditions.
88 #define DELEGATION_POLICY_RULE "Delegation"
91 * SecurityPolicyRule for TLS client certificate authentication.
93 * Evaluates client certificates against the issuer's metadata.
95 #define CLIENTCERTAUTH_POLICY_RULE "ClientCertAuth"
98 * SecurityPolicyRule for evaluation of SAML Conditions.
100 #define CONDITIONS_POLICY_RULE "Conditions"
103 * SecurityPolicyRule for ignoring a SAML Condition.
105 #define IGNORE_POLICY_RULE "Ignore"
108 * SecurityPolicyRule for replay detection and freshness checking.
110 * <p>A ReplayCache instance must be available from the runtime, unless
111 * a "checkReplay" XML attribute is set to "0" or "false" when instantiating
114 * <p>Messages must have been issued in the past, but no more than 60 seconds ago,
115 * or up to a number of seconds set by an "expires" XML attribute when
116 * instantiating the policy rule.
118 #define MESSAGEFLOW_POLICY_RULE "MessageFlow"
121 * SecurityPolicyRule for disabling security.
123 * Allows the message issuer to be authenticated regardless of the message or
124 * transport. Used mainly for debugging or in situations that I wouldn't care to
127 #define NULLSECURITY_POLICY_RULE "NullSecurity"
130 * SecurityPolicyRule for protocol message "blob" signing.
132 * Allows the message issuer to be authenticated using a non-XML digital signature
133 * over the message body. The transport layer is not considered.
135 #define SIMPLESIGNING_POLICY_RULE "SimpleSigning"
138 * SecurityPolicyRule for protocol message XML signing.
140 * Allows the message issuer to be authenticated using an XML digital signature
141 * over the message. The transport layer is not considered.
143 #define XMLSIGNING_POLICY_RULE "XMLSigning"
146 * SecurityPolicyRule for SAML 1.x Browser SSO profile validation.
148 * Enforces presence of time conditions and proper subject confirmation.
150 #define SAML1BROWSERSSO_POLICY_RULE "SAML1BrowserSSO"
153 * SecurityPolicyRule for SAML 2.0 bearer SubjectConfirmation.
155 * <p>Optionally enforces message delivery requirements based on SubjectConfirmationData.
157 * <p>The XML attributes "checkValidity", "checkRecipient", and "checkCorrelation" can be set
158 * "false" to disable checks of NotBefore/NotOnOrAfter, Recipient, and InResponseTo confirmation
161 #define BEARER_POLICY_RULE "Bearer"
164 #endif /* __saml_secrule_h__ */