public static void AssignHeaders(HttpRequestHeaders headers, IdPayGatewayAccount account) { var api = account.IsTestAccount ? SandBoxApiKey : account.Api; headers.AddOrUpdate(ApiKey, api); if (account.IsTestAccount) { headers.AddOrUpdate(SandBoxKey, "1"); } else if (headers.Contains(SandBoxKey)) { headers.Remove(SandBoxKey); } }
/// <summary> /// Adds a Authorization header so the request will pass Digest authorization. /// </summary> /// <param name="source">HTTP request headers.</param> /// <exception cref="T:System.ArgumentNullException"><paramref name="source" /> is null.</exception> public static void AddPostmanEchoDigestAuth(this HttpRequestHeaders source) { if (source == null) { throw new ArgumentNullException(nameof(source)); } source.AddOrUpdate("Authorization", "Digest username=\"postman\", realm=\"Users\", nonce=\"ni1LiL0O37PRRhofWdCLmwFsnEtH1lew\", uri=\"/digest-auth\", response=\"254679099562cf07df9b6f5d8d15db44\", opaque=\"\""); }
/// <summary> /// Adds a Authorization header with the OAuth authorization value. /// </summary> /// <param name="source">HTTP request headers.</param> /// <param name="authValue">OAuth authorization value.</param> public static void AddPostmanEchoOAuth1Auth(this HttpRequestHeaders source, string authValue) { if (source == null) { throw new ArgumentNullException(nameof(source)); } source.AddOrUpdate("Authorization", authValue); }
/// <summary> /// Adds a Authorization header so the request will pass Basic authorization. /// </summary> /// <param name="source">HTTP request headers.</param> /// <exception cref="T:System.ArgumentNullException"><paramref name="source" /> is null.</exception> public static void AddPostmanEchoBasicAuth(this HttpRequestHeaders source) { if (source == null) { throw new ArgumentNullException(nameof(source)); } source.AddOrUpdate("Authorization", "Basic cG9zdG1hbjpwYXNzd29yZA=="); }