using System.Net;
namespace AutoUpdaterDotNET;
///
/// Provides Custom Authentication header for web request.
///
public class CustomAuthentication : IAuthentication
{
///
/// Initializes authorization header value for Custom Authentication
///
/// Value to use as http request header authorization value
public CustomAuthentication(string httpRequestHeaderAuthorizationValue)
{
HttpRequestHeaderAuthorizationValue = httpRequestHeaderAuthorizationValue;
}
private string HttpRequestHeaderAuthorizationValue { get; }
///
public void Apply(ref MyWebClient webClient)
{
webClient.Headers[HttpRequestHeader.Authorization] = ToString();
}
///
public override string ToString()
{
return HttpRequestHeaderAuthorizationValue;
}
}