---
title: ConditionEnforcementFilter
description: Verifies that a specified condition is met. If the condition is met, the request continues to be executed. Otherwise, the request is referred to a failure handler, or PingGateway returns 403 Forbidden and the request is stopped.
component: pinggateway
version: 2026
page_id: pinggateway:reference:ConditionEnforcementFilter
canonical_url: https://docs.pingidentity.com/pinggateway/2026/reference/ConditionEnforcementFilter.html
revdate: 2025-08-26T18:26:39Z
section_ids:
  ConditionEnforcementFilter-usage: Usage
  ConditionEnforcementFilter-properties: Properties
  ConditionEnforcementFilter-example: Example
  ConditionEnforcementFilter-moreinfo: More information
---

# ConditionEnforcementFilter

Verifies that a specified condition is met. If the condition is met, the request continues to be executed. Otherwise, the request is referred to a failure handler, or PingGateway returns 403 Forbidden and the request is stopped.

## Usage

```none
{
    "name": string,
    "type": "ConditionEnforcementFilter",
    "config": {
        "condition": runtime condition<boolean>,
        "failureHandler": Handler reference
    }
}
```

## Properties

* `"condition"`: *runtime condition<[boolean](preface.html#definition-boolean)>, required*

  A [condition](Conditions.html). If the condition's expression evaluates to `true`, PingGateway continues to execute the request.

* `"failureHandler"`: *Handler [reference](preface.html#definition-reference), optional*

  Handler to treat the request if the condition expression evaluates as `false`.

  Provide an inline handler configuration object or the name of a handler object declared in the heap. See also [PingGateway handlers](Handlers.html).

  Default: HTTP 403 Forbidden, the request stops being executed.

## Example

The following example tests whether a request contains a session username. If it does, the request continues to be executed. Otherwise, the request is dispatched to the `ConditionFailedHandler` failure handler.

```json
{
    "name": "UsernameEnforcementFilter",
    "type": "ConditionEnforcementFilter",
    "config": {
        "condition": "${not empty (session.username)}",
        "failureHandler": "ConditionFailedHandler"
    }
}
```

## More information

[org.forgerock.openig.filter.ConditionEnforcementFilter](../_attachments/apidocs/org/forgerock/openig/filter/ConditionEnforcementFilter.html)
