package modweb import "github.com/gofiber/fiber/v2/middleware/session" type AuthHandler interface { Module LoginURL() string RegisterURL() string } type User struct { ID string DisplayName string AccessLevel int64 } func (u User) Save(sess *session.Session) { sess.Set("user:id", u.ID) sess.Set("user:displayName", u.DisplayName) sess.Set("user:accessLevel", u.AccessLevel) } func (u *User) Load(sess *session.Session) { u.ID = sess.Get("user:id").(string) u.DisplayName = sess.Get("user:displayName").(string) u.AccessLevel = sess.Get("user:accessLevel").(int64) }