Documentation ¶
Overview ¶
Package auth implements etcd authentication.
Index ¶
Constants ¶
View Source
const ( // StorePermsPrefix is the internal prefix of the storage layer dedicated to storing user data. StorePermsPrefix = "/2" // RootRoleName is the name of the ROOT role, with privileges to manage the cluster. RootRoleName = "root" // GuestRoleName is the name of the role that defines the privileges of an unauthenticated user. GuestRoleName = "guest" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
func (Error) HTTPStatus ¶
type PasswordStore ¶ added in v2.3.0
type Permissions ¶
type Permissions struct {
KV RWPermission `json:"kv"`
}
func (Permissions) Grant ¶
func (p Permissions) Grant(n *Permissions) (Permissions, error)
Grant adds a set of permissions to the permission object on which it is called, returning a new permission object.
func (*Permissions) IsEmpty ¶
func (p *Permissions) IsEmpty() bool
func (Permissions) Revoke ¶
func (p Permissions) Revoke(n *Permissions) (Permissions, error)
Revoke removes a set of permissions to the permission object on which it is called, returning a new permission object.
type RWPermission ¶ added in v2.2.0
func (RWPermission) Grant ¶ added in v2.2.0
func (rw RWPermission) Grant(n RWPermission) (RWPermission, error)
Grant adds a set of permissions to the permission object on which it is called, returning a new permission object.
func (RWPermission) HasAccess ¶ added in v2.2.0
func (rw RWPermission) HasAccess(key string, write bool) bool
func (RWPermission) HasRecursiveAccess ¶ added in v2.2.0
func (rw RWPermission) HasRecursiveAccess(key string, write bool) bool
func (RWPermission) Revoke ¶ added in v2.2.0
func (rw RWPermission) Revoke(n RWPermission) (RWPermission, error)
Revoke removes a set of permissions to the permission object on which it is called, returning a new permission object.
type Role ¶
type Role struct { Role string `json:"role"` Permissions Permissions `json:"permissions"` Grant *Permissions `json:"grant,omitempty"` Revoke *Permissions `json:"revoke,omitempty"` }
type Store ¶
type Store interface { AllUsers() ([]string, error) GetUser(name string) (User, error) CreateOrUpdateUser(user User) (out User, created bool, err error) CreateUser(user User) (User, error) DeleteUser(name string) error UpdateUser(user User) (User, error) AllRoles() ([]string, error) GetRole(name string) (Role, error) CreateRole(role Role) error DeleteRole(name string) error UpdateRole(role Role) (Role, error) AuthEnabled() bool EnableAuth() error DisableAuth() error PasswordStore }
Click to show internal directories.
Click to hide internal directories.