public UserDto Authenticate(string userName, string password) { var result = SignInAsync(userName, password); if (!result.Result.Succeeded) { return(null); } UserDto user = this.GetByName(userName); if (user == null) { return(null); } string[] roles = GetUserRoles(user).Result; var token = _jwtFactory.GenerateJwtToken(userName, user.Id, roles); user.Token = token; user.Password = null; return(user); }