feat(pat): regenerate a token's secret and reset its expiry

POST /api/user/tokens/<id>/regenerate swaps the secret of an existing token
in place: name, scopes and restrictions stay, the old secret stops matching
at once, and the expiry is reset. The lifetime defaults to the one the token
was last issued with (clamped to today's policy) or to expires_in_days when
given. An expired token can be renewed this way; a revoked one cannot. It is
session only like the rest of token management, and writes a pat_regenerated
audit event. regenerated_at records the rotation.
This commit is contained in:
arc53-machine committed 2026-09-21 10:32:17 +01:00
1 parent 3e38dc19ec
commit 91f2ec2f09
10 files changed
+275 -4

No files matched your search

+1
View File
@@ -91,6 +91,7 @@ class TestClassification:
("/api/user/tokens", "POST"),
("/api/user/tokens", "GET"),
("/api/user/tokens/<string:token_id>", "DELETE"),
("/api/user/tokens/<string:token_id>/regenerate", "POST"),
("/api/admin/users", "GET"),
("/api/admin/tokens/<string:token_id>", "DELETE"),
("/api/generate_token", "GET"),