Class BaseFilterParser
java.lang.Object
org.springframework.beans.factory.xml.AbstractBeanDefinitionParser
org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser
net.shibboleth.ext.spring.util.AbstractCustomBeanDefinitionParser
net.shibboleth.idp.attribute.filter.spring.BaseFilterParser
- All Implemented Interfaces:
BeanDefinitionParser
- Direct Known Subclasses:
AndMatcherParser
,AnyParser
,AttributeFilterPolicyParser
,AttributeRuleParser
,BaseAttributeValueMatcherParser
,BasePolicyRuleParser
,NotMatcherParser
,OrMatcherParser
,ScriptedMatcherParser
public abstract class BaseFilterParser extends AbstractCustomBeanDefinitionParser
Base class for Spring bean definition parsers within the filter engine configuration.
This base class is responsible for generating an ID for the Spring bean that is unique within all the policy components loaded. This in turn underpins our implementation of referencing in the language.
-
Field Summary
Fields Modifier and Type Field Description static QName
AFP_ELEMENT_NAME
Element name.static QName
DENY_VALUE_RULE
DenyValueRule.private static IdentifierGenerationStrategy
idGen
Generator of unique IDs.private static org.slf4j.Logger
LOG
Class logger.static String
NAMESPACE
Namespace The Top level filters.static QName
PERMIT_VALUE_RULE
PermitValueRule.static QName
POLICY_REQUIREMENT_RULE
The PolicyRequirementRule QName.static String
QUALIFIED_ID
The attribute name for the qualified id.Fields inherited from class org.springframework.beans.factory.xml.AbstractBeanDefinitionParser
ID_ATTRIBUTE, NAME_ATTRIBUTE
-
Constructor Summary
Constructors Constructor Description BaseFilterParser()
-
Method Summary
Modifier and Type Method Description protected void
doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder)
protected String
getAbsoluteReference(Element configElement, String componentNamespace, String reference)
Gets the absolute reference given a possibly relative reference.protected String
getQualifiedId(Element configElement, String componentNamespace, String localId)
Generates an ID for a filter engine component.protected boolean
isPolicyRule(Element element)
Is this inside a <PolicyRequirementRule> or an permit or deny rule?.static ManagedList<BeanDefinition>
parseCustomElements(Collection<Element> elements, ParserContext parserContext, BeanDefinitionBuilder parentBuilder)
Parse list of elements into bean definitions.protected String
resolveId(Element configElement, AbstractBeanDefinition beanDefinition, ParserContext parserContext)
Methods inherited from class net.shibboleth.ext.spring.util.AbstractCustomBeanDefinitionParser
registerBeanDefinition
Methods inherited from class org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser
doParse, getBeanClass, getBeanClassName, getParentName, parseInternal
Methods inherited from class org.springframework.beans.factory.xml.AbstractBeanDefinitionParser
parse, postProcessComponentDefinition, shouldFireEvents, shouldGenerateId, shouldGenerateIdAsFallback, shouldParseNameAsAliases
-
Field Details
-
NAMESPACE
Namespace The Top level filters.- See Also:
- Constant Field Values
-
AFP_ELEMENT_NAME
Element name. -
POLICY_REQUIREMENT_RULE
The PolicyRequirementRule QName. -
PERMIT_VALUE_RULE
PermitValueRule. -
DENY_VALUE_RULE
DenyValueRule. -
QUALIFIED_ID
The attribute name for the qualified id.- See Also:
- Constant Field Values
-
idGen
Generator of unique IDs. -
LOG
private static final org.slf4j.Logger LOGClass logger.
-
-
Constructor Details
-
BaseFilterParser
public BaseFilterParser()
-
-
Method Details
-
getQualifiedId
@Nonnull @NotEmpty protected String getQualifiedId(@Nonnull Element configElement, @Nonnull String componentNamespace, @Nullable String localId)Generates an ID for a filter engine component. If the given localId is null a random one will be generated.- Parameters:
configElement
- component configuration elementcomponentNamespace
- namespace for the componentlocalId
- local id or null- Returns:
- unique ID for the component
-
getAbsoluteReference
@Nonnull @NotEmpty protected String getAbsoluteReference(@Nonnull Element configElement, @Nonnull @NotEmpty String componentNamespace, @Nonnull @NotEmpty String reference)Gets the absolute reference given a possibly relative reference.- Parameters:
configElement
- component configuration elementcomponentNamespace
- namespace for the componentreference
- Reference to convert into an absolute- Returns:
- absolute form of the reference
-
doParse
protected void doParse(@Nonnull Element element, @Nonnull ParserContext parserContext, @Nonnull BeanDefinitionBuilder builder)Calculate the qualified id once, and set both the id property as well as a qualified id metadata attribute used by the
resolveId(Element, AbstractBeanDefinition, ParserContext)
method.If we auto-generate a name then we issue a warning so users can (1) correct this, but also so they can make sense of the logging in the filters which uses the id extensively.
- Overrides:
doParse
in classAbstractSingleBeanDefinitionParser
-
resolveId
@Nonnull @NotEmpty protected String resolveId(@Nonnull Element configElement, @Nonnull AbstractBeanDefinition beanDefinition, @Nonnull ParserContext parserContext)- Overrides:
resolveId
in classAbstractBeanDefinitionParser
-
isPolicyRule
Is this inside a <PolicyRequirementRule> or an permit or deny rule?.This is used when parsing the various rules (<MatchFunctorType>) since the bean we summon up depends on where we find ourselves.
- Parameters:
element
- the element under question- Returns:
- true if it is inside a policy requirement rule, false otherwise.
-
parseCustomElements
@Nullable public static ManagedList<BeanDefinition> parseCustomElements(@Nullable @NonnullElements Collection<Element> elements, @Nonnull ParserContext parserContext, @Nonnull BeanDefinitionBuilder parentBuilder)Parse list of elements into bean definitions. This is like {SpringSupport.parseCustomElements(Collection, ParserContext, BeanDefinitionBuilder)
but with qualifiedName warnings.- Parameters:
elements
- list of elements to parseparserContext
- current parsing contextparentBuilder
- the builder we are going to insert into- Returns:
- list of bean definitions
-