middleware

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package middleware contains the Fiber request orchestration and context installation used by the API packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthFailureStatus

func AuthFailureStatus(ctx context.Context) int

func ClassifyError added in v0.4.1

func ClassifyError(ctx context.Context, err error) errorapi.APIError

ClassifyError converts an application error into the public API error envelope. The original error remains available to the boundary logger and is never used as a response message for server failures.

func FiberErrorHandler added in v0.4.1

func FiberErrorHandler(c fiber.Ctx, err error) error

FiberErrorHandler converts errors returned through Fiber into the same API error contract used by explicit handler rejections.

func HandleError added in v0.4.1

func HandleError(c fiber.Ctx, err error) error

func LogError added in v0.4.1

func LogError(c fiber.Ctx, err error, payload errorapi.APIError)

LogError records the original cause separately from its public API value.

func MissingGen3AuthHeader

func MissingGen3AuthHeader(ctx context.Context) bool

func NewAPIError added in v0.4.1

func NewAPIError(ctx context.Context, code errorapi.ErrorCode, status int, msg string) errorapi.APIError

NewAPIError builds the shared wire payload for Fiber and generated handlers.

func Reject added in v0.4.1

func Reject(c fiber.Ctx, status int, msg string) error

Types

type AuthzMiddleware

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

func NewAuthzMiddleware

func NewAuthzMiddleware(logger *slog.Logger, options Options) *AuthzMiddleware

func (*AuthzMiddleware) FiberMiddleware

func (m *AuthzMiddleware) FiberMiddleware() fiber.Handler

FiberMiddleware returns the request-wiring handler for access context and decisions.

type Options

type Options struct {
	Mode      string
	Evaluator authenticationEvaluator
}

type RequestIDMiddleware

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

func NewRequestIDMiddleware

func NewRequestIDMiddleware(logger *slog.Logger) *RequestIDMiddleware

func (*RequestIDMiddleware) FiberMiddleware

func (m *RequestIDMiddleware) FiberMiddleware() fiber.Handler

Jump to

Keyboard shortcuts

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