Set cookie attribute SameSite to strict mode

This commit is contained in:
Frédéric Guillot 2018-08-29 21:09:42 -07:00
parent 6137b401ee
commit 88e81d4d80
1 changed files with 2 additions and 0 deletions

View File

@ -27,6 +27,7 @@ func New(name, value string, isHTTPS bool, path string) *http.Cookie {
Secure: isHTTPS,
HttpOnly: true,
Expires: time.Now().Add(cookieDuration * 24 * time.Hour),
SameSite: http.SameSiteStrictMode,
}
}
@ -40,6 +41,7 @@ func Expired(name string, isHTTPS bool, path string) *http.Cookie {
HttpOnly: true,
MaxAge: -1,
Expires: time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC),
SameSite: http.SameSiteStrictMode,
}
}