private void ConfigureClient(IServiceProvider serviceProvider, HttpClient httpClient)
        {
            AgentConfiguration agentConfiguration = serviceProvider.GetRequiredService <AgentConfiguration>();

            httpClient.BaseAddress = new Uri(agentConfiguration.ServerBaseUri);

            httpClient.DefaultRequestHeaders.Authorization =
                new AuthenticationHeaderValue("Bearer", agentConfiguration.AccessToken);
        }
        private HttpMessageHandler Configure(IServiceProvider provider)
        {
            AgentConfiguration agentConfiguration = provider.GetRequiredService <AgentConfiguration>();
            var httpMessageHandler = new HttpClientHandler();

            if (!agentConfiguration.CheckCertificateEnabled)
            {
                httpMessageHandler.ServerCertificateCustomValidationCallback = delegate
                {
                    return(true);
                };
            }

            return(httpMessageHandler);
        }