localuser

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound       = errors.New("Session not found")
	ErrSessionExpired = errors.New("Session is expired")
)

Functions

This section is empty.

Types

type Persistor

type Persistor interface {
	GetSessions() (map[string]types.Session, error)
	// CreateSession(key string, session types.Session) (types.Session, error)
	CreateSession(key string, session types.Session) (types.Session, error)
	EvictSession(key string) error
}

type PwHasher

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

func NewPwHasher

func NewPwHasher(_salt []byte) PwHasher

func (*PwHasher) Hash

func (p *PwHasher) Hash(pw string) ([]byte, error)

func (*PwHasher) Verify

func (p *PwHasher) Verify(hash []byte, pw string) (bool, error)

type UserSessionInMemory

type UserSessionInMemory struct {
	types.UserSessionOptions
	// contains filtered or unexported fields
}

func NewUserSessionInMemory

func NewUserSessionInMemory(options types.UserSessionOptions, tokenCreator func() string, persistor Persistor) (UserSessionInMemory, error)

func (UserSessionInMemory) ClearAllSessionsForUser

func (us UserSessionInMemory) ClearAllSessionsForUser(userId string) error

func (UserSessionInMemory) ClearSessionById added in v0.8.1

func (us UserSessionInMemory) ClearSessionById(token string) error

func (UserSessionInMemory) GetSession

func (us UserSessionInMemory) GetSession(token string) (s types.Session, err error)

func (UserSessionInMemory) NewSession

func (us UserSessionInMemory) NewSession(user types.User, organization types.Organization, userAgent string, opts ...types.UserSessionOptions) (s types.Session)

func (UserSessionInMemory) ReplaceSession added in v0.8.0

func (us UserSessionInMemory) ReplaceSession(token string, session types.Session) (s types.Session)

func (UserSessionInMemory) SessionsForUser

func (us UserSessionInMemory) SessionsForUser(userId string) (s []types.Session)

func (UserSessionInMemory) TTL

func (UserSessionInMemory) UpdateAllSessionsForUser added in v0.8.0

func (us UserSessionInMemory) UpdateAllSessionsForUser(userId string, user types.User) error

Jump to

Keyboard shortcuts

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