diff --git a/cookies.go b/cookies.go index 95c93ec..cad401e 100644 --- a/cookies.go +++ b/cookies.go @@ -96,6 +96,8 @@ type CookieOptions struct { HTTPOnly bool Secure bool MaxAge time.Duration + Expires time.Time + SameSite http.SameSite } // Set a cookie with the data set to the encrypted version of the serialization of v. @@ -114,6 +116,8 @@ func (cm *SecureCookieManager) Set(w http.ResponseWriter, name string, opts *Coo HttpOnly: opts.HTTPOnly, Secure: opts.Secure, MaxAge: int(opts.MaxAge.Seconds()), + Expires: opts.Expires, + SameSite: opts.SameSite, } if err := cm.Encoder.Encode(v, &cookie); err != nil { diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..550b175 --- /dev/null +++ b/go.mod @@ -0,0 +1,10 @@ +module github.com/doximity/cookies + +go 1.22.6 + +require github.com/divoxx/goRailsYourself v0.0.0-20150818201947-3fe8d02f099f + +require ( + github.com/franela/goblin v0.0.0-20211003143422-0a4f594942bf // indirect + golang.org/x/crypto v0.27.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..9e785d6 --- /dev/null +++ b/go.sum @@ -0,0 +1,6 @@ +github.com/divoxx/goRailsYourself v0.0.0-20150818201947-3fe8d02f099f h1:jx31MCT3aPNLMLEYbaEg5fauKAtBmyb8iM48QxTmE98= +github.com/divoxx/goRailsYourself v0.0.0-20150818201947-3fe8d02f099f/go.mod h1:D2BDDdHBTYnRHaA+Eo6SqJnkkyk+AfTI2Qb49UveB4E= +github.com/franela/goblin v0.0.0-20211003143422-0a4f594942bf h1:NrF81UtW8gG2LBGkXFQFqlfNnvMt9WdB46sfdJY4oqc= +github.com/franela/goblin v0.0.0-20211003143422-0a4f594942bf/go.mod h1:VzmDKDJVZI3aJmnRI9VjAn9nJ8qPPsN1fqzr9dqInIo= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=