middleware

package
v0.0.0-...-412dc8c Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendRequestID

func AppendRequestID(w http.ResponseWriter, r *http.Request)

AppendRequestID Inserts a new UUID request id to the request context, and adds it to request and response headers.

func ConfigureRoot

func ConfigureRoot(app interfaces.App)

func JWTAuth

func JWTAuth(app interfaces.App) func(http.Handler) http.Handler

JWTAuth A middleware function for extracting, parsing, and validating JWT auth data from request headers.

This middleware sets `authenticated` to either `true` or `false`, depending on whether the token exists, is valid, and is not expired. The next most interesting field is `user_role`, which dictates the permission level of the current user. JWT tokens and claims are attached as well, in addition to the user's ID and email.

func RequestMetadata

func RequestMetadata() func(http.Handler) http.Handler

RequestMetadata Middleware to add common request metadata to the context, request, and response. Presently this only includes a UUID request id.

Types

This section is empty.

Jump to

Keyboard shortcuts

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