auth

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2015 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

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

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

func (Error) Error

func (ae Error) Error() string

func (Error) HTTPStatus

func (ae Error) HTTPStatus() int

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 Role

type Role struct {
	Role        string       `json:"role"`
	Permissions Permissions  `json:"permissions"`
	Grant       *Permissions `json:"grant,omitempty"`
	Revoke      *Permissions `json:"revoke,omitempty"`
}

func (Role) HasKeyAccess

func (r Role) HasKeyAccess(key string, write bool) bool

func (Role) HasRecursiveAccess

func (r Role) HasRecursiveAccess(key string, write bool) bool

type Store

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

func NewStore

func NewStore(server doer, timeout time.Duration) *Store

func (*Store) AllRoles

func (s *Store) AllRoles() ([]string, error)

func (*Store) AllUsers

func (s *Store) AllUsers() ([]string, error)

func (*Store) AuthEnabled

func (s *Store) AuthEnabled() bool

func (*Store) CreateOrUpdateUser

func (s *Store) CreateOrUpdateUser(user User) (out User, created bool, err error)

CreateOrUpdateUser should be only used for creating the new user or when you are not sure if it is a create or update. (When only password is passed in, we are not sure if it is a update or create)

func (*Store) CreateRole

func (s *Store) CreateRole(role Role) error

func (*Store) CreateUser

func (s *Store) CreateUser(user User) (User, error)

func (*Store) DeleteRole

func (s *Store) DeleteRole(name string) error

func (*Store) DeleteUser

func (s *Store) DeleteUser(name string) error

func (*Store) DisableAuth

func (s *Store) DisableAuth() error

func (*Store) EnableAuth

func (s *Store) EnableAuth() error

func (*Store) GetRole

func (s *Store) GetRole(name string) (Role, error)

func (*Store) GetUser

func (s *Store) GetUser(name string) (User, error)

func (*Store) UpdateRole

func (s *Store) UpdateRole(role Role) (Role, error)

func (*Store) UpdateUser

func (s *Store) UpdateUser(user User) (User, error)

type User

type User struct {
	User     string   `json:"user"`
	Password string   `json:"password,omitempty"`
	Roles    []string `json:"roles"`
	Grant    []string `json:"grant,omitempty"`
	Revoke   []string `json:"revoke,omitempty"`
}

func (User) CheckPassword

func (u User) CheckPassword(password string) bool

Jump to

Keyboard shortcuts

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