session

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound                  = errors.New("not found")
	ErrRememberTokenRequired     = errors.New("remember token required")
	ErrRememberTokenHashRequired = errors.New("remember token hash required")
)

Functions

This section is empty.

Types

type FakeRepository

type FakeRepository struct {
	Sessions []Session
}

func (*FakeRepository) SessionAdd

func (r *FakeRepository) SessionAdd(session Session) error

func (*FakeRepository) SessionGetByRememberTokenHash

func (r *FakeRepository) SessionGetByRememberTokenHash(hash string) (Session, error)

type Repository

type Repository interface {
	// SessionAdd saves a new user Session.
	SessionAdd(Session) error

	// SessionGetByRememberTokenHash returns the Session corresponding to a
	// given remember token hash.
	SessionGetByRememberTokenHash(hash string) (Session, error)
}

Repository provides access to the user Web Session repoository.

type Service

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

Service handles operations for the user session domain.

func NewService

func NewService(r Repository, hmacKey string) *Service

NewServices initializes and returns a Session Service.

func (*Service) Add

func (s *Service) Add(session Session) error

Add saves a new Session.

func (*Service) ByRememberToken

func (s *Service) ByRememberToken(rememberToken string) (Session, error)

ByRememberToken returns the user Session corresponding to a given RememberToken.

type Session

type Session struct {
	UserUUID               string
	RememberToken          string
	RememberTokenHash      string
	RememberTokenExpiresAt time.Time
}

Session represents a Web User session.

Jump to

Keyboard shortcuts

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