mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-12 18:07:22 +01:00
28 lines
No EOL
615 B
C#
28 lines
No EOL
615 B
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MareSynchronosServices.Authentication;
|
|
|
|
public class FailedAuthorization : IDisposable
|
|
{
|
|
private int failedAttempts = 1;
|
|
public int FailedAttempts => failedAttempts;
|
|
public Task ResetTask { get; set; }
|
|
public CancellationTokenSource? ResetCts { get; set; }
|
|
|
|
public void Dispose()
|
|
{
|
|
try
|
|
{
|
|
ResetCts?.Cancel();
|
|
ResetCts?.Dispose();
|
|
}
|
|
catch { }
|
|
}
|
|
|
|
public void IncreaseFailedAttempts()
|
|
{
|
|
Interlocked.Increment(ref failedAttempts);
|
|
}
|
|
} |