Skip to content

Commit

Permalink
Adds support for SameSite cookie attribute (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
elithrar committed Sep 3, 2018
1 parent a12d857 commit 8154739
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 17 deletions.
18 changes: 18 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// +build !go1.11

package sessions

// Options stores configuration for a session or session store.
//
// Fields are a subset of http.Cookie fields.
type Options struct {
Path string
Domain string
// MaxAge=0 means no Max-Age attribute specified and the cookie will be
// deleted after the browser session ends.
// MaxAge<0 means delete cookie immediately.
// MaxAge>0 means Max-Age attribute present and given in seconds.
MaxAge int
Secure bool
HttpOnly bool
}
22 changes: 22 additions & 0 deletions options_go111.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// +build go1.11

package sessions

import "net/http"

// Options stores configuration for a session or session store.
//
// Fields are a subset of http.Cookie fields.
type Options struct {
Path string
Domain string
// MaxAge=0 means no Max-Age attribute specified and the cookie will be
// deleted after the browser session ends.
// MaxAge<0 means delete cookie immediately.
// MaxAge>0 means Max-Age attribute present and given in seconds.
MaxAge int
Secure bool
HttpOnly bool
// Defaults to http.SameSiteDefaultMode
SameSite http.SameSite
}
17 changes: 0 additions & 17 deletions sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,6 @@ import (
// Default flashes key.
const flashesKey = "_flash"

// Options --------------------------------------------------------------------

// Options stores configuration for a session or session store.
//
// Fields are a subset of http.Cookie fields.
type Options struct {
Path string
Domain string
// MaxAge=0 means no Max-Age attribute specified and the cookie will be
// deleted after the browser session ends.
// MaxAge<0 means delete cookie immediately.
// MaxAge>0 means Max-Age attribute present and given in seconds.
MaxAge int
Secure bool
HttpOnly bool
}

// Session --------------------------------------------------------------------

// NewSession is called by session stores to create a new session instance.
Expand Down

0 comments on commit 8154739

Please sign in to comment.