session

package
v0.0.43 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHelpers

func AddHelpers(next http.Handler) http.Handler

func FromCtx

func FromCtx(ctx context.Context) *sessions.Session

FromCtx returns the session from the context.

func New

func New(secret, name string, options ...Option) *session

func RegisterSessionTypes added in v0.0.6

func RegisterSessionTypes(types ...any)

RegisterSessionTypes registers those custom types that will be stored in the session.

Types

type Option

type Option func(*sessions.CookieStore)

Option for the session middleware

func WithDomain

func WithDomain(domain string) Option

Set the domain for the application session This is useful when you want to share the session between subdomains.

func WithHTTPOnly added in v0.0.10

func WithHTTPOnly(httpOnly bool) Option

WithHTTPOnly sets the HttpOnly flag on the session cookie.

func WithMaxAge added in v0.0.10

func WithMaxAge(maxAge int) Option

WithMaxAge sets the maximum age for the session cookie. A negative value means that the cookie is deleted when the browser is closed.

func WithPath added in v0.0.10

func WithPath(path string) Option

func WithSameSite added in v0.0.9

func WithSameSite(sameSite http.SameSite) Option

WithSameSite value for the SameSite option on the session cookie.

func WithSecure added in v0.0.9

func WithSecure(secure bool) Option

WithSecure value for the Secure flag on the session cookie.

func WithSecureFlag added in v0.0.10

func WithSecureFlag(secure bool) Option

WithSecure sets the Secure flag on the session cookie.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL