backends

package
v0.5.16 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const TokenBucketName = "tokenbucket"

TokenBucketName

View Source
const UserBucketName = "authbucket"

UserBucketName - default name for BoltDB bucket that stores user info

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthBackend

type AuthBackend struct {
	TokenCache cache.Cache
	// contains filtered or unexported fields
}

BoltCache - container to implement Cache instance with BoltDB backend for storage

func NewAuthBackend added in v0.5.16

func NewAuthBackend(tokenCache, userCache cache.Cache) AuthBackend

func (*AuthBackend) AddUser

func (b *AuthBackend) AddUser(username, password string, admin bool) error

func (*AuthBackend) GetAllUsers

func (b *AuthBackend) GetAllUsers() (users []User, err error)

func (*AuthBackend) GetUser

func (b *AuthBackend) GetUser(username string) (user *User, err error)

type User

type User struct {
	UUID     string `json:"uuid" form:"-"`
	Username string `json:"username" form:"username"`
	Password string `json:"password" form:"password"`
	IsAdmin  bool   `json:"is_admin" form:"is_admin"`
}

func DecodeUser

func DecodeUser(user []byte) (*User, error)

func (*User) Encode

func (u *User) Encode() ([]byte, error)

Jump to

Keyboard shortcuts

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