Skip to content

Add some missing cookie options and add go.mod #1

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cookies.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
)
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=