Limit repeated access code requests via caching
Introduced a mechanism to limit repeated access code requests within a configurable time period using `IMemoryCache` and a new `RepeatRequestBlockingPeriod` configuration in `SendAccessCodeParams`. Key changes: - Added `SendAccessCodeParams` configuration to `appsettings.json`. - Updated DI in `DependencyInjection.cs` to include `SendAccessCodeParams`. - Enhanced `SendAccessCodeCommand` with `MultipleRequestsAllowed`. - Updated `SendAccessCodeCommandHandler` to handle caching logic: - Added `IsAccessCodeRequestsDisabled` and `DisableAccessCodeRequests`. - Modified `AuthController` to support `autoGenerated` query parameter. - Improved error handling and documentation. These changes ensure better control over access code requests and prevent abuse by limiting repeated requests within a configurable time window.
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
namespace EnvelopeGenerator.Application.EnvelopeReceivers.Commands;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public record SendAccessCodeParams
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public TimeSpan RepeatRequestBlockingPeriod { get; init; } = TimeSpan.FromMinutes(1);
|
||||
}
|
||||
Reference in New Issue
Block a user