auth

package
v0.0.0-...-b65d386 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitRoot

func InitRoot(ctx context.Context, db *config.DB, token string) (bool, error)

func IsInvalidCredential

func IsInvalidCredential(err error) bool

func UpdatePermissions

func UpdatePermissions(ctx context.Context, db *config.DB, user string, permissions Permissions) error

func UpsertUser

func UpsertUser(ctx context.Context, db *config.DB, user, passwd string) error

func WithPermissions

func WithPermissions(ctx context.Context, perm Permissions) context.Context

Types

type ErrInvalidCredentials

type ErrInvalidCredentials struct{}

func (ErrInvalidCredentials) Error

func (ErrInvalidCredentials) Error() string

type Permissions

type Permissions struct {
	CanWrite bool
	Allowed  []string
}

func CheckCredential

func CheckCredential(ctx context.Context, db *config.DB, user string, plainTextPwd string) (*Permissions, error)

func GetPermissions

func GetPermissions(ctx context.Context) Permissions

type User

type User struct {
	Name        string `msgpack:"name"`
	SaltedToken []byte `msgpack:"salted_token"`

	Permissions *Permissions `msgpack:"permissions"`
}

Jump to

Keyboard shortcuts

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