Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HealthResponse ¶ added in v0.6.0
type HealthResponse struct {
Status string `json:"status"` // Current health status (starting/ready/draining/etc.)
Live bool `json:"live"` // Process is alive
Ready bool `json:"ready"` // Ready to accept traffic
Since string `json:"since"` // ISO8601 timestamp of when middleware started
Detail string `json:"detail"` // Human-readable detail message
RetryAfter *int `json:"retry_after"` // Retry after N seconds (only present when 503)
}
HealthResponse represents the JSON response for health check
type HealthStatus ¶ added in v0.6.0
type HealthStatus string
HealthStatus represents the current health status of the middleware
const ( HealthStatusStarting HealthStatus = "starting" HealthStatusWarming HealthStatus = "warming" HealthStatusMigrating HealthStatus = "migrating" HealthStatusPrefilling HealthStatus = "prefilling" HealthStatusDraining HealthStatus = "draining" HealthStatusReady HealthStatus = "ready" )
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, passwordHandler *password.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) GetHealthStatus ¶ added in v0.6.0
func (m *Middleware) GetHealthStatus() HealthStatus
GetHealthStatus returns the current health status
func (*Middleware) IsReady ¶ added in v0.6.0
func (m *Middleware) IsReady() bool
IsReady returns true if the middleware is ready to accept traffic
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) SetDraining ¶ added in v0.6.0
func (m *Middleware) SetDraining()
SetDraining marks the middleware as draining (shutting down gracefully) This should be called when receiving SIGTERM before closing connections
func (*Middleware) SetReady ¶ added in v0.6.0
func (m *Middleware) SetReady()
SetReady marks the middleware as ready to accept traffic This should be called after all initialization is complete
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