auth

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2017 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package auth provides a pluggable set of "Authenticators". These Authenticators represent a different database used to store authorized token/tag combinations that, when enabled, will allow/deny access to mist methods for these authorized token/tags combinations.

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultAuth Authenticator // this is the current authenticator for the package; this is set during an authenticator start

	//
	ErrTokenNotFound = fmt.Errorf("Token not found\n")
	ErrTokenExist    = fmt.Errorf("Token already exists\n")
)

Functions

func GenerateHandlers

func GenerateHandlers() map[string]mist.HandleFunc

GenerateHandlers ...

func Register

func Register(name string, auth handleFunc)

Register registers a new mist authenticator

func Start

func Start(uri string) error

Start attempts to start a mist authenticator from the list of available authenticators; the authenticator provided is in the uri string format (scheme:[//[user:pass@]host[:port]][/]path[?query][#fragment])

Types

type Authenticator

type Authenticator interface {
	AddToken(token string) error                    // add a token to list of authorized tokens
	RemoveToken(token string) error                 // remove a token from the list of authorized tokens
	AddTags(token string, tags []string) error      // add authorized tags to a token
	RemoveTags(token string, tags []string) error   // remove authorized tags from a token
	GetTagsForToken(token string) ([]string, error) // get the authorized tags for a token
}

Authenticator represnets a database of authorized token/tag combinations. These combinations are used as a way to allow access to mist methods for a particular token/tag combination (when authentication is desired)

func NewMemory

func NewMemory(url *url.URL) (Authenticator, error)

NewMemory creates a new in-memory Authenticator

func NewPostgres

func NewPostgres(url *url.URL) (Authenticator, error)

NewPostgres creates a new "postgres" Authenticator

func NewRedis

func NewRedis(url *url.URL) (Authenticator, error)

NewRedis creates a new "redis" Authenticator

func NewScribble

func NewScribble(url *url.URL) (Authenticator, error)

NewScribble creates a new "scribble" authenticator

Jump to

Keyboard shortcuts

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