feat(pat): add personal access token storage and settings

A personal_access_tokens table (migration 0032) holds scoped user-level API
credentials. Only the SHA-256 of the secret is stored, like device session
tokens. Lookups exclude revoked and expired tokens and the tokens of
deactivated users. PAT_* settings cover the feature switch, default and
maximum lifetime, the operator opt-in for non-expiring tokens and the
per-user cap.
This commit is contained in:
arc53-machine committed 2026-09-19 23:39:58 +01:00
1 parent 0952a05aab
commit 22ecc0aee3
7 files changed
+494

No files matched your search

@@ -132,6 +132,36 @@ Type `str`, default unset.
Bearer token for IdP SCIM clients (required when SCIM is enabled).
### `PAT_ENABLED`
Type `bool`, default `true`.
Allow users to create personal access tokens. Tokens are only issued under AUTH_TYPE=oidc or unset (None); simple_jwt and session_jwt have no stable user identity to bind a token to.
### `PAT_DEFAULT_LIFETIME_DAYS`
Type `int`, default `90`, must be `> 0`.
Lifetime of a personal access token created without an explicit expiry.
### `PAT_MAX_LIFETIME_DAYS`
Type `int`, default `365`, must be `> 0`.
Longest lifetime a user may request for a personal access token.
### `PAT_ALLOW_NON_EXPIRING`
Type `bool`, default `false`.
Let users create personal access tokens that never expire. Off by default.
### `PAT_MAX_PER_USER`
Type `int`, default `25`, must be `> 0`.
Maximum number of live personal access tokens per user.
## LLM providers