session

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2018 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 SessionStoreConnector // 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) (*user.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 *user.User) error

type SessionStoreConnector

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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