mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-05-06 21:26:06 +00:00
53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using System.Diagnostics.CodeAnalysis;
|
|
|
|
namespace Octokit
|
|
{
|
|
public class Credentials
|
|
{
|
|
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes"
|
|
, Justification = "Credentials is immutable")]
|
|
public readonly static Credentials Anonymous = new Credentials();
|
|
|
|
private Credentials()
|
|
{
|
|
AuthenticationType = AuthenticationType.Anonymous;
|
|
}
|
|
|
|
public Credentials(string token)
|
|
{
|
|
Ensure.ArgumentNotNullOrEmptyString(token, "token");
|
|
|
|
Login = null;
|
|
Password = token;
|
|
AuthenticationType = AuthenticationType.Oauth;
|
|
}
|
|
|
|
public Credentials(string login, string password)
|
|
{
|
|
Ensure.ArgumentNotNullOrEmptyString(login, "login");
|
|
Ensure.ArgumentNotNullOrEmptyString(password, "password");
|
|
|
|
Login = login;
|
|
Password = password;
|
|
AuthenticationType = AuthenticationType.Basic;
|
|
}
|
|
|
|
public string Login
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
public string Password
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
public AuthenticationType AuthenticationType
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
}
|
|
} |