2 * Copyright 2001-2007 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.
20 * A function that evaluates whether an expressed criteria is met by the current filter context.
24 #include "attribute/filtering/MatchFunctor.h"
25 #include "util/SPConstants.h"
27 #include <xercesc/util/XMLUniDefs.hpp>
29 using namespace shibsp;
30 using namespace xmltooling;
34 SHIBSP_DLLLOCAL PluginManager< MatchFunctor,QName,pair<const FilterPolicyContext*,const DOMElement*> >::Factory AnyFunctorFactory;
35 SHIBSP_DLLLOCAL PluginManager< MatchFunctor,QName,pair<const FilterPolicyContext*,const DOMElement*> >::Factory AndFunctorFactory;
36 SHIBSP_DLLLOCAL PluginManager< MatchFunctor,QName,pair<const FilterPolicyContext*,const DOMElement*> >::Factory OrFunctorFactory;
37 SHIBSP_DLLLOCAL PluginManager< MatchFunctor,QName,pair<const FilterPolicyContext*,const DOMElement*> >::Factory NotFunctorFactory;
39 static const XMLCh ANY[] = UNICODE_LITERAL_3(A,N,Y);
40 static const XMLCh AND[] = UNICODE_LITERAL_3(A,N,D);
41 static const XMLCh OR[] = UNICODE_LITERAL_2(O,R);
42 static const XMLCh NOT[] = UNICODE_LITERAL_3(N,O,T);
45 QName shibsp::AnyMatchFunctorType(shibspconstants::SHIB2ATTRIBUTEFILTER_MF_BASIC_NS, ANY);
46 QName shibsp::AndMatchFunctorType(shibspconstants::SHIB2ATTRIBUTEFILTER_MF_BASIC_NS, AND);
47 QName shibsp::OrMatchFunctorType(shibspconstants::SHIB2ATTRIBUTEFILTER_MF_BASIC_NS, OR);
48 QName shibsp::NotMatchFunctorType(shibspconstants::SHIB2ATTRIBUTEFILTER_MF_BASIC_NS, NOT);
50 void SHIBSP_API shibsp::registerMatchFunctors()
52 SPConfig& conf = SPConfig::getConfig();
53 conf.MatchFunctorManager.registerFactory(AnyMatchFunctorType, AnyFunctorFactory);
54 conf.MatchFunctorManager.registerFactory(AndMatchFunctorType, AndFunctorFactory);
55 conf.MatchFunctorManager.registerFactory(OrMatchFunctorType, OrFunctorFactory);
56 conf.MatchFunctorManager.registerFactory(NotMatchFunctorType, NotFunctorFactory);