strapi-plugin-oidc 1.6.6 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -79,7 +79,7 @@ Manage the plugin under **Settings → OIDC Plugin**.
79
79
  - Bulk delete with confirmation
80
80
  - Unsaved changes are held in the UI until **Save Changes** is clicked
81
81
 
82
- **Audit Logs** — Every authentication event is recorded in the plugin's audit log table and visible in the **Audit Logs** section at the bottom of the settings page. A **Download** button exports all records as NDJSON (newline-delimited JSON), compatible with SIEM tools and log processors. Setting `AUDIT_LOG_RETENTION_DAYS` to `0` disables audit logging entirely. Otherwise records older than the configured value (default: 90 days) are automatically purged by a daily cron job. The audit log is also accessible [via API](#audit-log-api).
82
+ **Audit Logs** — Every authentication event is recorded in the plugin's audit log table and visible in the **Audit Logs** section at the bottom of the settings page. Entries can be filtered by action, email, IP address, and date, and a **Download** button exports the current (filtered) view as NDJSON (newline-delimited JSON), compatible with SIEM tools and log processors. Setting `AUDIT_LOG_RETENTION_DAYS` to `0` disables audit logging entirely. Otherwise records older than the configured value (default: 90 days) are automatically purged by a daily cron job. The audit log is also accessible [via API](#audit-log-api).
83
83
 
84
84
  **Enforce OIDC Login** — Removes the standard email/password fields from the login page and blocks direct login API calls server-side. Automatically disabled when the whitelist is empty to prevent lockout.
85
85
 
@@ -187,17 +187,19 @@ curl -X DELETE -H "Authorization: Bearer <token>" \
187
187
 
188
188
  Audit log entries can be fetched programmatically using a Strapi **API token** (Settings → API Tokens → Full Access). Endpoints are under `/api/strapi-plugin-oidc` and require `Authorization: Bearer <token>`.
189
189
 
190
- | Method | Path | Description |
191
- | ------ | ------------------------------------------- | ------------------------------ |
192
- | `GET` | `/api/strapi-plugin-oidc/audit-logs` | Paginated list of log entries |
193
- | `GET` | `/api/strapi-plugin-oidc/audit-logs/export` | All records as NDJSON download |
190
+ | Method | Path | Description |
191
+ | -------- | ------------------------------------------- | ----------------------------------- |
192
+ | `GET` | `/api/strapi-plugin-oidc/audit-logs` | Paginated list of log entries |
193
+ | `GET` | `/api/strapi-plugin-oidc/audit-logs/export` | Matching records as NDJSON download |
194
+ | `DELETE` | `/api/strapi-plugin-oidc/audit-logs` | Delete all audit log entries (204) |
194
195
 
195
- ### Query parameters (`GET /audit-logs`)
196
+ ### Query parameters (`GET /audit-logs`, `GET /audit-logs/export`)
196
197
 
197
- | Parameter | Default | Description |
198
- | ---------- | ------- | ---------------- |
199
- | `page` | `1` | Page number |
200
- | `pageSize` | `25` | Results per page |
198
+ | Parameter | Default | Description |
199
+ | ---------- | ------- | ---------------------------------------------- |
200
+ | `page` | `1` | Page number (list endpoint only) |
201
+ | `pageSize` | `25` | Results per page, max `100` (list only) |
202
+ | `filters` | — | Field/operator filters, same on both endpoints |
201
203
 
202
204
  Results are sorted newest-first. The response shape is:
203
205
 
@@ -205,23 +207,51 @@ Results are sorted newest-first. The response shape is:
205
207
  {
206
208
  "results": [
207
209
  {
208
- "datetime": "2026-04-08T12:00:00.000Z",
210
+ "id": 42,
209
211
  "action": "login_success",
210
212
  "email": "alice@example.com",
211
- "ip": "203.0.113.42"
213
+ "ip": "203.0.113.42",
214
+ "details": null,
215
+ "createdAt": "2026-04-08T12:00:00.000Z",
216
+ "updatedAt": "2026-04-08T12:00:00.000Z"
212
217
  }
213
218
  ],
214
219
  "pagination": { "page": 1, "pageSize": 25, "total": 1, "pageCount": 1 }
215
220
  }
216
221
  ```
217
222
 
223
+ The NDJSON export emits one row per line with `{ datetime, action, email, ip, details }` where `datetime` is the entry's `createdAt` timestamp.
224
+
225
+ ### Filtering
226
+
227
+ Use `filters[<field>][<operator>]=<value>` to narrow results. Invalid filters return a `400`.
228
+
229
+ | Field | Operators | Value |
230
+ | ----------- | ---------------------------------------------------- | ------------------------------------------------------- |
231
+ | `action` | `$eq`, `$in` | One of the [recorded actions](#recorded-actions) |
232
+ | `email` | `$eq`, `$contains`, `$endsWith`, `$null`, `$notNull` | String (use `true`/`false` with `$null` / `$notNull`) |
233
+ | `ip` | `$eq`, `$contains`, `$endsWith`, `$null`, `$notNull` | String (use `true`/`false` with `$null` / `$notNull`) |
234
+ | `createdAt` | `$gte`, `$lt`, `$lte`, `$between`, `$in` | ISO-8601 UTC timestamp, e.g. `2026-04-08T00:00:00.000Z` |
235
+
236
+ `$between` takes a `[start, end]` pair. `$in` on `createdAt` takes a list of day-start timestamps and matches anything within that UTC day.
237
+
238
+ ```bash
239
+ # Failed logins on one day
240
+ curl -H "Authorization: Bearer <token>" -G \
241
+ --data-urlencode 'filters[action][$eq]=login_failure' \
242
+ --data-urlencode 'filters[createdAt][$gte]=2026-04-08T00:00:00.000Z' \
243
+ --data-urlencode 'filters[createdAt][$lt]=2026-04-09T00:00:00.000Z' \
244
+ http://localhost:1337/api/strapi-plugin-oidc/audit-logs
245
+ ```
246
+
218
247
  ### Recorded actions
219
248
 
220
249
  | Action | Trigger |
221
250
  | ----------------------- | --------------------------------------------------- |
222
251
  | `login_success` | Successful OIDC authentication |
223
252
  | `user_created` | New Strapi admin user created during login |
224
- | `login_failure` | Generic authentication error (missing code, etc.) |
253
+ | `login_failure` | Unexpected error during the OIDC login flow |
254
+ | `missing_code` | Callback received without an authorisation code |
225
255
  | `state_mismatch` | CSRF state cookie does not match callback parameter |
226
256
  | `nonce_mismatch` | ID token nonce does not match the session nonce |
227
257
  | `token_exchange_failed` | Provider returned an error during token exchange |