accounts

package
v1.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package accounts ...

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAccountNotFound is returned when an account is not found.
	ErrAccountNotFound = errors.New("account not found")
	// ErrIncorrectPassword is returned when the password is invalid.
	ErrIncorrectPassword = errors.New("incorrect password")
	// ErrInsufficientCapabilities is returned when the account does not have the required capabilities.
	ErrInsufficientCapabilities = errors.New("insufficient capabilities")
	// ErrAccountDisabled is returned when the account is disabled.
	ErrAccountDisabled = errors.New("account disabled")
	// ErrUserAlreadyExists is returned when we try to create a user that already exists.
	ErrUserAlreadyExists = errors.New("user already exists")
)

Functions

func Tests

func Tests(t *testing.T, p Interface)

Tests runs a series of tests on the provided accounts provider.

Types

type Account

type Account struct {
	Enabled       bool                `yaml:"enabled"`
	Capabilities  []AccountCapability `yaml:"capabilities"`
	PasswordMtime string              `yaml:"passwordMtime"`
	PasswordHash  string              `yaml:"passwordHash"`
}

Account is an internal representation of an Everest user account.

func (Account) HasCapability

func (a Account) HasCapability(c AccountCapability) bool

HasCapability returns true if the given account has the specified capability.

type AccountCapability

type AccountCapability string

AccountCapability represents a capability of an account.

const (
	// AccountCapabilityLogin represents capability to create UI session tokens.
	AccountCapabilityLogin AccountCapability = "login"
	// AccountCapabilityAPIKey represents capability to generate API auth tokens.
	AccountCapabilityAPIKey AccountCapability = "apiKey"
)

type Interface

type Interface interface {
	Create(ctx context.Context, username, password string) error
	Get(ctx context.Context, username string) (*Account, error)
	List(ctx context.Context) (map[string]*Account, error)
	Delete(ctx context.Context, username string) error
	SetPassword(ctx context.Context, username, newPassword string, secure bool) error
	Verify(ctx context.Context, username, password string) error
	IsSecure(ctx context.Context, username string) (bool, error)
}

Interface provides the methods for managing Everest user accounts.

Directories

Path Synopsis
Package cli holds commands for accounts command.
Package cli holds commands for accounts command.

Jump to

Keyboard shortcuts

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