BasicAuthenticationCredential
using Relativity.Services.ServiceProxy;
using System;
using System.Diagnostics;
using System.Globalization;
using System.Net;
using System.Text;
namespace Relativity.Transfer
{
public class BasicAuthenticationCredential : IHttpCredential
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public string UserName { get; set; }
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public string Password { get; set; }
public BasicAuthenticationCredential()
: this(null, null)
{
}
public BasicAuthenticationCredential(string userName, string password)
{
UserName = userName;
Password = password;
}
public string GetAuthenticationHeader()
{
string s = string.Format(CultureInfo.InvariantCulture, "{0}:{1}", UserName, Password);
return string.Format(CultureInfo.InvariantCulture, "Basic {0}", Convert.ToBase64String(Encoding.ASCII.GetBytes(s)));
}
public ICredentials CreateCredentials()
{
return new NetworkCredential(UserName, Password);
}
public Credentials CreateRelativityCredentials()
{
return new UsernamePasswordCredentials(UserName, Password);
}
public IHttpCredential DeepCopy()
{
return new BasicAuthenticationCredential(UserName, Password);
}
public void RefreshCredentials()
{
}
}
}