sessions

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrHeaderFormat is returned when the authorization header doesn't
	// contain 2 fields separated by whitespace.
	ErrHeaderFormat = errors.New("incorrect authorization header format")
	// ErrEmptyHeader is returned when the authorization header is not set
	ErrEmptyHeader = errors.New("empty authorization header")
	// ErrUnsupportedScheme is returned when the scheme is either not bearer nor the set custom scheme
	ErrUnsupportedScheme = errors.New("unsupported authorization scheme")
)

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(secret []byte, scheme string, timeout time.Duration, store tokens.Store) *Store

func (*Store) Load

func (s *Store) Load(r *http.Request, v interface{}) error

Load trys both LoadBearer and LoadHeadless.

func (*Store) LoadBearer

func (s *Store) LoadBearer(r *http.Request, v interface{}) error

LoadBearer loads a stateful session using the session from key the authorization header.

func (*Store) LoadHeadless

func (s *Store) LoadHeadless(r *http.Request, v interface{}) error

LoadHeadless loads a stateless session from the encoded token in the authorization header.

func (*Store) Save

func (s *Store) Save(r *http.Request, k string, v interface{}) (string, error)

Save stores the session using the given key and creates a token for accesing it.

Jump to

Keyboard shortcuts

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