user

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2018 License: AGPL-3.0 Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidUser = errors.New("invalid user")
)

Common Errors

View Source
var (
	ErrNotFound = errors.New("not found")
)

Errors

Functions

func NewLDAPCache added in v0.1.0

func NewLDAPCache(config *store.LDAPConfig) store.Cache

NewLDAPCache returns a cache suitable for interacting with LDAP

func NewLDAPChecker added in v0.1.0

func NewLDAPChecker(config *store.LDAPConfig) common.PasswordChecker

NewLDAPChecker returns a password checker using LDAP

func RegisterAPI

func RegisterAPI(opts Options) *mux.Router

RegisterAPI returns a router for the api.

Types

type Details

type Details struct {
	ID       uint64 `json:"id"`
	Username string `json:"username"`
	Password string `json:"password"`
	Email    string `json:"email"`
	Name     string `json:"name"`
	State    State  `json:"state"`
}

Details describes the user details

type Options added in v0.0.7

type Options struct {
	Root    string
	Verbose bool
	Users   *Registry
}

Options are user API handler options

type Registry added in v0.0.7

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

Registry maintains the known users

func NewRegistry added in v0.0.7

func NewRegistry(cache store.Cache) *Registry

NewRegistry returns an initialized UserRegistry

func (*Registry) BcryptChecker added in v0.0.7

func (u *Registry) BcryptChecker() common.PasswordChecker

BcryptChecker creates in implementation of common.Checker that uses bcrypt to verify password against the password field in the user details

func (*Registry) Delete added in v0.0.7

func (u *Registry) Delete(username string) error

Delete removes the user registration

func (*Registry) Get added in v0.0.7

func (u *Registry) Get(username string) (*Details, error)

Get returns a user registration by username, or an error if not found

func (*Registry) LoadFromJSON added in v0.0.7

func (u *Registry) LoadFromJSON(r io.Reader) error

LoadFromJSON loads users encoded in JSON

func (*Registry) PlainTextChecker added in v0.0.7

func (u *Registry) PlainTextChecker() common.PasswordChecker

PlainTextChecker creates in implementation of common.Checker that uses simple text comparison to verify password against the plain text password field in the user details

func (*Registry) Put added in v0.0.7

func (u *Registry) Put(user *Details) error

Put save the user registration

func (*Registry) SaveToJSON added in v0.0.7

func (u *Registry) SaveToJSON(w io.Writer) error

SaveToJSON stores the registry users to the io.Writer as JSON

type State added in v0.1.0

type State string

State describes User States

const (
	Active   State = "active"
	Inactive State = "inactive"
)

Valid User States

Jump to

Keyboard shortcuts

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