middleware

package
v1.0.29 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserContextKey contextKey = "user"
)

Variables

This section is empty.

Functions

func GetClientIP

func GetClientIP(r *http.Request) string

GetClientIP extracts the real client IP address Exported for backward compatibility - delegates to netutil.GetClientIP Deprecated: Use netutil.GetClientIP directly for new code

func IPWhitelistMiddleware

func IPWhitelistMiddleware(cfg *config.Config) func(http.Handler) http.Handler

IPWhitelistMiddleware enforces IP-based access control SECURITY: Logs warning at startup if whitelist file is missing (all IPs will be denied)

func JWTAuthMiddleware

func JWTAuthMiddleware(cfg *config.Config) func(http.Handler) http.Handler

JWTAuthMiddleware validates JWT tokens The authService is created once and reused for all requests (performance optimization)

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

LoggingMiddleware logs all HTTP requests

func SecurityHeadersMiddleware

func SecurityHeadersMiddleware(next http.Handler) http.Handler

SecurityHeadersMiddleware adds security headers to responses

func SessionAuthMiddleware added in v1.0.27

func SessionAuthMiddleware(store *session.Store) func(http.Handler) http.Handler

SessionAuthMiddleware validates session tokens (replacement for JWT) Uses in-memory session store for token validation Maintains backward compatibility by putting *auth.Claims in context

Types

This section is empty.

Jump to

Keyboard shortcuts

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