Отзыв JWT при выходе и смене пароля

logout отзывает предъявленный токен по jti (in-memory denylist до exp);
смена и сброс пароля инкрементят users.token_version (claim ver в JWT,
сверка в auth/deps) — все прежние сессии отзываются. Своё устройство при
смене пароля остаётся в сессии (перевыдача cookie). Миграция 0013. #57

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XfTsytzT6TojfmprRDKiV6
This commit is contained in:
2026-09-13 17:09:57 +03:00
co-authored by Claude Opus 4.8
parent d84cef2491
commit 3f8667b561
12 changed files with 236 additions and 12 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ def establish_session(
"""Открыть сессию уже найденному/созданному пользователю (cookie + аудит)."""
if not user.is_active:
raise ForbiddenError("Аккаунт отключён администратором.", code="ACCOUNT_DISABLED")
security.set_user_session(response, user.id, provider) # type: ignore[arg-type]
security.set_user_session(response, user.id, provider, user.token_version) # type: ignore[arg-type]
audit_service.record(
session,
actor_id=user.id,