herbsession

package
v0.0.0-...-be25ffa Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DirectiveFactory = func(loader func(v interface{}) error) (usersystem.Directive, error) {
	c := &Config{}
	err := loader(c)

	if err != nil {
		return nil, err
	}

	return c, nil
}
View Source
var PayloadsField = []byte("payloads")

Functions

This section is empty.

Types

type Config

type Config struct {
	Prefix string
	*httpsession.Config
}

func (*Config) CreateService

func (c *Config) CreateService() (*Service, error)

func (*Config) Execute

func (c *Config) Execute(s *usersystem.UserSystem) error

type Service

type Service struct {
	Prefix []byte
	Store  *httpsession.Store
}

func NewService

func NewService() *Service

func (*Service) Del

func (s *Service) Del(r *http.Request, fieldname string) error

Del del session value by field name .

func (*Service) Execute

func (s *Service) Execute(us *usersystem.UserSystem) error

func (*Service) Get

func (s *Service) Get(r *http.Request, fieldname string, v interface{}) error

Get get session by field name with given value.

func (*Service) IsNotFoundError

func (s *Service) IsNotFoundError(err error) bool

IsNotFoundError check if given error is session not found error.

func (*Service) MustGetRequestSession

func (s *Service) MustGetRequestSession(r *http.Request, st usersystem.SessionType) *usersystem.Session

func (*Service) MustGetSession

func (s *Service) MustGetSession(st usersystem.SessionType, id string) *usersystem.Session

func (*Service) MustLoginRequestSession

func (s *Service) MustLoginRequestSession(r *http.Request, payloads *authority.Payloads) *usersystem.Session

func (*Service) MustLogoutRequestSession

func (s *Service) MustLogoutRequestSession(r *http.Request) bool

func (*Service) MustRevokeSession

func (s *Service) MustRevokeSession(code string) bool

func (*Service) SessionMiddleware

func (s *Service) SessionMiddleware() func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)

func (*Service) Set

func (s *Service) Set(r *http.Request, fieldname string, v interface{}) error

Set set session by field name with given value.

func (*Service) Start

func (s *Service) Start() error

Start start service

func (*Service) Stop

func (s *Service) Stop() error

Stop stop service

Jump to

Keyboard shortcuts

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