handlers

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2018 License: MPL-2.0 Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoConnPool    = errors.New("handlers can't access database pool")
	ErrNoNomadClient = errors.New("handlers can't access nomad client")
	ErrFailedAuth    = errors.New("failed request authentication")
	ErrFailedSession = errors.New("failed session authentication")
	ErrFailedAccount = errors.New("failed account authentication")
	ErrFailedKey     = errors.New("failed key authentication")
	ErrNoSession     = errors.New("failed to get authenticated session")
)

Functions

func AuthHandler

func AuthHandler(pool *pgx.ConnPool, config auth.Config, handler http.Handler) authHandler

AuthHandler constructs and returns the HTTP handler object responsible for authenticating a request. This accepts a chain of HTTP handlers.

func ContextHandler

func ContextHandler(pool *pgx.ConnPool, nomad *nomad.Client, h http.Handler) *contextHandler

func GetAuthSession

func GetAuthSession(ctx context.Context) *auth.Session

GetAuthSession pulls the current active authenticated session out of the current request context. This keeps authentication scoped to the active request only.

func GetDBPool

func GetDBPool(ctx context.Context) (*pgx.ConnPool, bool)

GetDBPool pulls a configured database client out of the current request context.

func GetNomadClient

func GetNomadClient(ctx context.Context) (*nomad.Client, bool)

GetNomadClient pulls a configured nomad client out of the current request context.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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