wip: session auth middleware

This commit is contained in:
2025-06-05 06:26:11 +01:00
parent af8323cdb0
commit 627633ea29
10 changed files with 96 additions and 29 deletions
+12
View File
@@ -3,6 +3,9 @@ package lib
import (
"os"
"path/filepath"
"github.com/gorilla/sessions"
"github.com/hazemKrimi/crimson-vault/internal/types"
)
func GetConfigDirectory() (string, error) {
@@ -16,3 +19,12 @@ func GetConfigDirectory() (string, error) {
return config, nil
}
func ConstructSession(session *sessions.Session, user types.User) {
session.Options = &sessions.Options{
Path: "/",
MaxAge: 86400 * 7,
HttpOnly: true,
}
session.Values["id"] = user.ID
}