diff options
| author | mo khan <mo@mokhan.ca> | 2025-05-28 18:31:00 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-05-28 18:31:00 -0600 |
| commit | cf1050dba0f0b0b26d18ce45ae2c8821153759bd (patch) | |
| tree | e3f67d0f2c47015d48f725cb9afb55282b5617c2 /pkg/web/cookie.go | |
| parent | 6951a69bff4d633b7fa8805e916c25b204373d9d (diff) | |
| parent | e5bc1eb2b71d46958088f1c62e69e1074e9f8026 (diff) | |
Merge branch '11/x-jwt-payload' into 'main'
Read trusted identity information from envoy headers
See merge request gitlab-org/software-supply-chain-security/authorization/sparkled!14
Diffstat (limited to 'pkg/web/cookie.go')
| -rw-r--r-- | pkg/web/cookie.go | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/pkg/web/cookie.go b/pkg/web/cookie.go deleted file mode 100644 index 11cc807..0000000 --- a/pkg/web/cookie.go +++ /dev/null @@ -1,35 +0,0 @@ -package web - -import ( - "net/http" - - "github.com/xlgmokha/x/pkg/cookie" - "github.com/xlgmokha/x/pkg/x" -) - -func NewCookie(name, value string, options ...x.Option[*http.Cookie]) *http.Cookie { - return x.New[*http.Cookie](x.Prepend[x.Option[*http.Cookie]]( - options, - cookie.WithName(name), - cookie.WithValue(value), - cookie.WithPath("/"), - cookie.WithHttpOnly(true), - cookie.WithSecure(true), - )...) -} - -func ExpireCookie(w http.ResponseWriter, name string) error { - return WriteCookie(w, cookie.Reset(name, - cookie.WithPath("/"), - cookie.WithHttpOnly(true), - cookie.WithSecure(true), - )) -} - -func WriteCookie(w http.ResponseWriter, c *http.Cookie) error { - if err := c.Valid(); err != nil { - return err - } - cookie.Write(w, c) - return nil -} |
