auth

package
v3.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2015 License: Apache-2.0 Imports: 3 Imported by: 66

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnauthorized = errors.New("unauthorized")
)

Functions

func GenerateToken

func GenerateToken() (string, error)

func Hash

func Hash(data string) (string, error)

Types

type ACL

type ACL struct {
	RoleName    string        `json:"role_name,omitempty"`
	Description string        `json:"description,omitempty"`
	Rules       []*AccessRule `json:"rules,omitempty"`
}

func DefaultACLs

func DefaultACLs() []*ACL

type AccessRule

type AccessRule struct {
	Path    string   `json:"path,omitempty"`
	Methods []string `json:"methods,omitempty"`
}

type Account

type Account struct {
	ID        string       `json:"id,omitempty" gorethink:"id,omitempty"`
	FirstName string       `json:"first_name,omitempty" gorethink:"first_name,omitempty"`
	LastName  string       `json:"last_name,omitempty" gorethink:"last_name,omitempty"`
	Username  string       `json:"username,omitempty" gorethink:"username"`
	Password  string       `json:"password,omitempty" gorethink:"password"`
	Tokens    []*AuthToken `json:"-" gorethink:"tokens"`
	Roles     []string     `json:"roles,omitempty" gorethink:"roles"`
}

type AuthToken

type AuthToken struct {
	Token     string `json:"auth_token,omitempty" gorethink:"auth_token"`
	UserAgent string `json:"user_agent,omitempty" gorethink:"user_agent"`
}

type Authenticator

type Authenticator interface {
	Authenticate(username, password, hash string) (bool, error)
	GenerateToken() (string, error)
	IsUpdateSupported() bool
	Name() string
}

type ServiceKey

type ServiceKey struct {
	Key         string `json:"key,omitempty" gorethink:"key"`
	Description string `json:"description,omitempty" gorethink:"description"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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