Add FingerprintManager
This commit is contained in:
@@ -17,20 +17,23 @@ namespace Akari.Prototype.Server.Services
|
||||
public class TcpProviderService : BackgroundService
|
||||
{
|
||||
public const int BufferLength = 4096;
|
||||
public const int MaxTokenLength = 192;
|
||||
public const int MaxTokenLength = 24;
|
||||
public const int ReceiveTimeout = 500_000;
|
||||
|
||||
private readonly ILogger<TcpProviderService> _logger;
|
||||
private readonly TcpProviderOptions _options;
|
||||
private readonly IHostApplicationLifetime _hostApplicationLifetime;
|
||||
private readonly IFingerprintManager _fingerprintManager;
|
||||
private Task _backgroundTask;
|
||||
private TcpListener _listener;
|
||||
|
||||
public TcpProviderService(ILogger<TcpProviderService> logger, IOptions<TcpProviderOptions> options, IHostApplicationLifetime hostApplicationLifetime)
|
||||
public TcpProviderService(ILogger<TcpProviderService> logger, IOptions<TcpProviderOptions> options,
|
||||
IHostApplicationLifetime hostApplicationLifetime, IFingerprintManager fingerprintManager)
|
||||
{
|
||||
_logger = logger;
|
||||
_options = options.Value;
|
||||
_hostApplicationLifetime = hostApplicationLifetime;
|
||||
_fingerprintManager = fingerprintManager;
|
||||
}
|
||||
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
@@ -117,8 +120,9 @@ namespace Akari.Prototype.Server.Services
|
||||
position += read;
|
||||
}
|
||||
|
||||
// TODO: Send token to AuthManager that will compare it to stored hash using Argon2
|
||||
_logger.LogDebug($"Received token: {Convert.ToBase64String(data[..position].Span)}");
|
||||
|
||||
await _fingerprintManager.VerifyToken(data[..position].ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user