Allow Configurable Rate-Limit Key Derivation in RateLimiter Middleware
- Dominant language
- Go
- Stars
- 20.9k
- Forks
- 1.8k
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 39
Description
## Problem Statement
The current `RateLimiter` middleware in gofr supports request limiting primarily based on **IP address** (`PerIP` flag).
While this works well for generic APIs, it is **not sufficient for authentication and identity-based use cases** such as:
- Login attempts per **email**
- OTP validation per **user ID**
- Password reset attempts per **account**
- API throttling per **API key / tenant / user**
At the moment, developers cannot easily apply rate limiting on identifiers other than IP without writing custom middleware or duplicating logic.
---
## Current Limitation
```go
RateLimiterConfig{
RequestsPerSecond: 5,
Burst: 10,
PerIP: true,
}
Contributor guide
Assessment
This issue has not been assessed yet.