Package net.shibboleth.idp.attribute.filter

# Class AttributeRule

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.attribute.filter.AttributeRule

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`, `UnmodifiableComponent`

@ThreadSafe public final class AttributeRule extends AbstractIdentifiableInitializableComponent implements UnmodifiableComponent
Represents a value filtering rule for a particular attribute.

## Field Summary

Fields
Modifier and Type
Field
Description
`private String`
`attributeId`
Unique ID of the attribute this rule applies to.
`private boolean`
`isDenyRule`
Filter that denies the release of attribute values.
`private final org.slf4j.Logger`
`log`
Class logger.
`private String`
`logPrefix`
Log prefix.
`private Matcher`
`matcher`
Filter that permits the release of attribute values.

## Constructor Summary

Constructors
Constructor
Description
`AttributeRule()`

## Method Summary

Modifier and Type
Method
Description
`void`
`apply(IdPAttribute attribute, AttributeFilterContext filterContext)`
Applies this rule to the respective attribute in the filter context.
`protected void`
`doInitialize()`
`String`
`getAttributeId()`
Gets the ID of the attribute to which this rule applies.
`boolean`
`getIsDenyRule()`
Gets whether the rule is a deny rule or not.
`protected String`
`getLogPrefix()`
Get the prefix for logging.
`Matcher`
`getMatcher()`
Gets the matcher used to determine the attribute values filtered by this rule.
`void`
`setAttributeId(String id)`
Sets the ID of the attribute to which this rule applies.
`void`
`setIsDenyRule(boolean isDeny)`
Sets the rule used to determine denied attribute values filtered by this rule.
`void`
`setMatcher(Matcher theMatcher)`
Sets the rule used to determine permitted attribute values filtered by this rule.

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

`setId`

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

`ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException`

### 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`

### Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent

`getId`

## Field Details

### log

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

### logPrefix

@Nullable private String logPrefix
Log prefix.

### attributeId

@NonnullAfterInit private String attributeId
Unique ID of the attribute this rule applies to.

### matcher

@NonnullAfterInit private Matcher matcher
Filter that permits the release of attribute values.

### isDenyRule

private boolean isDenyRule
Filter that denies the release of attribute values.

## Constructor Details

### AttributeRule

public AttributeRule()

## Method Details

### getAttributeId

@NonnullAfterInit public String getAttributeId()
Gets the ID of the attribute to which this rule applies.

Returns:
  ID of the attribute to which this rule applies

### setAttributeId

public void setAttributeId(@Nonnull @NotEmpty String id)
Sets the ID of the attribute to which this rule applies. This property may not be changed after this component has been initialized.

Parameters:
  `id` - ID of the attribute to which this rule applies

### getMatcher

@Nullable public Matcher getMatcher()
Gets the matcher used to determine the attribute values filtered by this rule.

Returns:
  matcher used to determine the attribute values filtered by this rule

### setMatcher

public void setMatcher(@Nonnull Matcher theMatcher)
Sets the rule used to determine permitted attribute values filtered by this rule.

Parameters:
  `theMatcher` - matcher used to determine permitted attribute values filtered by this rule

### getIsDenyRule

public boolean getIsDenyRule()
Gets whether the rule is a deny rule or not.

Returns:
  whether the rule is a deny rule or not.

### setIsDenyRule

public void setIsDenyRule(boolean isDeny)
Sets the rule used to determine denied attribute values filtered by this rule.

Parameters:
  `isDeny` - - whether the rule is deny or not.

### apply

public void apply(@Nonnull IdPAttribute attribute, @Nonnull AttributeFilterContext filterContext) throws AttributeFilterException
Applies this rule to the respective attribute in the filter context.

Parameters:
  `attribute` - attribute whose values will be filtered by this policy
  `filterContext` - current filter context
Throws:
  `AttributeFilterException` - if an error occurs while applying the rule

### doInitialize

protected void doInitialize() throws ComponentInitializationException

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

### getLogPrefix

@Nonnull @NotEmpty protected String getLogPrefix()
Get the prefix for logging.

Returns:
  Returns the logPrefix.