middleware

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ClaimsKey key = iota
)

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(next http.Handler) http.Handler

AuthMiddleware validates JWT tokens and protects routes

func CorsMiddleware added in v1.4.4

func CorsMiddleware(next http.Handler) http.Handler

CORSMiddleware is a middleware function that adds CORS headers to HTTP responses.

func GetClaimsFromContext

func GetClaimsFromContext(ctx context.Context) (jwt.MapClaims, bool)

GetClaimsFromContext retrieves claims from request context

func LimiterMiddleware

func LimiterMiddleware(next http.Handler) http.Handler

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

func PrometheusMiddleware

func PrometheusMiddleware(next http.Handler, requestsTotal *prometheus.CounterVec, requestDuration *prometheus.HistogramVec) http.Handler

PrometheusMiddleware is a middleware for recording Prometheus metrics.

func SecurityHeadersMiddleware added in v1.4.4

func SecurityHeadersMiddleware(next http.Handler) http.Handler

SecurityHeadersMiddleware adds security headers to the response

Types

This section is empty.

Jump to

Keyboard shortcuts

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