diff --git a/PARR.API/Authentication/Models/UserCache.cs b/PARR.API/Authentication/Models/UserCache.cs index 5f4aa2fc..5f77509c 100644 --- a/PARR.API/Authentication/Models/UserCache.cs +++ b/PARR.API/Authentication/Models/UserCache.cs @@ -3,6 +3,11 @@ public class UserCache { public required string UserIp { get; set; } + + public string Name { get; set; } = string.Empty; + + public string Description { get; set; } = string.Empty; + public List Roles { get; set; } = new List(); } } diff --git a/PARR.API/Controllers/V1/TestController.cs b/PARR.API/Controllers/V1/TestController.cs index e23bea64..19fd0407 100644 --- a/PARR.API/Controllers/V1/TestController.cs +++ b/PARR.API/Controllers/V1/TestController.cs @@ -67,6 +67,11 @@ namespace PARR.API.Controllers.V1 } + /// + /// Записать в кэш и получить обратно значение из кэша + /// + /// + /// [HttpPost(ApiRoutes.Test.CreateCache)] public async Task CreateCache([FromBody] CaheRequestTest request) { diff --git a/PARR.API/Services/Implementations/AuthService.cs b/PARR.API/Services/Implementations/AuthService.cs index 0484e2ec..3e8c4a7b 100644 --- a/PARR.API/Services/Implementations/AuthService.cs +++ b/PARR.API/Services/Implementations/AuthService.cs @@ -63,7 +63,14 @@ namespace PARR.API.Services.Implementations } // пользователь есть, добавляем в КЭШ и возвращаем роли - var cacheData = new UserCache { UserIp = ipAddress, Roles = roles }; + var cacheData = new UserCache + { + UserIp = ipAddress, + Roles = roles, + Name = user!.Name, + Description = user.Description ?? string.Empty + }; + await cacheService.SetCachedDataAsync(GetAllowKey(ipAddress), cacheData, userCacheSettings.UserCacheTtl); return cacheData;