Categorygithub.com/swfrench/simple-session
modulepackage
0.5.0
Repository: https://github.com/swfrench/simple-session.git
Documentation: pkg.go.dev

# README

simple-session

Minimal storage-backed session management for small golang web apps.

Offers:

  • Creation and management of time-bound session objects with arbitrary data payloads.
  • Storage of session data to Redis (or any implementation of SessionStore).
  • Session-bound CSRF tokens, suitable for, e.g., embedding in hidden form fields.
  • Authenticated (HMAC-SHA256) end-user visible identifiers (i.e., SIDs and CSRF tokens).
  • Easily integrated with go-chi/chi.

Does not offer (at least at this time):

  • Session extension.

# Packages

Package store and its subpackages provide session storage functionality for use by SessionManager.

# Functions

CreateStrictCookie returns an http.Cookie with strict defaults, with the provided name, value, and expiration.
Get returns the Session object instance stored in the provided request Context by the Manage middleware.
NewManager returns a new Manager using the provided store for session storage and respecting the provided options.

# Structs

Manager manages user sessions (i.e., Session instances).
Options represents tunable knobs that control the behavior of Manager.
Session represents a user session.