namespace BestHTTP.Authentication
{
///
/// Authentication types that supported by BestHTTP.
/// The authentication is defined by the server, so the Basic and Digest are not interchangeable. If you don't know what to use, the preferred way is to choose Unknow.
///
public enum AuthenticationTypes
{
///
/// If the authentication type is not known this will do a challenge turn to receive what methode should be choosen.
///
Unknown,
///
/// The most basic authentication type. It's easy to do, and easy to crack. ;)
///
Basic,
///
///
///
Digest
}
///
/// Hold all information that required to authenticate to a remote server.
///
public sealed class Credentials
{
///
/// The type of the Authentication. If you don't know what to use, the preferred way is to choose Unknow.
///
public AuthenticationTypes Type { get; private set; }
///
/// The username to authenticate on the remote server.
///
public string UserName { get; private set; }
///
/// The password to use in the authentication process. The password will be stored only in this class.
///
public string Password { get; private set; }
///
/// Set up the authentication credentials with the username and password. The Type will be set to Unknown.
///
public Credentials(string userName, string password)
:this(AuthenticationTypes.Unknown, userName, password)
{
}
///
/// Set up the authentication credentials with the given authentication type, username and password.
///
public Credentials(AuthenticationTypes type, string userName, string password)
{
this.Type = type;
this.UserName = userName;
this.Password = password;
}
}
}