middleware

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestID

func RequestID(next http.Handler) http.Handler

func RequireRole added in v0.1.2

func RequireRole(allowed ...string) func(http.Handler) http.Handler

RequireRole returns a middleware that allows only requests whose JWT role is one of the provided allowed roles.

func UserFromContext

func UserFromContext(ctx context.Context) (*security.RequestClaims, bool)

Types

type ActiveChecker added in v0.1.2

type ActiveChecker interface {
	IsUserActive(ctx context.Context, userID uuid.UUID) (bool, error)
}

ActiveChecker is implemented by the user service to verify a user is still active.

type AuthMiddleware

type AuthMiddleware struct {
	// contains filtered or unexported fields
}

func NewAuthMiddleware

func NewAuthMiddleware(tokenSvc *security.TokenService, activeChecker ActiveChecker) *AuthMiddleware

func (*AuthMiddleware) Handle

func (a *AuthMiddleware) Handle(next http.Handler) http.Handler

type Middleware

type Middleware func(http.Handler) http.Handler

func Logger

func Logger(log *zerolog.Logger) Middleware

Jump to

Keyboard shortcuts

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