/// <summary>
        /// Create a new http client secured by the Lindbak certificate.
        /// </summary>
        /// <param name="endpoint">The endpoint you want to talk to.</param>
        /// <returns>An http client configured with base address and valid bearer token.</returns>
        public async Task <HttpClient> Create(LindbakEndpoint endpoint)
        {
            var fileServiceAccessToken = await AcquireTokenAsync(endpoint.ApplicationId);

            var httpClient = new HttpClient
            {
                BaseAddress = endpoint.BaseAddress
            };

            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", fileServiceAccessToken);
            return(httpClient);
        }
Exemple #2
0
 public App(LindbakHttpClientFactory httpClientFactory, LindbakEndpoint fileServiceEndpoint)
 {
     _httpClientFactory   = httpClientFactory;
     _fileServiceEndpoint = fileServiceEndpoint;
 }