feat(backend): implement auth service with JWT and session management
Login: bcrypt credential validation, session creation, JWT pair issuance. Logout/TerminateSession: soft-delete session (is_active = false). Refresh: token rotation — deactivate old session, issue new pair. ListSessions: marks IsCurrent by comparing session IDs. ParseAccessToken: for use by auth middleware. Claims carry uid (int16), adm (bool), sid (int). Refresh tokens are stored as SHA-256 hashes; raw tokens never reach the database. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,7 @@ require (
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.22.0 // indirect
|
||||
github.com/goccy/go-json v0.10.5 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
||||
github.com/jackc/puddle/v2 v2.2.1 // indirect
|
||||
|
||||
Reference in New Issue
Block a user