blob: 37b6dd7b1b11ae6fdd2c6ac1bf2df87a9782f319 (
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 = false // set false only on localhost HTTP during dev
Manager = sm
}
|