Documentation
¶
Index ¶
- Constants
- func AuthMiddleware(cfg *config.Config) func(http.Handler) http.Handler
- func GetUserID(ctx context.Context) (uuid.UUID, bool)
- func GetUserRole(ctx context.Context) (string, bool)
- func RequestID(next http.Handler) http.Handler
- func RequireRole(roles ...string) func(http.Handler) http.Handler
- type RateLimiter
Constants ¶
View Source
const ( UserIDKey contextKey = "user_id" UserEmailKey contextKey = "user_email" UserRoleKey contextKey = "user_role" RequestIDKey contextKey = "request_id" )
Variables ¶
This section is empty.
Functions ¶
func AuthMiddleware ¶
AuthMiddleware validates JWT tokens
func GetUserRole ¶
GetUserRole retrieves the user role from context
Types ¶
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter implements per-IP rate limiting
func NewRateLimiter ¶
func NewRateLimiter(requestsPerSecond int) *RateLimiter
NewRateLimiter creates a new rate limiter
Click to show internal directories.
Click to hide internal directories.