middleware

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package middleware provides HTTP middleware for authorization and context handling.

Index

Constants

View Source
const ContextUserClaims contextKey = "userClaims"

ContextUserClaims is the key for storing user claims in the context.

Variables

This section is empty.

Functions

func Authorization

func Authorization(jwtService ijwt.IService, blockIfInvalid bool) func(http.Handler) http.Handler

Authorization is a middleware that validates the JWT token from the request cookie. If the token is valid, the user claims are attached to the request context; otherwise, it returns an HTTP 401 Unauthorized error.

func RateLimitMiddleware added in v1.1.0

func RateLimitMiddleware(limiter ratelimiter.IRateLimiter) func(http.Handler) 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