Documentation
¶
Overview ¶
Package auth manages users and passwords (AUTH, requirepass) and per-user permissions (ACL). See acl.go for the rule language.
Index ¶
- Constants
- Variables
- type Store
- func (s *Store) Authenticate(name, pass string) error
- func (s *Store) AutoLogin() bool
- func (s *Store) Check(user, command string, categories []string, keys []string) error
- func (s *Store) DelUser(name string) bool
- func (s *Store) Describe(name string) (string, bool)
- func (s *Store) SetDefaultPassword(pass string)
- func (s *Store) SetUser(name string, rules []string) error
- func (s *Store) User(name string) (*User, bool)
- func (s *Store) Users() []string
- type User
Constants ¶
const DefaultUser = "default"
Variables ¶
var ( ErrWrongPass = errors.New("WRONGPASS invalid username-password pair or user is disabled.") ErrNoSuchUser = errors.New("ERR no such user") )
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds all users. Users are copy-on-write so readers never see a half-updated user.
func New ¶
New creates the store with a "default" user that has every permission and either no password or requirepass.
func (*Store) Authenticate ¶
Authenticate checks a username/password pair.
func (*Store) AutoLogin ¶
AutoLogin reports whether new connections are authenticated as "default" without AUTH (true when the default user has no password).
func (*Store) Check ¶
Check returns an error if user may not run command (with its categories) on the given keys.
func (*Store) SetDefaultPassword ¶
SetDefaultPassword is used by requirepass / CONFIG SET requirepass.
func (*Store) SetUser ¶
SetUser creates or modifies a user with ACL rules, e.g.
ACL SETUSER alice on >secret ~cache:* +@read +set -flushall
Rules: on, off, >pass, <pass, nopass, resetpass, ~pattern, allkeys, resetkeys, +cmd, -cmd, +@category, -@category, allcommands (+@all), nocommands (-@all), reset.