-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
securecookies #31
Comments
There's a version2 here: https://github.com/gorilla/securecookie/tree/elithrar/v2 (see: gorilla/securecookie#43 (comment)) |
package main
import (
"fmt"
"net/http"
"time"
"github.com/komuw/ong/cookie"
"github.com/komuw/ong/enc"
)
func someHandler() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
key := "hard-passwd"
e := enc.New(key)
cookieName := "logID"
cookieVal := "slkPPjadm"
encryptedEncodedCookieVal := e.EncryptEncode(cookieVal)
cookie.Set(
w,
cookieName,
encryptedEncodedCookieVal,
"example.com",
15*time.Minute,
false,
)
fmt.Fprint(w, "hello")
}
} |
https://www.alexedwards.net/blog/working-with-cookies-in-go
|
Note, you should encrypt both the name and value together, and store the result as the cookie value.
|
What: - add secure/encrypted cookies Why: - Fixes: #31
The text was updated successfully, but these errors were encountered: