Documentation
¶
Index ¶
- Constants
- Variables
- func Bool(v bool) *bool
- func ParseSameSite(value string) http.SameSite
- type Config
- type CookieConfig
- type Encoding
- type ErrorHandler
- type Manager
- func (m *Manager) Clear(ctx context.Context) error
- func (m *Manager) Close() error
- func (m *Manager) Deadline(ctx context.Context) (time.Time, error)
- func (m *Manager) Destroy(ctx context.Context) error
- func (m *Manager) Exists(ctx context.Context, key string) (bool, error)
- func (m *Manager) Get(ctx context.Context, key string) (interface{}, bool, error)
- func (m *Manager) GetBool(ctx context.Context, key string) (bool, error)
- func (m *Manager) GetInt(ctx context.Context, key string) (int, error)
- func (m *Manager) GetString(ctx context.Context, key string) (string, error)
- func (m *Manager) Load(ctx context.Context, token string) (context.Context, error)
- func (m *Manager) Middleware() func(http.Handler) http.Handler
- func (m *Manager) Pop(ctx context.Context, key string) (interface{}, bool, error)
- func (m *Manager) Put(ctx context.Context, key string, val interface{}) error
- func (m *Manager) Remove(ctx context.Context, key string) error
- func (m *Manager) Renew(ctx context.Context) error
- func (m *Manager) Token(ctx context.Context) (string, error)
- type StoreConfig
- type StoreOptions
- type StoreType
Constants ¶
View Source
const ( SameSiteLaxMode = "lax" SameSiteStrictMode = "strict" SameSiteNoneMode = "none" )
View Source
const DefaultSessionName string = "GFRRSESSID"
Variables ¶
View Source
var ( ErrNotInitialized = errors.New("session manager not initialized") ErrNilConfig = errors.New("session config cannot be nil") ErrInvalidStore = errors.New("invalid session store type") ErrInvalidEncoding = errors.New("invalid session encoding") ErrInvalidCookie = errors.New("invalid cookie configuration") ErrNoSessionInContext = errors.New("no session data in context") )
Functions ¶
func ParseSameSite ¶
Types ¶
type Config ¶
type Config struct {
Store StoreConfig
Cookie CookieConfig
Lifetime time.Duration
IdleTimeout time.Duration
HashTokenInStore *bool
Encoding Encoding
ErrorHandler ErrorHandler
}
Config controls session initialization.
type CookieConfig ¶
type CookieConfig struct {
Name string
Domain string
Path string
SameSite http.SameSite
Secure *bool
HttpOnly *bool
Persist *bool
Partitioned *bool
}
CookieConfig controls the session cookie settings.
type Encoding ¶
type Encoding string
Encoding defines the session encoding format.
func ParseSessionEncoding ¶
type ErrorHandler ¶
type ErrorHandler func(http.ResponseWriter, *http.Request, error)
ErrorHandler is invoked when the session middleware encounters an error.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides a vendor-neutral session API over SCS.
func (*Manager) Middleware ¶
Middleware returns a middleware using this manager.
type StoreConfig ¶
type StoreConfig struct {
Type StoreType
Options StoreOptions
}
StoreConfig controls the session store configuration.
Click to show internal directories.
Click to hide internal directories.