public async Task <TUser> FindByIdAsync(string userId, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); if (userId == null) { throw new ArgumentNullException("The user parameter is null or incorrect."); } var user = await _userRepository.GetUserFromIdAsync(userId); return(user); }
public async Task <ApplicationUser> GetUserFromIdAsync(string id) { var result = await _instance.GetUserFromIdAsync(id); result.Email = _personalDataProtector.Unprotect(result.Email); result.UserName = _personalDataProtector.Unprotect(result.UserName); return(result); }
public async Task <ApplicationUser> GetUserFromLogin(string providerName, string providerKey) { await using var connection = new NpgsqlConnection(strrr); await connection.OpenAsync(); var logins = await connection.QueryAsync <string>(@"select user_id from identity_user_logins where provider=@providername and provider_key= @providerkey", new { providername = providerName, providerkey = providerKey }); //needs cast var userId = logins.First(); var user = await _userRepository.GetUserFromIdAsync(userId); await connection.CloseAsync(); return(user); }