Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartSession ¶
StartSession is an example middleware that starts a session for each request. If this middleware not suitable for your application, you can create your own.
func StartSessionWithConfig ¶ added in v1.5.0
func StartSessionWithConfig(manager *sessions.Manager, cfg Config) func(next http.Handler) http.Handler
StartSessionWithConfig is StartSession with explicit configuration.
The session cookie is (re)sent on every response whose session was saved successfully, so its expiry slides along with the server-side lifetime. For streaming responses the session is saved right before the first byte goes out; changes made after that are still persisted when the handler returns, but can no longer affect the cookie.
Types ¶
type Config ¶ added in v1.5.0
type Config struct {
// Driver is the session driver name; empty selects the default driver.
Driver string
// Cookie, when set, is called with the prepared session cookie before it
// is written, allowing customization of Path, Domain, Secure, SameSite
// and the other attributes.
Cookie func(*http.Cookie)
}
Config customizes the StartSession middleware.
Click to show internal directories.
Click to hide internal directories.