Class AttributeFilterImpl
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.attribute.filter.impl.AttributeFilterImpl
- All Implemented Interfaces:
AttributeFilter,Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent
@ThreadSafe
public class AttributeFilterImpl
extends AbstractIdentifiableInitializableComponent
implements AttributeFilter
Service that filters out attributes and values based upon loaded policies.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<AttributeFilterPolicy>Filter policies used by this engine.private final org.slf4j.LoggerClass logger.private StringLog prefix.private Function<AttributeFilterContext,MetricContext> Strategy to get theMetricContextfor timing. -
Constructor Summary
ConstructorsConstructorDescriptionAttributeFilterImpl(String engineId, Collection<AttributeFilterPolicy> policies) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoidfilterAttributes(AttributeFilterContext filterContext) Filters attributes and values.protected Collection<IdPAttributeValue>getFilteredValues(String attributeId, AttributeFilterContext filterContext) Gets the permitted values for the given attribute from theAttributeFilterWorkContext.getPermittedIdPAttributeValues()and removes all denied values given in theAttributeFilterWorkContext.getDeniedAttributeValues().Gets the immutable collection of filter policies.protected StringGet the prefix for logging.private booleanstartTimer(AttributeFilterContext filterContext) Conditionally start a timer at the beginning of the filtering process.private voidstopTimer(AttributeFilterContext filterContext) Conditionally stop a timer at the end of the filtering process.Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getId
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
filterPolicies
Filter policies used by this engine. -
logPrefix
Log prefix. -
metricContextLookupStrategy
Strategy to get theMetricContextfor timing.
-
-
Constructor Details
-
AttributeFilterImpl
public AttributeFilterImpl(@Nonnull @NotEmpty String engineId, @Nullable Collection<AttributeFilterPolicy> policies) Constructor.- Parameters:
engineId- ID of this enginepolicies- filter policies used by this engine
-
-
Method Details
-
getFilterPolicies
Gets the immutable collection of filter policies.- Specified by:
getFilterPoliciesin interfaceAttributeFilter- Returns:
- immutable collection of filter policies
-
filterAttributes
public void filterAttributes(@Nonnull AttributeFilterContext filterContext) throws AttributeFilterException Filters attributes and values. This filtering process may remove attributes and values but must never add them.- Specified by:
filterAttributesin interfaceAttributeFilter- Parameters:
filterContext- context containing the attributes to be filtered and collecting the results of the filtering process- Throws:
AttributeFilterException- thrown if there is a problem retrieving or applying the attribute filter policy
-
getFilteredValues
@Nullable protected Collection<IdPAttributeValue> getFilteredValues(@Nonnull @NotEmpty String attributeId, @Nonnull AttributeFilterContext filterContext) Gets the permitted values for the given attribute from theAttributeFilterWorkContext.getPermittedIdPAttributeValues()and removes all denied values given in theAttributeFilterWorkContext.getDeniedAttributeValues().- Parameters:
attributeId- ID of the attribute whose values are to be retrievedfilterContext- current attribute filter context- Returns:
- null if no values were permitted to be released, an empty collection if values were permitted but then all were removed by deny policies, a collection containing permitted values
-
doInitialize
- Overrides:
doInitializein classAbstractIdentifiedInitializableComponent- Throws:
ComponentInitializationException
-
getLogPrefix
Get the prefix for logging.- Returns:
- Returns the logPrefix.
-
startTimer
Conditionally start a timer at the beginning of the filtering process.- Parameters:
filterContext- attribute filtering context- Returns:
- true iff the
stopTimer(AttributeFilterContext)method needs to be called
-
stopTimer
Conditionally stop a timer at the end of the filtering process.- Parameters:
filterContext- attribute filtering context
-