github.com/lunarobliq/gophish@v0.8.1-0.20230523153303-93511002234d/middleware/session.go (about) 1 package middleware 2 3 import ( 4 "encoding/gob" 5 6 "github.com/gophish/gophish/models" 7 "github.com/gorilla/securecookie" 8 "github.com/gorilla/sessions" 9 ) 10 11 // init registers the necessary models to be saved in the session later 12 func init() { 13 gob.Register(&models.User{}) 14 gob.Register(&models.Flash{}) 15 Store.Options.HttpOnly = true 16 // This sets the maxAge to 5 days for all cookies 17 Store.MaxAge(86400 * 5) 18 } 19 20 // Store contains the session information for the request 21 var Store = sessions.NewCookieStore( 22 []byte(securecookie.GenerateRandomKey(64)), //Signing key 23 []byte(securecookie.GenerateRandomKey(32)))