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
- **Type:** JSON object mapping regex patterns to HTTP methods
125
-
- **Required:** No, defaults to the following:
126
-
```json
127
-
{
128
-
"^/search$": ["GET", "POST"],
129
-
"^/collections/([^/]+)/items$": ["GET", "POST"]
130
-
}
131
-
```
93
+
```
94
+
- **`PUBLIC_ENDPOINTS`**, endpoints explicitly marked as not requiring authentication, used when `DEFAULT_PUBLIC == False`
95
+
- **Type:** JSON object mapping regex patterns to HTTP methods
96
+
- **Required:** No, defaults to the following:
97
+
```json
98
+
{
99
+
"^/api.html$": ["GET"],
100
+
"^/api$": ["GET"]
101
+
}
102
+
```
103
+
- **`OPENAPI_SPEC_ENDPOINT`**, path of OpenAPI specification, used for augmenting spec response with auth configuration
104
+
- **Type:** string or null
105
+
- **Required:** No, defaults to `null` (disabled)
106
+
- **Example:** `/api`
107
+
- Filtering
108
+
- **`ITEMS_FILTER`**, [cql2 expression](https://developmentseed.org/cql2-rs/latest/python/#cql2.Expr) generator for item-level filtering
109
+
- **Type:** JSON object with class configuration
110
+
- **Required:** No, defaults to `null` (disabled)
111
+
- **Components**:
112
+
- `cls`: Python import path
113
+
- `args`: List of positional arguments
114
+
- `kwargs`: Dictionary of keyword arguments
115
+
- **Example:**
116
+
```json
117
+
{
118
+
"cls": "my_package.filters.OrganizationFilter",
119
+
"args": ["org1"],
120
+
"kwargs": {
121
+
"field_name": "properties.organization"
122
+
}
123
+
}
124
+
```
132
125
133
126
### Customization
134
127
@@ -140,31 +133,31 @@ While the project is designed to work out-of-the-box as an application, it might
140
133
141
134
The majority of the proxy's functionality occurs within a chain of middlewares. Each request passes through this chain, wherein each middleware performs a specific task:
142
135
143
-
1. **EnforceAuthMiddleware**
136
+
1. **`EnforceAuthMiddleware`**
144
137
145
138
- Handles authentication and authorization
146
139
- Configurable public/private endpoints
147
140
- OIDC integration
148
141
- Places auth token payload in request state
149
142
150
-
2. **BuildCql2FilterMiddleware**
143
+
2. **`BuildCql2FilterMiddleware`**
151
144
152
145
- Builds CQL2 filters based on request context/state
153
146
- Places [CQL2 expression](http://developmentseed.org/cql2-rs/latest/python/#cql2.Expr) in request state
154
147
155
-
3. **ApplyCql2FilterMiddleware**
148
+
3. **`ApplyCql2FilterMiddleware`**
156
149
157
150
- Retrieves [CQL2 expression](http://developmentseed.org/cql2-rs/latest/python/#cql2.Expr) from request state
158
151
- Augments request with CQL2 filter:
159
152
- Modifies query strings for `GET` requests
160
153
- Modifies JSON bodies for `POST`/`PUT`/`PATCH` requests
161
154
162
-
4. **OpenApiMiddleware**
155
+
4. **`OpenApiMiddleware`**
163
156
164
157
- Modifies OpenAPI specification based on endpoint configuration, adding security requirements
165
158
- Only active if `openapi_spec_endpoint` is configured
166
159
167
-
5. **AddProcessTimeHeaderMiddleware**
160
+
5. **`AddProcessTimeHeaderMiddleware`**
168
161
- Adds processing time headers
169
162
- Useful for monitoring/debugging
170
163
@@ -178,31 +171,79 @@ The system supports generating CQL2 filters based on request context to provide
178
171
> [!TIP]
179
172
> 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.
180
173
174
+
#### Filters
175
+
176
+
If enabled, filters are intended to be applied to the following endpoints:
177
+
178
+
- `GET /search`
179
+
- **Supported:** ✅
180
+
- **Action:** Read Item
181
+
- **Applied Filter:** `ITEMS_FILTER`
182
+
- **Strategy:** Append query params with generated CQL2 query.
183
+
- `POST /search`
184
+
- **Supported:** ✅
185
+
- **Action:** Read Item
186
+
- **Applied Filter:** `ITEMS_FILTER`
187
+
- **Strategy:** Append body with generated CQL2 query.
| ❌ ([#22](https://github.com/developmentseed/stac-auth-proxy/issues/22)) |`PUT`|`/collections/{collection_id}}`| Update | Collection | Fetch Collection and validate CQL2 query; merge Item with body and validate with generated CQL2 query. |
202
-
| ❌ ([#22](https://github.com/developmentseed/stac-auth-proxy/issues/22)) |`DELETE`|`/collections/{collection_id}`| Delete | Collection | Fetch Collectiion and validate with CQL2 query. |
| ❌ ([#21](https://github.com/developmentseed/stac-auth-proxy/issues/21)) |`POST`|`/collections/{collection_id}/items`| Create | Item | Validate body with generated CQL2 query. |
206
-
| ❌ ([#21](https://github.com/developmentseed/stac-auth-proxy/issues/21)) |`PUT`|`/collections/{collection_id}/items/{item_id}`| Update | Item | Fetch Item and validate CQL2 query; merge Item with body and validate with generated CQL2 query. |
207
-
| ❌ ([#21](https://github.com/developmentseed/stac-auth-proxy/issues/21)) |`DELETE`|`/collections/{collection_id}/items/{item_id}`| Delete | Item | Fetch Item and validate with CQL2 query. |
208
-
| ❌ ([#21](https://github.com/developmentseed/stac-auth-proxy/issues/21)) |`POST`|`/collections/{collection_id}/bulk_items`| Create | Item | Validate items in body with generated CQL2 query. |
0 commit comments