Exemplo n.º 1
0
 private async Task AttachAccountToContext(HttpContext context, string token, IUserRepository userRepository)
 {
     try
     {
         var(principal, jwtToken) = _jWTService.DecodeJwtToken(token);
         var accountId = jwtToken.Claims.First(x => x.Type == "id").Value;
         context.Items["Account"] = await userRepository.GetUserByIdAsync(accountId);
     }
     catch
     {
         //
     }
 }