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 ¶
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 ¶
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