session

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2019 License: MIT Imports: 6 Imported by: 4

README

Nibbler Session

Provides a session for the server to use.

An SQL connector is available out of the box, which can be used in memory mode by not providing a DB reference.

The default MaxAge is 30 days (86400 * 30) in all cases (which is pretty long).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Extension

type Extension struct {
	nibbler.NoOpExtension
	SessionName    string
	StoreConnector StoreConnector // creates cookie store if not provided
	// contains filtered or unexported fields
}

func (*Extension) GetAttribute

func (s *Extension) GetAttribute(r *http.Request, attribute string) (interface{}, error)

func (*Extension) GetCaller

func (s *Extension) GetCaller(r *http.Request) (*nibbler.User, error)

func (*Extension) Init

func (s *Extension) Init(app *nibbler.Application) error

func (*Extension) SetAttribute

func (s *Extension) SetAttribute(w http.ResponseWriter, r *http.Request, key string, value interface{}) error

TODO: SetAttributes to set multiple attributes in one save

func (*Extension) SetCaller

func (s *Extension) SetCaller(w http.ResponseWriter, r *http.Request, userValue *nibbler.User) error

type StoreConnector added in v0.10.0

type StoreConnector interface {
	Connect() (error, sessions.Store)
	MaxAge() int
}

Jump to

Keyboard shortcuts

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