Package net.shibboleth.idp.attribute.filter

# Class AttributeFilterPolicy

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.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 final org.slf4j.Logger`
`log`
Class logger.
`private String`
`logPrefix`
Log prefix.
`private final PolicyRequirementRule`
`rule`
Criterion that must be met for this policy to be active for a given request.
`private final 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 the `PolicyRequirementRule`.

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

`ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, setId`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitialized`

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

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

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### rule

@Nonnull private final PolicyRequirementRule rule
Criterion that must be met for this policy to be active for a given request.

### valuePolicies

@Nonnull private final List<AttributeRule> valuePolicies
Filters to be used on attribute values.

### logPrefix

@Nullable private String logPrefix
Log prefix.

## Constructor Details

### AttributeFilterPolicy

public AttributeFilterPolicy(@Nonnull @NotEmpty @ParameterName(name="policyId") String policyId, @Nonnull @ParameterName(name="requirementRule") PolicyRequirementRule requirementRule, @Nullable @ParameterName(name="attributeRules") Collection<AttributeRule> attributeRules)
Constructor.

Parameters:
  `policyId` - unique ID of this policy
  `requirementRule` - criterion used to determine if this policy is active for a given request
  `attributeRules` - value filtering policies employed if this policy is active

## Method Details

### getPolicyRequirementRule

@Nonnull public PolicyRequirementRule 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

@Nonnull @Unmodifiable @NotLive public List<AttributeRule> 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

private boolean isApplicable(@Nonnull AttributeFilterContext filterContext)
Checks if the given filter context meets the requirements for this attribute filter policy as given by the `PolicyRequirementRule`.

Parameters:
  `filterContext` - current filter context
Returns:
  true if this policy should be active for the given request, false otherwise

### apply

public void apply(@Nonnull AttributeFilterContext filterContext) throws AttributeFilterException
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

protected void doInitialize() throws ComponentInitializationException

Overrides:
  `doInitialize` in class `AbstractIdentifiedInitializableComponent`
Throws:
  `ComponentInitializationException`

### getLogPrefix

public String getLogPrefix()
Get the prefix for logging.

Returns:
  Returns the logPrefix.