Class AttributeFilterPolicy
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
net.shibboleth.idp.attribute.filter.AttributeFilterPolicy
- All Implemented Interfaces:
Component
,DestructableComponent
,IdentifiedComponent
,InitializableComponent
,UnmodifiableComponent
@ThreadSafe public final class AttributeFilterPolicy extends AbstractIdentifiedInitializableComponent implements UnmodifiableComponent
A policy describing if a set of attribute value filters is applicable.
Note, this filter policy operates on the
AttributeFilterContext.getFilteredIdPAttributes()
attribute set. The
idea being that as policies run they will retain or remove attributes and values for this collection. After all
policies run this collection will contain the final result.-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.Logger
log
Class logger.private String
logPrefix
Log prefix.private PolicyRequirementRule
rule
Criterion that must be met for this policy to be active for a given request.private List<AttributeRule>
valuePolicies
Filters to be used on attribute values. -
Constructor Summary
Constructors Constructor Description AttributeFilterPolicy(String policyId, PolicyRequirementRule requirementRule, Collection<AttributeRule> attributeRules)
Constructor. -
Method Summary
Modifier and Type Method Description void
apply(AttributeFilterContext filterContext)
Applies this filter policy to the given filter context if it is applicable.protected void
doInitialize()
List<AttributeRule>
getAttributeRules()
Gets the unmodifiable attribute rules that are in effect if this policy is in effect.String
getLogPrefix()
Get the prefix for logging.PolicyRequirementRule
getPolicyRequirementRule()
Gets the MatchFunctor that must be met for this policy to be active for a given request.private boolean
isApplicable(AttributeFilterContext filterContext)
Checks if the given filter context meets the requirements for this attribute filter policy as given by thePolicyRequirementRule
.Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
getId, setId
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
-
Field Details
-
log
private final org.slf4j.Logger logClass logger. -
rule
Criterion that must be met for this policy to be active for a given request. -
valuePolicies
Filters to be used on attribute values. -
logPrefix
Log prefix.
-
-
Constructor Details
-
AttributeFilterPolicy
public AttributeFilterPolicy(@Nonnull @NotEmpty @ParameterName(name="policyId") String policyId, @Nonnull @ParameterName(name="requirementRule") PolicyRequirementRule requirementRule, @Nullable @NonnullElements @ParameterName(name="attributeRules") Collection<AttributeRule> attributeRules)Constructor.- Parameters:
policyId
- unique ID of this policyrequirementRule
- criterion used to determine if this policy is active for a given requestattributeRules
- value filtering policies employed if this policy is active
-
-
Method Details
-
getPolicyRequirementRule
Gets the MatchFunctor that must be met for this policy to be active for a given request.- Returns:
- MatchFunctor that must be met for this policy to be active for a given request
-
getAttributeRules
Gets the unmodifiable attribute rules that are in effect if this policy is in effect.- Returns:
- attribute rules that are in effect if this policy is in effect
-
isApplicable
Checks if the given filter context meets the requirements for this attribute filter policy as given by thePolicyRequirementRule
.- Parameters:
filterContext
- current filter context- Returns:
- true if this policy should be active for the given request, false otherwise
-
apply
Applies this filter policy to the given filter context if it is applicable.- Parameters:
filterContext
- current filter context- Throws:
AttributeFilterException
- thrown if there is a problem filtering out the attributes and values for this request
-
doInitialize
- Overrides:
doInitialize
in classAbstractIdentifiedInitializableComponent
- Throws:
ComponentInitializationException
-
getLogPrefix
Get the prefix for logging.- Returns:
- Returns the logPrefix.
-