session

package
v1.0.0-...-3fe6b38 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAccessDenied

func IsAccessDenied(e error) bool

Test if the error is Access Denied

Types

type ErrAccessDenied

type ErrAccessDenied struct{}

Access denied

func (ErrAccessDenied) Error

func (ErrAccessDenied) Error() string

type Identifier

type Identifier interface {
	Identify(r *http.Request) (sessId string, err error)
}

type IdentifyFunc

type IdentifyFunc func(*http.Request) (string, error)

func (IdentifyFunc) Identify

func (idf IdentifyFunc) Identify(r *http.Request) (sessId string, err error)

type Persister

type Persister interface {
	Persist(sess *Session) error
}

type ResolveFunc

type ResolveFunc func(*http.Request) (*Session, error)

func (ResolveFunc) Resolve

func (rf ResolveFunc) Resolve(r *http.Request) (sess *Session, err error)

type Resolver

type Resolver interface {
	Resolve(r *http.Request) (sess *Session, err error)
}

type Restorer

type Restorer interface {
	Restore(sessId string) (sess *Session, err error)
}

type Session

type Session struct {
	Context  context.Context
	Id       string
	User     *User
	State    interface{}
	EventBus event.Bus
}

type StartFunc

type StartFunc func(string) (*Session, error)

func (StartFunc) Start

func (sf StartFunc) Start(sessId string) (sess *Session, err error)

type Starter

type Starter interface {
	// Start a new session. The session returned must have Id initialized with the suggested sessId or with
	// generated internally.
	Start(sessId string) (sess *Session, err error)
}

Starter is responsible for initiating new sessions.

type Store

type Store interface {
	Starter
	Persister
	Restorer

	Exists(sessId string) bool
}

type User

type User struct {
	Id   string
	Data interface{}
}

Jump to

Keyboard shortcuts

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