mirror of
https://github.com/hazemKrimi/crimson-vault.git
synced 2026-05-01 18:20:27 +00:00
wip: session auth middleware
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user