mirror of
https://github.com/R0m1k3/FlowReader.git
synced 2026-10-19 05:08:31 +02:00
feat(story-1.4): add session-based authentication with login/logout
This commit is contained in:
1 parent
e186a4dd87
commit
d67e169a43
8 files changed
+446
-13
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// Session represents an active user session.
|
||||
type Session struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
Token string `json:"-"` // Never expose in JSON
|
||||
ExpiresAt time.Time `json:"expires_at"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UserAgent string `json:"user_agent,omitempty"`
|
||||
IPAddress string `json:"ip_address,omitempty"`
|
||||
}
|
||||
|
||||
// SessionRepository defines the interface for session data access.
|
||||
type SessionRepository interface {
|
||||
Create(session *Session) error
|
||||
GetByToken(token string) (*Session, error)
|
||||
Delete(token string) error
|
||||
DeleteByUserID(userID uuid.UUID) error
|
||||
DeleteExpired() (int64, error)
|
||||
}
|
||||
Reference in new issue
Block a user