mid

package
v0.0.0-...-efc3f8c Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package mid contains the set of middleware functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(a *auth.Auth) web.Middleware

[PS] Handler 1: Authentication Authenticate validates a JWT from the `Authorization` header. [PS] Job of this middleware is to validate the signature in the token

func Authorize

func Authorize(roles ...string) web.Middleware

[PS] Handler 2: Authorization Authorize validates that an authenticated user has at least one role from a specified list. This method constructs the actual function that is used.

func Errors

func Errors(log *zap.SugaredLogger) web.Middleware

Errors handles errors coming out of the call chain. It detects normal application errors which are used to respond to the client in a uniform way. Unexpected errors (status >= 500) are logged.

func Logger

func Logger(log *zap.SugaredLogger) web.Middleware

Logger ...

func Metrics

func Metrics() web.Middleware

Metrics updates program counters.

func Panics

func Panics() web.Middleware

Panics recovers from panics and converts the panic to an error so it is reported in Metrics and handled in Errors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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