blob: d80e4f910cd6b060c6db198a8aae8f2c6a90db45 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package session
import (
"time"
"net/http"
"github.com/alexedwards/scs/v2"
)
var Manager *scs.SessionManager
func Init() {
sm := scs.New()
// Security/behavior
sm.IdleTimeout = 20 * time.Minute // logout after inactivity
sm.Lifetime = 12 * time.Hour // absolute expiry
sm.Cookie.Name = "sid"
sm.Cookie.HttpOnly = true
sm.Cookie.SameSite = http.SameSiteLaxMode
sm.Cookie.Secure = true // set false only on localhost HTTP during dev
Manager = sm
}
|