Package net.shibboleth.idp.attribute.filter.spring

# Class BaseFilterParser

java.lang.Object
org.springframework.beans.factory.xml.AbstractBeanDefinitionParser
org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser
net.shibboleth.shared.spring.custom.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 final QName`
`AFP_ELEMENT_NAME`
Element name.
`static final QName`
`DENY_VALUE_RULE`
DenyValueRule.
`private static IdentifierGenerationStrategy`
`idGen`
Generator of unique IDs.
`private static final org.slf4j.Logger`
`LOG`
Class logger.
`static final String`
`NAMESPACE`
Namespace The Top level filters.
`static final QName`
`PERMIT_VALUE_RULE`
PermitValueRule.
`static final QName`
`POLICY_REQUIREMENT_RULE`
The PolicyRequirementRule QName.
`static final String`
`QUALIFIED_ID`
The attribute name for the qualified id.

### Fields inherited from class net.shibboleth.shared.spring.custom.AbstractCustomBeanDefinitionParser

`CUSTOM_PARSER_PROPERTIES_LOCATION`

### 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.shared.spring.custom.AbstractCustomBeanDefinitionParser

`getCustomProperty, 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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### NAMESPACE

@Nonnull @NotEmpty public static final String NAMESPACE
Namespace The Top level filters.

See Also:
  - Constant Field Values

### AFP_ELEMENT_NAME

@Nonnull public static final QName AFP_ELEMENT_NAME
Element name.

### POLICY_REQUIREMENT_RULE

@Nonnull public static final QName POLICY_REQUIREMENT_RULE
The PolicyRequirementRule QName.

### PERMIT_VALUE_RULE

@Nonnull public static final QName PERMIT_VALUE_RULE
PermitValueRule.

### DENY_VALUE_RULE

@Nonnull public static final QName DENY_VALUE_RULE
DenyValueRule.

### QUALIFIED_ID

@Nonnull @NotEmpty public static final String QUALIFIED_ID
The attribute name for the qualified id.

See Also:
  - Constant Field Values

### idGen

@Nonnull private static IdentifierGenerationStrategy idGen
Generator of unique IDs.

### LOG

@Nonnull private static final org.slf4j.Logger LOG
Class 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 element
  `componentNamespace` - namespace for the component
  `localId` - 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 element
  `componentNamespace` - namespace for the component
  `reference` - 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 class `AbstractSingleBeanDefinitionParser`

### resolveId

@Nonnull @NotEmpty protected String resolveId(@Nonnull Element configElement, @Nonnull AbstractBeanDefinition beanDefinition, @Nonnull ParserContext parserContext)

Overrides:
  `resolveId` in class `AbstractBeanDefinitionParser`

### isPolicyRule

protected boolean isPolicyRule(@Nonnull Element element)
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 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 parse
  `parserContext` - current parsing context
  `parentBuilder` - the builder we are going to insert into
Returns:
  list of bean definitions