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
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
FieldsModifier and TypeFieldDescriptionstatic final QName
Element name.static final QName
DenyValueRule.private static IdentifierGenerationStrategy
Generator of unique IDs.private static final org.slf4j.Logger
Class logger.static final String
Namespace The Top level filters.static final QName
PermitValueRule.static final QName
The PolicyRequirementRule QName.static final String
The attribute name for the qualified id.Fields inherited from class org.springframework.beans.factory.xml.AbstractBeanDefinitionParser
ID_ATTRIBUTE, NAME_ATTRIBUTE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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:
-
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:
-
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
-