Exemple #1
0
 private void SetAuthenticationHeaders()
 {
     if (!string.IsNullOrEmpty(ClientConfiguration.Username) && !string.IsNullOrEmpty(ClientConfiguration.Password))
     {
         var credentials = new HttpBasicAuthCredentials(ClientConfiguration.Username, ClientConfiguration.Password);
         _httpClient.AddHeader("Authorize", "Basic " + credentials);
         _httpClient.AddHeader("Authorization", "Basic " + credentials);
     }
 }
Exemple #2
0
 public void VisitClient(IHttpClient client)
 {
     foreach (var item in Headers)
     {
         client.AddHeader(item.Key, item.Value);
     }
 }
Exemple #3
0
        public ApiClient(IHttpClient httpClient, ISecretKeyProvider secretKeyProvider, IFileExtensionToMimeMapper fileExtensionToMimeMapper)
        {
            var secretKey  = secretKeyProvider.GetSecretKey();
            var tokenBytes = Encoding.UTF8.GetBytes(secretKey + ":");

            _privateAuthToken          = Convert.ToBase64String(tokenBytes);
            _fileExtensionToMimeMapper = fileExtensionToMimeMapper;
            _client = httpClient;
            _client.SetAuthorizationHeader(new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", _privateAuthToken));
            _client.AddHeader("User-Agent", string.Format("SecurionPay-DOTNET/{0}", _version));
        }
Exemple #4
0
 public MikiApiClient(string token)
 {
     client = new HttpClient(BaseUrl);
     client.AddHeader("Authorization", "Bearer " + token);
 }
Exemple #5
0
 public static void AddAuthorizationHeader(this IHttpClient client, string value)
 {
     client.RemoveHeader("Authorization");
     client.AddHeader("Authorization", value);
 }