feat: add session management with device and geolocation tracking#16
Merged
lucas-adm merged 7 commits intoNoteHubBR:mainfrom Apr 24, 2026
Merged
feat: add session management with device and geolocation tracking#16lucas-adm merged 7 commits intoNoteHubBR:mainfrom
lucas-adm merged 7 commits intoNoteHubBR:mainfrom
Conversation
- Add device infos and geolocation fields to Token entity - Add findAllByUserId to TokenRepository - Add GeoIpService for user-agent parsing and IP geolocation - Add AuthSessionsREQ and SessionRES DTOs - Add getAllSessions (password-verified) and disconnect endpoints
…one and normalize unknown values
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.
Sumário
Implementação do gerenciamento de sessões da conta, permitindo que o usuário visualize todos os dispositivos conectados e desconecte sessões individualmente. Cada sessão é enriquecida com informações de dispositivo (via YAUAA) e geolocalização aproximada (via MaxMind GeoLite2).
Alterações
TokenGeoIpServicepara parse de User-Agent e geolocalização por IPgetClientIppara captura correta do IP real em produção via Fly.ioPOST /auth/sessions(listagem protegida por senha) eDELETE /auth/session/{id}AuthSessionsREQeSessionRESfindAllByUserIdnoTokenRepositorygetAllSessionsedisconnectnoTokenServiceV20260421__add_tokens_metadata.sql-Xms256m -Xmx768m)GeoLite2-City.mmdbem resourcesNecessidade
Usuários precisam de visibilidade e controle sobre as sessões ativas da conta, assim como plataformas como Google e GitHub oferecem. Isso melhora a segurança permitindo que o usuário identifique e encerre acessos não reconhecidos.
Teste manual
POST /auth/sessionscom a senha da contaDELETE /auth/session/{id}com um id retornado na listagemChecklist
Breaking Changes