mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-19 02:05:14 +00:00
feat: Add user-based rate limiting to protected API routes with 100 requests per minute limit
- Add RateLimitByUser middleware to protected route group with 100 req/min limit - Add RateLimitByUser middleware to apiProtected route group with 100 req/min limit
This commit is contained in:
@@ -35,6 +35,7 @@ func registerV1Routes(router *gin.Engine, d *serverDeps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected := v1.Group("/")
|
protected := v1.Group("/")
|
||||||
|
protected.Use(middleware.RateLimitByUser(100)) // 100 requests per minute per user
|
||||||
protected.Use(middleware.AuthMiddleware(d.authSvc))
|
protected.Use(middleware.AuthMiddleware(d.authSvc))
|
||||||
{
|
{
|
||||||
authProtected := protected.Group("/auth")
|
authProtected := protected.Group("/auth")
|
||||||
@@ -55,6 +56,7 @@ func registerV1Routes(router *gin.Engine, d *serverDeps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
apiProtected := v1.Group("/")
|
apiProtected := v1.Group("/")
|
||||||
|
apiProtected.Use(middleware.RateLimitByUser(100)) // 100 requests per minute per user
|
||||||
apiProtected.Use(middleware.AuthMiddleware(d.authSvc))
|
apiProtected.Use(middleware.AuthMiddleware(d.authSvc))
|
||||||
{
|
{
|
||||||
registerSubscriberRoutes(apiProtected, d)
|
registerSubscriberRoutes(apiProtected, d)
|
||||||
|
|||||||
Reference in New Issue
Block a user