You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+93-3Lines changed: 93 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -178,9 +178,6 @@ The system supports generating CQL2 filters based on request context to provide
178
178
> [!IMPORTANT]
179
179
> The upstream STAC API must support the [STAC API Filter Extension](https://github.com/stac-api-extensions/filter/blob/main/README.md), including the [Features Filter](http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/features-filter) conformance class on to the Features resource (`/collections/{cid}/items`)[^37].
180
180
181
-
> [!TIP]
182
-
> Integration with external authorization systems (e.g. [Open Policy Agent](https://www.openpolicyagent.org/)) can be achieved by specifying an `ITEMS_FILTER` that points to a class/function that, once initialized, returns a [`cql2.Expr` object](https://developmentseed.org/cql2-rs/latest/python/#cql2.Expr) when called with the request context.
183
-
184
181
#### Filters
185
182
186
183
If enabled, filters are intended to be applied to the following endpoints:
@@ -263,6 +260,99 @@ sequenceDiagram
263
260
STAC API->>Client: Response
264
261
```
265
262
263
+
#### Authoring Filter Generators
264
+
265
+
The `ITEMS_FILTER_CLS` configuration option can be used to specify a class that will be used to generate a CQL2 filter for the request. The class must define a `__call__` method that accepts a single argument: a dictionary containing the request context; and returns a valid `cql2-text` expression (as a `str`) or `cql2-json` expression (as a `dict`).
266
+
267
+
> [!TIP]
268
+
> An example of an Open Policy Agent (OPA) integration is available in the [examples/opa](examples/opa) directory, runnable with `docker compose -f docker-compose.yaml -f examples/opa/docker-compose.yaml up`.
0 commit comments