private async Task <User> GetCurrentUser() { await using var repository = new ApplicationContext(); var token = Request.Headers["Authorization"].ToString().Replace("Bearer ", ""); var username = _jwtManager.DecodeJwtToken(token).Item1.Claims.Single(x => x.Type == ClaimTypes.Name).Value; return(await repository.Users.SingleAsync(x => x.Username == username)); }