auth

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Cmd = "AUTH"

	SessionStatusPending = SessionStatusT(0)
	SessionStatusActive  = SessionStatusT(1)
	SessionStatusExpired = SessionStatusT(2)
)

Variables

View Source
var (
	UserStore = NewUsersStore()
)

Functions

This section is empty.

Types

type Session

type Session struct {
	ID   uint64
	User *User

	CreatedAt      int64
	LastAccessedAt int64

	Status SessionStatusT
}

func NewSession

func NewSession() (session *Session)

func (*Session) Activate

func (session *Session) Activate(user *User)

func (*Session) Expire

func (session *Session) Expire()

func (*Session) IsActive

func (session *Session) IsActive() (isActive bool)

func (*Session) Validate

func (session *Session) Validate(username, password string) error

type SessionStatusT

type SessionStatusT uint8

type User

type User struct {
	Username          string
	Passwords         []string
	IsPasswordEnabled bool
}

func (*User) SetPassword

func (user *User) SetPassword(password string) (err error)

type Users

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

func NewUsersStore

func NewUsersStore() (users *Users)

func (*Users) Add

func (users *Users) Add(username string) (user *User, err error)

func (*Users) Get

func (users *Users) Get(username string) (user *User, err error)

Jump to

Keyboard shortcuts

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