middleware

package
v0.0.0-...-5d5787e Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTP

type HTTP struct {
	http.Handler
	// contains filtered or unexported fields
}

HTTP is an implementation of net/http.Handler It wraps another http Handler and performs token validation using an embedded auth.Authenticator. If the token is invalid, a suitable response is rendered via the http.ResponseWriter. Otherwise, the embedded handler is called and scopes are passed down via the request context.

func New

func New(handler http.Handler, auth *auth.Authenticator) *HTTP

New returns a pointer to a HTTP middleware, wrapping the provided Handler, using the provided Authenticator.

func (*HTTP) ServeHTTP

func (h *HTTP) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP performs token validation and delegates result via the ResponseWriter or the embedded Handler if all verifies correctly.

Jump to

Keyboard shortcuts

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