# < 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

Method | Branch coverage | Cyclomatic complexity | Line coverage
--- | --- | --- | ---
get_Username() | 100% | 1 | 100%
get_AllowedAuthentications() | 100% | 1 | 100%
.ctor(...) | 100% | 2 | 100%
Renci.SshNet.IAuthenticationMethod.Authenticate(...) | 100% | 1 | 100%

# File(s)

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

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | ``
|  | `3` |  | `namespace 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>`
| 8111 | `23` |  | `public string Username { get; private set; }`
|  | `24` |  | ``
|  | `25` |  | `/// <summary>`
|  | `26` |  | `/// Gets or sets the list of allowed authentications.`
|  | `27` |  | `/// </summary>`
| 2435 | `28` |  | `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`
| 4077 | `35` |  | `protected AuthenticationMethod(string username)`
| 4077 | `36` |  | `{`
| 4077 | `37` |  | `if (string.IsNullOrWhiteSpace(username))`
| 30 | `38` |  | `{`
| 30 | `39` |  | `throw new ArgumentException("username");`
|  | `40` |  | `}`
|  | `41` |  | ``
| 4047 | `42` |  | `Username = username;`
| 4047 | `43` |  | `}`
|  | `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)`
| 2411 | `62` |  | `{`
| 2411 | `63` |  | `return Authenticate((Session) session);`
| 2410 | `64` |  | `}`
|  | `65` |  | `}`
|  | `66` |  | `}`

# Methods/Properties

get_Username()
get_AllowedAuthentications()
.ctor(System.String)
Renci.SshNet.IAuthenticationMethod.Authenticate(Renci.SshNet.ISession)