Documentation ¶
Index ¶
- Variables
- type Config
- type Session
- func (s *Session) Delete(key string)
- func (s *Session) Destroy() error
- func (s *Session) Fresh() bool
- func (s *Session) Get(key string) interface{}
- func (s *Session) ID() string
- func (s *Session) Keys() []string
- func (s *Session) Regenerate() error
- func (s *Session) Reset() error
- func (s *Session) Save() error
- func (s *Session) Set(key string, val interface{})
- func (s *Session) SetExpiry(exp time.Duration)
- type Source
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var ConfigDefault = Config{ Expiration: 24 * time.Hour, KeyLookup: "cookie:session_id", KeyGenerator: utils.UUIDv4, // contains filtered or unexported fields }
ConfigDefault is the default config
View Source
var ErrEmptySessionID = errors.New("session id cannot be empty")
ErrEmptySessionID is an error that occurs when the session ID is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Allowed session duration // Optional. Default value 24 * time.Hour Expiration time.Duration // Storage interface to store the session data // Optional. Default value memory.New() Storage fiber.Storage // KeyLookup is a string in the form of "<source>:<name>" that is used // to extract session id from the request. // Possible values: "header:<name>", "query:<name>" or "cookie:<name>" // Optional. Default value "cookie:session_id". KeyLookup string // Domain of the cookie. // Optional. Default value "". CookieDomain string // Path of the cookie. // Optional. Default value "". CookiePath string // Indicates if cookie is secure. // Optional. Default value false. CookieSecure bool // Indicates if cookie is HTTP only. // Optional. Default value false. CookieHTTPOnly bool // Value of SameSite cookie. // Optional. Default value "Lax". CookieSameSite string // Decides whether cookie should last for only the browser sesison. // Ignores Expiration if set to true // Optional. Default value false. CookieSessionOnly bool // KeyGenerator generates the session key. // Optional. Default value utils.UUIDv4 KeyGenerator func() string // Deprecated: Please use KeyLookup CookieName string // contains filtered or unexported fields }
Config defines the config for middleware.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) Regenerate ¶
Regenerate generates a new session id and delete the old one from Storage
func (*Session) Reset ¶
Reset generates a new session id, deletes the old one from storage, and resets the associated data
Click to show internal directories.
Click to hide internal directories.