middleware

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

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

Middleware is the core authentication middleware It implements http.Handler and can wrap any http.Handler

func New

func New(
	cfg *config.Config,
	sessionStore kvs.Store,
	oauthManager *oauth2.Manager,
	emailHandler *email.Handler,
	authzChecker authz.Checker,
	forwarder forwarding.Forwarder,
	rulesEvaluator *rules.Evaluator,
	translator *i18n.Translator,
	logger logging.Logger,
) *Middleware

New creates a new authentication middleware

func (*Middleware) ServeHTTP

func (m *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler This is where all requests pass through

func (*Middleware) Wrap

func (m *Middleware) Wrap(next http.Handler) http.Handler

Wrap wraps a http.Handler with authentication This is the main entry point for using the middleware

type ValidationError

type ValidationError struct {
	Field   string // Field name (e.g., "server.port", "session.cookie_secret")
	Message string // Error message
}

ValidationError represents a single validation error

type ValidationErrors

type ValidationErrors []ValidationError

ValidationErrors is a collection of validation errors

func ValidateConfig

func ValidateConfig(cfg *config.Config) ValidationErrors

ValidateConfig validates the middleware configuration Returns a list of validation errors, or nil if validation passes

func (ValidationErrors) Error

func (ve ValidationErrors) Error() string

Error implements the error interface Returns a formatted string of all validation errors

Jump to

Keyboard shortcuts

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