Feat/auth refresh rotation - #13
Open
Ruan-Moraes wants to merge 26 commits into
Open
Conversation
…rt e adapter Tabela refresh_tokens guarda só o SHA-256 hex do JWT, com family_id para rotação com detecção de reuso (OAuth BCP). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…Expiration Cada login/cadastro abre uma família nova de rotação; a expiração persistida vem do próprio JWT (sem duplicar config). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…a reuso Antes um access token válido renovava tokens; agora só JWT type=refresh presente e ativo na tabela. Reuso de token rotacionado revoga a família (sessão) inteira — mitigação de replay/roubo. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
POST /api/auth/logout revoga a família (sessão) no servidor. Refresh e logout aceitam cookie httpOnly (web, precedência) ou body (mobile). Cookie: HttpOnly + SameSite=Strict + Path=/api/auth + Secure via app.auth.cookie-secure (false em dev http, true em prod). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…efresh tokens Bucket próprio de 10/min por IP nos endpoints de credencial; job diário remove tokens expirados há mais de 1 dia (revogados recentes ficam para a janela de detecção de reuso). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…localStorage Access token só em memória; refresh via cookie httpOnly (withCredentials). 401 dispara um único POST /refresh (single-flight) e repete as requests; falha limpa a sessão e emite authExpired (pub/sub, padrão do mobile). Corrige AUTH_STORAGE_KEY duplicada no interceptor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ntexto signOut chama POST /api/auth/logout (revogação server-side); AuthProvider expõe isInitializing e assina authExpired (toast i18n 'sessão expirou'); AuthGuard/RoleGuard leem o contexto — nada de localStorage direto — e seguram render até a sessão resolver (sem flash de conteúdo protegido). Chave auth:sessionExpired em pt-BR/en-US/es-ES. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…racionais (DT-59) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.