middleware

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(log *zap.Logger, authClient AuthClient) func(http.Handler) http.Handler

Authenticate checks the validity of a token

func Authorize

func Authorize(log *zap.Logger, authClient AuthClient, requiredRole string) func(http.Handler) http.Handler

Authorize checks rights to perform certain requests

func GetClaims

func GetClaims(ctx context.Context) (*auth.Claims, error)

GetClaims returns user claims from context

func Logger

func Logger(logger *zap.Logger) func(http.Handler) http.Handler

Logger logs incoming HTTP requests and their responses using zap.Logger

func Metrics

func Metrics(next http.Handler) http.Handler

Metrics records metrics for each HTTP request

Types

type AuthClient

type AuthClient interface {
	ParseToken(tokenStr string) (*auth.Claims, error)
	Verify(ctx context.Context, tokenStr string) error
}

AuthClient - auth client interface

Directories

Path Synopsis
Package middleware_mock is a generated GoMock package.
Package middleware_mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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