< Summary

Information
Class: Renci.SshNet.AuthenticationMethod
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\AuthenticationMethod.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 66
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_Username()100%1100%
get_AllowedAuthentications()100%1100%
.ctor(...)100%2100%
Renci.SshNet.IAuthenticationMethod.Authenticate(...)100%1100%

File(s)

\home\appveyor\projects\ssh-net\src\Renci.SshNet\AuthenticationMethod.cs

#LineLine coverage
 1using System;
 2
 3namespace Renci.SshNet
 4{
 5    /// <summary>
 6    /// Base class for all supported authentication methods.
 7    /// </summary>
 8    public abstract class AuthenticationMethod : IAuthenticationMethod
 9    {
 10        /// <summary>
 11        /// Gets the name of the authentication method.
 12        /// </summary>
 13        /// <value>
 14        /// The name of the authentication method.
 15        /// </value>
 16#pragma warning disable CA2119 // Seal methods that satisfy private interfaces
 17        public abstract string Name { get; }
 18#pragma warning restore CA2119 // Seal methods that satisfy private interfaces
 19
 20        /// <summary>
 21        /// Gets connection username.
 22        /// </summary>
 811123        public string Username { get; private set; }
 24
 25        /// <summary>
 26        /// Gets or sets the list of allowed authentications.
 27        /// </summary>
 243528        public string[] AllowedAuthentications { get; protected set; }
 29
 30        /// <summary>
 31        /// Initializes a new instance of the <see cref="AuthenticationMethod"/> class.
 32        /// </summary>
 33        /// <param name="username">The username.</param>
 34        /// <exception cref="ArgumentException"><paramref name="username"/> is whitespace or <see langword="null"/>.</ex
 407735        protected AuthenticationMethod(string username)
 407736        {
 407737            if (string.IsNullOrWhiteSpace(username))
 3038            {
 3039                throw new ArgumentException("username");
 40            }
 41
 404742            Username = username;
 404743        }
 44
 45        /// <summary>
 46        /// Authenticates the specified session.
 47        /// </summary>
 48        /// <param name="session">The session to authenticate.</param>
 49        /// <returns>
 50        /// The result of the authentication process.
 51        /// </returns>
 52        public abstract AuthenticationResult Authenticate(Session session);
 53
 54        /// <summary>
 55        /// Authenticates the specified session.
 56        /// </summary>
 57        /// <param name="session">The session to authenticate.</param>
 58        /// <returns>
 59        /// The result of the authentication process.
 60        /// </returns>
 61        AuthenticationResult IAuthenticationMethod.Authenticate(ISession session)
 241162        {
 241163            return Authenticate((Session) session);
 241064        }
 65    }
 66}