style: rename variables

This commit is contained in:
Polianin Nikita 2024-05-29 04:58:21 +03:00
parent ac7bbde75e
commit f4ad1518ef

View File

@ -17,26 +17,28 @@ public class PreAuthService(ICacheService cache)
GeneratorKey.GenerateString(16); GeneratorKey.GenerateString(16);
private static string GetPreAuthCacheKey(string fingerprint) => $"{fingerprint}_pre_auth_token"; private static string GetPreAuthCacheKey(string fingerprint) => $"{fingerprint}_pre_auth_token";
{
var firstAuthToken = GenerateFirstAuthToken();
var loginStructure = new PreAuthToken public async Task<PreAuthTokenResponse> GeneratePreAuthTokenAsync(TokenRequest request, string userId, CancellationToken cancellation = default)
{
var preAuthToken = GeneratePreAuthToken();
var preAuthTokenStruct = new PreAuthToken
{ {
Fingerprint = request.Fingerprint, Fingerprint = request.Fingerprint,
UserId = userId, UserId = userId,
UserAgent = request.UserAgent, UserAgent = request.UserAgent,
Token = firstAuthToken Token = preAuthToken
}; };
await cache.SetAsync( await cache.SetAsync(
GetPreAuthCacheKey(request.Fingerprint), GetPreAuthCacheKey(request.Fingerprint),
JsonSerializer.SerializeToUtf8Bytes(loginStructure), JsonSerializer.SerializeToUtf8Bytes(preAuthTokenStruct),
Lifetime, Lifetime,
cancellation); cancellation);
return new PreAuthTokenResponse return new PreAuthTokenResponse
{ {
Token = firstAuthToken, Token = preAuthToken,
ExpiresIn = DateTime.UtcNow.Add(Lifetime) ExpiresIn = DateTime.UtcNow.Add(Lifetime)
}; };
} }