Initial
This commit is contained in:
commit
97dc0a3570
78 files changed
+7054
No files matched your search
@@ -0,0 +1,21 @@
|
||||
package csrf
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func UpdateCsrf(w http.ResponseWriter, cookieName string, secure bool) (string, error) {
|
||||
cookieValue, err := generateToken(CsrfLength)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
http.SetCookie(w, &http.Cookie{
|
||||
Name: cookieName,
|
||||
Value: cookieValue,
|
||||
Path: "/",
|
||||
HttpOnly: false,
|
||||
Secure: secure,
|
||||
SameSite: http.SameSiteLaxMode,
|
||||
})
|
||||
return cookieValue, nil
|
||||
}
|
||||
Reference in new issue
Block a user