middleware

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package middleware allows adding custom middleware(s) to the RESTful API, such as, JWT based authentication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrometheusMiddleware

func PrometheusMiddleware(next http.Handler) http.Handler

PrometheusMiddleware adds basic metrics to a handler

Types

type Handler

type Handler func(next http.Handler) http.Handler

Handler is used for returning middleware functions

func HTTPRateLimiterMiddleware

func HTTPRateLimiterMiddleware(
	logger logger.Logger,
	respWriter response.Writer,
	store limiter.Store,
) Handler

HTTPRateLimiterMiddleware creates a handler for HTTP rate limiting.

func NewAuthenticationMiddleware

func NewAuthenticationMiddleware(
	authenticator *auth.Authenticator,
	logger logger.Logger,
	respWriter response.Writer,
) Handler

NewAuthenticationMiddleware resolves whether the caller has authenticated. If so, it sets the caller on the context. In either case, it sets the subject string on the context.

func NewCommonHeadersMiddleware

func NewCommonHeadersMiddleware(
	headers map[string]string,
) Handler

NewCommonHeadersMiddleware creates an instance of CommonHeadersMiddleware

func NewRequireAuthenticatedCallerMiddleware

func NewRequireAuthenticatedCallerMiddleware(
	logger logger.Logger,
	respWriter response.Writer,
) Handler

NewRequireAuthenticatedCallerMiddleware requires an authenticated caller.

Jump to

Keyboard shortcuts

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