auth

package
v0.0.0-...-7a98856 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	READ      = 1 << iota
	UPDATE    = 1 << iota
	CREATE    = 1 << iota
	DELETE    = 1 << iota
	RESERVED  = 1 << iota
	RESERVED2 = 1 << iota
	RESERVED3 = 1 << iota
	RESERVED4 = 1 << iota
)

Variables

This section is empty.

Functions

func CreatToken

func CreatToken(accountID int, roles Roles) string

Types

type Auth

type Auth struct {
	AuthToken    string
	AuthEndpoint string
	Backend      AuthenticationBackend
}

func AuthFromConfig

func AuthFromConfig(config map[string]interface{}) Auth

type AuthenticationBackend

type AuthenticationBackend interface {
	Authenticate(authParams map[string]string) (interface{}, error)
	GetRoles() Roles
	GetRole(id string) Role
	GetUsers() interface{}
	GetUser(id string) interface{}
	DeleteUser(id string) error
	UpdateUser(id string, userData map[string]string) (interface{}, error)
	CreateUser(id string, userData map[string]string) (interface{}, error)
	CreateRole(roleData map[string]string) (Role, error)
	UpdateRole(roleData map[string]string) (Role, error)
}

type Permission

type Permission struct {
	Name  string `json:"name"`
	Flags int    `json:"flags"`
}

func (*Permission) CanCreate

func (p *Permission) CanCreate() bool

func (*Permission) CanDelete

func (p *Permission) CanDelete() bool

func (*Permission) CanRead

func (p *Permission) CanRead() bool

func (*Permission) CanUpdate

func (p *Permission) CanUpdate() bool

type Permissions

type Permissions []Permission

type Role

type Role struct {
	Id          string      `json:"id"`
	Name        string      `json:"name"`
	Permissions Permissions `json:"permissions"`
}

type Roles

type Roles [256]Role

Jump to

Keyboard shortcuts

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