session

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound                  error = errors.New("not found")
	ErrRememberTokenRequired     error = errors.New("remember token required")
	ErrRememberTokenHashRequired error = errors.New("remember token hash required")
	ErrUserUUIDRequired          error = errors.New("user UUID 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