Take Pireon's webhooks: a deactivation or a revocation counts at once
Some checks failed
Tests / lint (push) Has been cancelled
Tests / test (push) Has been cancelled
Tests / test-postgres (push) Has been cancelled
Tests / mcp (push) Has been cancelled

Until now, an account switched off or a token revoked at the identity
server kept working here: bearer tokens until the introspection cache
ran out, panel sessions until they ended, and machine tokens for good,
as they only look at the local account.

POST /api/v1/webhooks/pireon takes user.deactivated (the account goes
inactive, which stops its machine tokens and the panel; its sessions
end and its cached tokens are forgotten) and token.revoked (sessions
and cached tokens go). Pireon signs each delivery with the secret of
the client that registered the webhook, so either PIREON_WEBHOOK_SECRET
(password client) or PIREON_REDIRECT_WEBHOOK_SECRET («Entrar con
Pireon») verifies it; with neither, the endpoint refuses everything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-16 17:01:57 +02:00
parent ec4f687ca8
commit d10ce1ca57
9 changed files with 361 additions and 0 deletions

View File

@@ -95,6 +95,25 @@ return [
'introspection_ttl' => (int) env('PIREON_INTROSPECTION_TTL', 60),
/*
|--------------------------------------------------------------------------
| Webhooks (POST /api/v1/webhooks/pireon)
|--------------------------------------------------------------------------
|
| `user.deactivated` and `token.revoked` take effect at once instead of
| when the cache above runs out. Pireon signs each delivery with the secret
| of the client that registered the webhook, and only the client that
| issued a token tells when it is revoked: register the webhook on both
| clients (password and redirect) and put each secret here. With none, the
| endpoint refuses everything.
|
*/
'webhook_secrets' => array_values(array_filter([
env('PIREON_WEBHOOK_SECRET'),
env('PIREON_REDIRECT_WEBHOOK_SECRET'),
])),
'http_timeout' => (int) env('PIREON_HTTP_TIMEOUT', 10),
/*