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
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 QNameElement name.static final QNameDenyValueRule.private static IdentifierGenerationStrategyGenerator of unique IDs.private static final org.slf4j.LoggerClass logger.static final StringNamespace The Top level filters.static final QNamePermitValueRule.static final QNameThe PolicyRequirementRule QName.static final StringThe attribute name for the qualified id.Fields inherited from class net.shibboleth.shared.spring.custom.AbstractCustomBeanDefinitionParser
CUSTOM_PARSER_PROPERTIES_LOCATIONFields inherited from class org.springframework.beans.factory.xml.AbstractBeanDefinitionParser
ID_ATTRIBUTE, NAME_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) protected StringgetAbsoluteReference(Element configElement, String componentNamespace, String reference) Gets the absolute reference given a possibly relative reference.protected StringgetQualifiedId(Element configElement, String componentNamespace, String localId) Generates an ID for a filter engine component.protected booleanisPolicyRule(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 StringresolveId(Element configElement, AbstractBeanDefinition beanDefinition, ParserContext parserContext) Methods inherited from class net.shibboleth.shared.spring.custom.AbstractCustomBeanDefinitionParser
getCustomProperty, registerBeanDefinitionMethods inherited from class org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser
doParse, getBeanClass, getBeanClassName, getParentName, parseInternalMethods 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
@Nonnull 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:
doParsein classAbstractSingleBeanDefinitionParser
-
resolveId
@Nonnull @NotEmpty protected String resolveId(@Nonnull Element configElement, @Nonnull AbstractBeanDefinition beanDefinition, @Nonnull ParserContext parserContext) - Overrides:
resolveIdin 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 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
-