using System; using System.Collections.Generic; using Renci.SshNet.Common; namespace Renci.SshNet { /// /// Base class for all supported authentication methods /// public abstract class AuthenticationMethod { /// /// Gets authentication method name /// public abstract string Name { get; } /// /// Gets connection username. /// public string Username { get; private set; } /// /// Gets the authentication error message. /// public string ErrorMessage { get; private set; } /// /// Gets list of allowed authentications. /// public IEnumerable AllowedAuthentications { get; protected set; } /// /// Initializes a new instance of the class. /// /// The username. /// is whitespace or null. protected AuthenticationMethod(string username) { if (username.IsNullOrWhiteSpace()) throw new ArgumentException("username"); this.Username = username; } /// /// Authenticates the specified session. /// /// The session to authenticate. /// Result of authentication process. public abstract AuthenticationResult Authenticate(Session session); } }