aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/db/models.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-15 11:12:50 +0900
committernsfisis <nsfisis@gmail.com>2026-02-15 11:14:28 +0900
commit96fad1a4e78c7209e5a0f3496e8b59d591fbe500 (patch)
tree8e43fb3918cd7401fe68cac933fe943c794b7634 /backend/db/models.go
parent2f1a8a1c599300d0964d7fbbfd824e2d74f0bf4a (diff)
downloadphperkaigi-2026-albatross-96fad1a4e78c7209e5a0f3496e8b59d591fbe500.tar.gz
phperkaigi-2026-albatross-96fad1a4e78c7209e5a0f3496e8b59d591fbe500.tar.zst
phperkaigi-2026-albatross-96fad1a4e78c7209e5a0f3496e8b59d591fbe500.zip
refactor(auth): replace JWT authentication with server-side sessions
Migrate from stateless JWT tokens to server-side session management backed by PostgreSQL. Sessions are hashed with SHA-256 before storage, cleaned up periodically, and invalidated on logout. This removes the need for JWT_SECRET/COOKIE_SECRET environment variables and the golang-jwt dependency. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'backend/db/models.go')
-rw-r--r--backend/db/models.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/backend/db/models.go b/backend/db/models.go
index c6ef25f..c4a713d 100644
--- a/backend/db/models.go
+++ b/backend/db/models.go
@@ -40,6 +40,13 @@ type Problem struct {
SampleCode string
}
+type Session struct {
+ SessionID string
+ UserID int32
+ ExpiresAt pgtype.Timestamp
+ CreatedAt pgtype.Timestamp
+}
+
type Submission struct {
SubmissionID int32
GameID int32