using System; namespace Renci.SshNet { /// /// Base class for all supported authentication methods. /// public abstract class AuthenticationMethod : IAuthenticationMethod { /// /// Gets the name of the authentication method. /// /// /// The name of the authentication method. /// public abstract string Name { get; } /// /// Gets connection username. /// public string Username { get; private set; } /// /// Gets or sets the list of allowed authentications. /// public string[] AllowedAuthentications { get; protected set; } /// /// Initializes a new instance of the class. /// /// The username. /// is whitespace or null. protected AuthenticationMethod(string username) { if (string.IsNullOrWhiteSpace(username)) { throw new ArgumentException("username"); } Username = username; } /// /// Authenticates the specified session. /// /// The session to authenticate. /// /// The result of the authentication process. /// public abstract AuthenticationResult Authenticate(Session session); /// /// Authenticates the specified session. /// /// The session to authenticate. /// /// The result of the authentication process. /// AuthenticationResult IAuthenticationMethod.Authenticate(ISession session) { return Authenticate((Session) session); } } }