Documentation
¶
Index ¶
- Constants
- func GetClientIP(r *http.Request) string
- func IPWhitelistMiddleware(cfg *config.Config) func(http.Handler) http.Handler
- func JWTAuthMiddleware(cfg *config.Config) func(http.Handler) http.Handler
- func LoggingMiddleware(next http.Handler) http.Handler
- func SecurityHeadersMiddleware(next http.Handler) http.Handler
- func SessionAuthMiddleware(store *session.Store) func(http.Handler) http.Handler
Constants ¶
const (
UserContextKey contextKey = "user"
)
Variables ¶
This section is empty.
Functions ¶
func GetClientIP ¶
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 ¶
IPWhitelistMiddleware enforces IP-based access control SECURITY: Logs warning at startup if whitelist file is missing (all IPs will be denied)
func JWTAuthMiddleware ¶
JWTAuthMiddleware validates JWT tokens The authService is created once and reused for all requests (performance optimization)
func LoggingMiddleware ¶
LoggingMiddleware logs all HTTP requests
func SecurityHeadersMiddleware ¶
SecurityHeadersMiddleware adds security headers to responses
func SessionAuthMiddleware ¶ added in v1.0.27
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.