auth

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnauthorized = errors.New("unauthorized")
View Source
var ErrUserNotFound = errors.New("user not found")

Functions

func CheckPassword added in v0.3.0

func CheckPassword(candidatePlain []byte, hash []byte, salt, paramsJSON []byte) (bool, error)

func EncryptPassword added in v0.3.0

func EncryptPassword(plaintextPasswd []byte, params Argon2Params) ([]byte, []byte, error)

Types

type Argon2Params

type Argon2Params struct {
	KeyLen  uint32 `json:"keyLen"`
	Memory  uint32 `json:"memory"`
	Threads uint8  `json:"threads"`
	Time    uint32 `json:"time"`
	Version int    `json:"version"`
}

func (*Argon2Params) ToJSONString added in v0.3.0

func (a *Argon2Params) ToJSONString() (string, error)

type LocalAuthUser

type LocalAuthUser struct {
	ID                     int64
	Username               string
	Algorithm              string
	Params                 string
	Salt                   []byte
	Password               []byte
	RequiresPasswordChange bool
	CreatedAt              time.Time
	UpdatedAt              time.Time
}

type User

type User struct {
	ID       int64  `form:"-"`
	Username string `form:"username"`

	DisplayName string `form:"display_name"`
	IsAdmin     bool   `form:"is_admin"`

	RequiresPasswordChange bool `form:"-"`

	AuthRef string `form:"-"`

	Preferences UserPreferences

	CreatedAt time.Time `form:"-"`
	UpdatedAt time.Time `form:"-"`
}

type UserPreferences added in v0.7.0

type UserPreferences struct {
	SidebarClosedDesktop bool

	ThemeName string
	ThemeMode string

	AssetListColumns []string
	AssetListCompact bool

	UserListCompact bool
}

Jump to

Keyboard shortcuts

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