mid

package
v0.0.0-...-3bd2bae Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggerMiddleware

func LoggerMiddleware(log *logrus.Logger) func(next http.Handler) http.Handler

LoggerMiddleware is a http middleware for logging requests

Types

type Auth

type Auth struct {
	Authenticator auth.Authenticator
}

Auth is used to authenticate and authorize HTTP requests.

func (*Auth) Authenticate

func (a *Auth) Authenticate() func(next http.Handler) http.Handler

Authenticate validates a JWT from the `Authorization` header.

func (*Auth) HasRole

func (a *Auth) HasRole(roles ...string) func(next http.Handler) http.Handler

HasRole validates that an authenticated user has at least one role from a specified list. This method constructs the actual function that is used.

Jump to

Keyboard shortcuts

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