Filter procedures

Filter procedures can be used to filter items from collections. The type of the filter-procedure determines on what kind of items the filter can be applied on.

A filter procedure has the following structure:

Listing 210 Structure of filter procedure
1
2
3
4
function result(filterContext) {
  // use the context to get the item information and access to other useful facilities
  return true; // return true to keep the item, false to remove it
}

Important

The main function of a filter procedure must be called result.

Function

The result function takes one argument, which is the context of the filter.

The type of the context depends on the type of the filter-procedure (shown on the next sections).

result(filterContext)

The main function of a filter procedure

Arguments:
  • filterContext – The provider context to operate on.
Returns:

a boolean where true means keep the current item, false means exclude the current item.

Common API

Filter procedures have access to all of the Common Procedure API.

API

The following filter-procedure types are supported:

Examples of filter procedures can be found in the $INSTALL_DIR/examples/configs/filter-procedures directory.

Authenticator filter-procedure API

Filter procedures of type authenticator can be used in Service Providers and OAuth Client Configuration to filter authenticators.

Their context objects have type AuthenticatorFilterProcedureContext.

They can access information about the authenticator via the authenticator property of context.

Some of the authenticator object properties are listed below:

  • id: The ID of the authenticator.
  • default: whether this is the default authenticator.
  • acr: ACR of the authenticator.
  • description: A description of the authenticator.
  • url: The URL of the authenticator.
  • type: The type of the authenticator.