session

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: GPL-2.0, GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	UserID      string
	Username    string
	Roles       []string
	Permissions []string
	CreatedAt   time.Time
	ExpiresAt   time.Time
}

type Store

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

func NewStore

func NewStore(ttl time.Duration) *Store

func (*Store) Count

func (s *Store) Count() int

func (*Store) Create

func (s *Store) Create(userID, username string, roles, permissions []string) (string, error)

func (*Store) Get

func (s *Store) Get(token string) (*Session, bool)

func (*Store) GetByUserID

func (s *Store) GetByUserID(userID string) *Session

GetByUserID returns the first non-expired session for the given user ID. Used by trusted-header auth to avoid creating sessions on every request.

func (*Store) GetFromRequest

func (s *Store) GetFromRequest(r *http.Request) (*Session, bool)

func (*Store) Revoke

func (s *Store) Revoke(token string)

func (*Store) TTL

func (s *Store) TTL() time.Duration

Jump to

Keyboard shortcuts

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