middleware

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectorTokenAuth

func CollectorTokenAuth(storer tokens.TokenStorer, log *zap.SugaredLogger) func(next http.Handler) http.Handler

CollectorTokenAuth is a middleware which returns a HTTP 403 response if the provided token header x-iamzero-token does not match a token from the TokerStorer

func Logger

func Logger(l *zap.Logger) func(next http.Handler) http.Handler

Logger is a middleware that logs the start and end of each request, along with some useful data about what was requested, what the response status was, and how long it took to return.

func TokenFromContext

func TokenFromContext(ctx context.Context) (*tokens.Token, bool)

TokenFromContext loads the token from the request context. REQUIRES that middleware.CollectorTokenAuth() middleware has run. Can only be used after the middleware is used in the Go router.

func Tracing

func Tracing(next http.Handler) http.Handler

Tracing is a middleware which adds the Chi route to the OpenTelemetry span generated for the http.Handler

Types

This section is empty.

Jump to

Keyboard shortcuts

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