Fix captcha rendering and refresh rate limit
This commit is contained in:
1 parent
dfea86a8bc
commit
922c8d8ed2
3 files changed
+12
-2
No files matched your search
+1
-1
Submodule packages/CaptchaKit updated: 8964692448...cd37690d97.
@@ -138,7 +138,7 @@ public sealed class AuthController(
|
|||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[EnableRateLimiting("public-auth")]
|
[EnableRateLimiting("captcha-challenge")]
|
||||||
[HttpPost("login/captcha")]
|
[HttpPost("login/captcha")]
|
||||||
public async Task<ActionResult<LoginCaptchaResponse>> CreateLoginCaptcha(CancellationToken cancellationToken)
|
public async Task<ActionResult<LoginCaptchaResponse>> CreateLoginCaptcha(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -598,6 +598,16 @@ builder.Services.AddRateLimiter(options =>
|
|||||||
QueueLimit = 0,
|
QueueLimit = 0,
|
||||||
AutoReplenishment = true
|
AutoReplenishment = true
|
||||||
}));
|
}));
|
||||||
|
options.AddPolicy("captcha-challenge", context =>
|
||||||
|
RateLimitPartition.GetFixedWindowLimiter(
|
||||||
|
context.Connection.RemoteIpAddress?.ToString() ?? "unknown",
|
||||||
|
_ => new FixedWindowRateLimiterOptions
|
||||||
|
{
|
||||||
|
PermitLimit = 30,
|
||||||
|
Window = TimeSpan.FromMinutes(5),
|
||||||
|
QueueLimit = 0,
|
||||||
|
AutoReplenishment = true
|
||||||
|
}));
|
||||||
options.AddPolicy("token-refresh", context =>
|
options.AddPolicy("token-refresh", context =>
|
||||||
RateLimitPartition.GetFixedWindowLimiter(
|
RateLimitPartition.GetFixedWindowLimiter(
|
||||||
context.Connection.RemoteIpAddress?.ToString() ?? "unknown",
|
context.Connection.RemoteIpAddress?.ToString() ?? "unknown",
|
||||||
|
|||||||
Reference in new issue
Block a user