From f4ad1518ef5cbae22c0bc4531c8a2742cdf1d40f Mon Sep 17 00:00:00 2001 From: Polianin Nikita Date: Wed, 29 May 2024 04:58:21 +0300 Subject: [PATCH] style: rename variables --- Security/Services/PreAuthService.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Security/Services/PreAuthService.cs b/Security/Services/PreAuthService.cs index 484c5a1..cc189dd 100644 --- a/Security/Services/PreAuthService.cs +++ b/Security/Services/PreAuthService.cs @@ -17,26 +17,28 @@ public class PreAuthService(ICacheService cache) GeneratorKey.GenerateString(16); private static string GetPreAuthCacheKey(string fingerprint) => $"{fingerprint}_pre_auth_token"; - { - var firstAuthToken = GenerateFirstAuthToken(); - var loginStructure = new PreAuthToken + public async Task GeneratePreAuthTokenAsync(TokenRequest request, string userId, CancellationToken cancellation = default) + { + var preAuthToken = GeneratePreAuthToken(); + + var preAuthTokenStruct = new PreAuthToken { Fingerprint = request.Fingerprint, UserId = userId, UserAgent = request.UserAgent, - Token = firstAuthToken + Token = preAuthToken }; await cache.SetAsync( GetPreAuthCacheKey(request.Fingerprint), - JsonSerializer.SerializeToUtf8Bytes(loginStructure), + JsonSerializer.SerializeToUtf8Bytes(preAuthTokenStruct), Lifetime, cancellation); return new PreAuthTokenResponse { - Token = firstAuthToken, + Token = preAuthToken, ExpiresIn = DateTime.UtcNow.Add(Lifetime) }; }