2 * Copyright 2001-2010 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 shibsp/attribute/filtering/MatchFunctor.h
20 * A function that evaluates whether an expressed criteria is met by the current filter context.
23 #ifndef __shibsp_matchfunc_h__
24 #define __shibsp_matchfunc_h__
26 #include <shibsp/base.h>
30 class SHIBSP_API Attribute;
31 class SHIBSP_API FilteringContext;
34 * A function that evaluates whether an expressed criteria is met by the current filter context.
36 class SHIBSP_API MatchFunctor
38 MAKE_NONCOPYABLE(MatchFunctor);
42 virtual ~MatchFunctor();
45 * Evaluates this matching criteria. This evaluation is used when a filtering engine determines policy
48 * @param filterContext current filtering context
49 * @return true if the criteria for this matching function are met
50 * @throws AttributeFilteringException thrown if the function can not be evaluated
52 virtual bool evaluatePolicyRequirement(const FilteringContext& filterContext) const=0;
55 * Evaluates this matching criteria. This evaluation is used when a filtering engine is filtering attribute
58 * @param filterContext the current filtering context
59 * @param attribute the attribute being evaluated
60 * @param index the index of the attribute value being evaluated
61 * @return true if the criteria for this matching function are met
62 * @throws AttributeFilteringException thrown if the function can not be evaluated
64 virtual bool evaluatePermitValue(const FilteringContext& filterContext, const Attribute& attribute, size_t index) const=0;
67 /** Always evaluates to true. */
68 extern SHIBSP_API xmltooling::QName AnyMatchFunctorType;
70 /** Conjunction MatchFunctor. */
71 extern SHIBSP_API xmltooling::QName AndMatchFunctorType;
73 /** Disjunction MatchFunctor. */
74 extern SHIBSP_API xmltooling::QName OrMatchFunctorType;
76 /** Negating MatchFunctor. */
77 extern SHIBSP_API xmltooling::QName NotMatchFunctorType;
79 /** Matches the issuing entity's name. */
80 extern SHIBSP_API xmltooling::QName AttributeIssuerStringType;
82 /** Matches the requesting entity's name. */
83 extern SHIBSP_API xmltooling::QName AttributeRequesterStringType;
85 /** Matches the principal's authentication method/class or context reference. */
86 extern SHIBSP_API xmltooling::QName AuthenticationMethodStringType;
88 /** Matches an attribute's string value. */
89 extern SHIBSP_API xmltooling::QName AttributeValueStringType;
91 /** Matches an attribute's "scope". */
92 extern SHIBSP_API xmltooling::QName AttributeScopeStringType;
94 /** Matches the issuing entity's name. */
95 extern SHIBSP_API xmltooling::QName AttributeIssuerRegexType;
97 /** Matches the requesting entity's name. */
98 extern SHIBSP_API xmltooling::QName AttributeRequesterRegexType;
100 /** Matches the principal's authentication method/class or context reference. */
101 extern SHIBSP_API xmltooling::QName AuthenticationMethodRegexType;
103 /** Matches an attribute's string value. */
104 extern SHIBSP_API xmltooling::QName AttributeValueRegexType;
106 /** Matches an attribute's "scope". */
107 extern SHIBSP_API xmltooling::QName AttributeScopeRegexType;
109 /** Matches based on the number of values. */
110 extern SHIBSP_API xmltooling::QName NumberOfAttributeValuesType;
112 /** Matches based on metadata groups of issuer. */
113 extern SHIBSP_API xmltooling::QName AttributeIssuerInEntityGroupType;
115 /** Matches based on metadata groups of requester. */
116 extern SHIBSP_API xmltooling::QName AttributeRequesterInEntityGroupType;
118 /** Matches based on metadata Scope extensions. */
119 extern SHIBSP_API xmltooling::QName AttributeScopeMatchesShibMDScopeType;
121 /** Matches based on NameID NameQualifiers. */
122 extern SHIBSP_API xmltooling::QName NameIDQualifierStringType;
125 * Registers MatchFunctor classes into the runtime.
127 void SHIBSP_API registerMatchFunctors();
130 #endif /* __shibsp_matchfunc_h__ */