예제 #1
0
 public ChainCallCController(ILogger <ChainCallCController> logger, IHttpClientFactory clientFactory, IConfiguration configuration)
 {
     _logger        = logger;
     _configuration = configuration;
     _clientFactory = clientFactory;
     //_client = client;
 }
 /// <summary>
 /// Initialize new instance of <see cref="YandexTrafficJamsProvider"/>.
 /// </summary>
 /// <param name="provider"><inheritdoc cref="AvailableRegionsProvider"/>.</param>
 /// <param name="clientFactory"><inheritdoc cref="HttpClientFactory"/></param>
 /// <param name="cache"></param>
 public YandexTrafficJamsProvider(AvailableRegionsProvider provider, IHttpClientFactory clientFactory,
                                  TrafficJamsCache cache)
 {
     _provider      = provider;
     _clientFactory = clientFactory;
     _cache         = cache;
 }
예제 #3
0
 public Worker(ILogger <Worker> logger,
               IHttpClientFactory httpClientFactory)
 {
     _logger            = logger;
     _httpClientFactory = httpClientFactory;
     _authContext       = new AuthenticationContext("https://login.microsoftonline.com/6b9be1b6-4f80-4ce7-8479-16c4d7726470");
     _credential        = new ClientCredential("3d572aaa-e4c1-4d35-975a-c3b8dd3da053", "f0fl?XeBcHmLffPHI6p5T7oRqnv_ja[?");
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GraphUtility"/> class.
 /// </summary>
 /// <param name="telemetryClient">The application insights DI.</param>
 /// <param name="cache">Cache.</param>
 /// <param name="httpClientFactory">Http Client Factory DI.</param>
 public GraphUtility(
     TelemetryClient telemetryClient,
     IDistributedCache cache,
     System.Net.Http.IHttpClientFactory httpClientFactory)
 {
     this.telemetryClient   = telemetryClient;
     this.cache             = cache;
     this.httpClientFactory = httpClientFactory;
 }
        /// <summary>
        /// Initialiseert een <see cref="OAuthClientCollection"/> vanuit een URL. Downloadt de lijst, parset en valideert deze.
        /// </summary>
        /// <param name="url">Een URL waar de lijst kan worden gedownloadet.</param>
        /// <param name="httpClientFactory">De context voor de download</param>
        /// <param name="cancellationToken">Een cancellationtoken kan gebruikt worden om een cancellation door te geven.</param>
        /// <returns>De nieuwe <see cref="OAuthClientCollection"/>.</returns>
        public static async Task <OAuthClientCollection> FromURLAsync(Uri url, System.Net.Http.IHttpClientFactory httpClientFactory, CancellationToken cancellationToken = default(CancellationToken))
        {
            string data;

            using (var c = httpClientFactory.CreateClient())
            {
                data = await c.GetStringAsync(url, cancellationToken).ConfigureAwait(false);
            }

            return(FromXMLData(data));
        }
예제 #6
0
 public CheckTagChanges(
     System.Net.Http.IHttpClientFactory httpClientFactory,
     IConfigurationRoot config,
     ILogger <CheckTagChanges> log,
     IDockerRegistryClientFactory dockerRegistryClientFactory)
 {
     this.httpClient = httpClientFactory.CreateClient();
     this.config     = config;
     this.log        = log;
     this.dockerRegistryClientFactory = dockerRegistryClientFactory;
 }
예제 #7
0
        public GitHubAccountClient(System.Net.Http.IHttpClientFactory clientFactory)
        {
            var client = clientFactory.CreateClient();

            client.BaseAddress = new Uri("https://api.github.com/");
            client.DefaultRequestHeaders.Add("Accept",
                                             "application/vnd.github.v3+json");
            client.DefaultRequestHeaders.Add("User-Agent",
                                             "HttpClient-Example");

            Client = client;
        }
예제 #8
0
 public Worker(ILogger <Worker> logger,
               IHttpClientFactory http,
               TokenCache tokenCache,
               IConfiguration config,
               IOptions <AzureAdOptions> azureAdConfig)
 {
     _logger          = logger;
     _http            = http;
     _azureAdConfig   = azureAdConfig.Value;
     _authContext     = new AuthenticationContext(_azureAdConfig.Authority, tokenCache);
     _credential      = new ClientCredential(_azureAdConfig.ClientId, _azureAdConfig.ClientSecret);
     _usersApiBaseUrl = config.GetValue <string>("Services:UsersApiUrl");
 }
예제 #9
0
 public HttpClientAdapter(
     ILogger <HttpClientAdapter> logger,
     IHttpClientFactory httpClientFactory,
     IConfiguration configuration,
     IHttpContextAccessor httpContextAccessor
     )
 {
     _logger              = logger;
     _httpClient          = httpClientFactory.CreateClient();
     _httpClient.Timeout  = TimeSpan.FromMinutes(10);
     _RegisterScope       = configuration["RegisterApi:Scopes"];
     _UserScope           = configuration["UserApi:Scopes"];
     _httpContextAccessor = httpContextAccessor;
 }
예제 #10
0
 public MicrosoftHttpClientFactoryWrapper(snh.IHttpClientFactory httpClientFactory)
 {
     HttpClientFactory = httpClientFactory;
 }
 public GitHubIssuesClient(System.Net.Http.IHttpClientFactory clientFactory)
 {
     Client = clientFactory.CreateClient("github_issues");
 }
예제 #12
0
 public GraphApiService(IConfiguration configuration, System.Net.Http.IHttpClientFactory httpClientFactory)
 {
     _httpClientFactory = httpClientFactory;
     _azureActiveDirectoryInstanceFormat = configuration["AzureActiveDirectoryInstanceFormat"];
 }
예제 #13
0
 public BooksController(ILogger <BooksController> logger, IHttpClientFactory clientFactory)
 {
     _logger        = logger;
     _clientFactory = clientFactory;
 }
예제 #14
0
 /// <summary>
 /// Creates a new instance of class.
 /// </summary>
 /// <param name="factory">The factory to create the internally kept HttpClient</param>
 public HttpClient(net.IHttpClientFactory factory)
 {
     _client = factory.CreateClient("magic");
 }
 public FakeApp(System.Net.Http.IHttpClientFactory clientFactory) : base(clientFactory)
 {
 }
예제 #16
0
 public CustomCkoHttpClientFactory(System.Net.Http.IHttpClientFactory msHttpClientFactory)
 {
     _msHttpClientFactory = msHttpClientFactory;
 }