private async Task <bool> ValidateToken(string authToken) { var tokenHandler = new JwtSecurityTokenHandler(); var validationParameters = _tokenizer.GetValidationParameters(); try { SecurityToken validatedToken; IPrincipal principal = tokenHandler.ValidateToken(authToken, validationParameters, out validatedToken); _context.HttpContext.User = (ClaimsPrincipal)principal; var user = await _dbService.FindByUsernameAsync(_context.HttpContext.User.Identity.Name); GlobalHelpers.CurrentUser = user; return(true); } catch { return(false); } }