persistence

package
v7.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	Store   Store
	Options *options.Cookie
}

Manager wraps a Store and handles the implementation details of the sessions.SessionStore with its use of session tickets

func NewManager

func NewManager(store Store, cookieOpts *options.Cookie) *Manager

NewManager creates a Manager that can wrap a Store and manage the sessions.SessionStore implementation details

func (*Manager) Clear

func (m *Manager) Clear(rw http.ResponseWriter, req *http.Request) error

Clear clears any saved session information for a given ticket cookie. Then it clears all session data for that ticket in the Store.

func (*Manager) Load

func (m *Manager) Load(req *http.Request) (*sessions.SessionState, error)

Load reads sessions.SessionState information from a session store. It will use the session ticket from the http.Request's cookie.

func (*Manager) Save

Save saves a session in a persistent Store. Save will generate (or reuse an existing) ticket which manages unique per session encryption & retrieval from the persistent data store.

func (*Manager) VerifyConnection added in v7.5.0

func (m *Manager) VerifyConnection(ctx context.Context) error

VerifyConnection validates the underlying store is ready and connected

type Store

type Store interface {
	Save(context.Context, string, []byte, time.Duration) error
	Load(context.Context, string) ([]byte, error)
	Clear(context.Context, string) error
	Lock(key string) sessions.Lock
	VerifyConnection(context.Context) error
}

Store is used for persistent session stores (IE not Cookie) Implementing this interface allows it to easily use the persistence.Manager for session ticket + encryption details.

Jump to

Keyboard shortcuts

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