< Summary

Information
Class: Renci.SshNet.ConnectionInfo
Assembly: Renci.SshNet
File(s): \home\appveyor\projects\ssh-net\src\Renci.SshNet\ConnectionInfo.cs
Line coverage
90%
Covered lines: 157
Uncovered lines: 17
Coverable lines: 174
Total lines: 499
Line coverage: 90.2%
Branch coverage
90%
Covered branches: 29
Total branches: 32
Branch coverage: 90.6%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

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

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Net;
 5using System.Security.Cryptography;
 6using System.Text;
 7
 8using Renci.SshNet.Abstractions;
 9using Renci.SshNet.Common;
 10using Renci.SshNet.Messages.Authentication;
 11using Renci.SshNet.Messages.Connection;
 12using Renci.SshNet.Security;
 13using Renci.SshNet.Security.Cryptography;
 14using Renci.SshNet.Security.Cryptography.Ciphers;
 15using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
 16
 17namespace Renci.SshNet
 18{
 19    /// <summary>
 20    /// Represents remote connection information class.
 21    /// </summary>
 22    /// <remarks>
 23    /// This class is NOT thread-safe. Do not use the same <see cref="ConnectionInfo"/> with multiple
 24    /// client instances.
 25    /// </remarks>
 26    public class ConnectionInfo : IConnectionInfoInternal
 27    {
 28        internal const int DefaultPort = 22;
 29
 30        /// <summary>
 31        /// The default connection timeout.
 32        /// </summary>
 33        /// <value>
 34        /// 30 seconds.
 35        /// </value>
 436        private static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(30);
 37
 38        /// <summary>
 39        /// The default channel close timeout.
 40        /// </summary>
 41        /// <value>
 42        /// 1 second.
 43        /// </value>
 444        private static readonly TimeSpan DefaultChannelCloseTimeout = TimeSpan.FromSeconds(1);
 45
 46        /// <summary>
 47        /// Gets supported key exchange algorithms for this connection.
 48        /// </summary>
 715549        public IDictionary<string, Type> KeyExchangeAlgorithms { get; private set; }
 50
 51        /// <summary>
 52        /// Gets supported encryptions for this connection.
 53        /// </summary>
 999854        public IDictionary<string, CipherInfo> Encryptions { get; private set; }
 55
 56        /// <summary>
 57        /// Gets supported hash algorithms for this connection.
 58        /// </summary>
 999859        public IDictionary<string, HashInfo> HmacAlgorithms { get; private set; }
 60
 61        /// <summary>
 62        /// Gets supported host key algorithms for this connection.
 63        /// </summary>
 520264        public IDictionary<string, Func<byte[], KeyHostAlgorithm>> HostKeyAlgorithms { get; private set; }
 65
 66        /// <summary>
 67        /// Gets supported authentication methods for this connection.
 68        /// </summary>
 461169        public IList<AuthenticationMethod> AuthenticationMethods { get; private set; }
 70
 71        /// <summary>
 72        /// Gets supported compression algorithms for this connection.
 73        /// </summary>
 999874        public IDictionary<string, Type> CompressionAlgorithms { get; private set; }
 75
 76        /// <summary>
 77        /// Gets the supported channel requests for this connection.
 78        /// </summary>
 79        /// <value>
 80        /// The supported channel requests for this connection.
 81        /// </value>
 450282        public IDictionary<string, RequestInfo> ChannelRequests { get; private set; }
 83
 84        /// <summary>
 85        /// Gets a value indicating whether connection is authenticated.
 86        /// </summary>
 87        /// <value>
 88        /// <see langword="true"/> if connection is authenticated; otherwise, <see langword="false"/>.
 89        /// </value>
 365890        public bool IsAuthenticated { get; private set; }
 91
 92        /// <summary>
 93        /// Gets connection host.
 94        /// </summary>
 95        /// <value>
 96        /// The connection host.
 97        /// </value>
 511798        public string Host { get; private set; }
 99
 100        /// <summary>
 101        /// Gets connection port.
 102        /// </summary>
 103        /// <value>
 104        /// The connection port. The default value is 22.
 105        /// </value>
 5203106        public int Port { get; private set; }
 107
 108        /// <summary>
 109        /// Gets connection username.
 110        /// </summary>
 5830111        public string Username { get; private set; }
 112
 113        /// <summary>
 114        /// Gets proxy type.
 115        /// </summary>
 116        /// <value>
 117        /// The type of the proxy.
 118        /// </value>
 4015119        public ProxyTypes ProxyType { get; private set; }
 120
 121        /// <summary>
 122        /// Gets proxy connection host.
 123        /// </summary>
 3230124        public string ProxyHost { get; private set; }
 125
 126        /// <summary>
 127        /// Gets proxy connection port.
 128        /// </summary>
 3575129        public int ProxyPort { get; private set; }
 130
 131        /// <summary>
 132        /// Gets proxy connection username.
 133        /// </summary>
 3344134        public string ProxyUsername { get; private set; }
 135
 136        /// <summary>
 137        /// Gets proxy connection password.
 138        /// </summary>
 3080139        public string ProxyPassword { get; private set; }
 140
 141        /// <summary>
 142        /// Gets or sets connection timeout.
 143        /// </summary>
 144        /// <value>
 145        /// The connection timeout. The default value is 30 seconds.
 146        /// </value>
 147        /// <example>
 148        ///   <code source="..\..\src\Renci.SshNet.Tests\Classes\SshClientTest.cs" region="Example SshClient Connect Tim
 149        /// </example>
 21306150        public TimeSpan Timeout { get; set; }
 151
 152        /// <summary>
 153        /// Gets or sets the timeout to use when waiting for a server to acknowledge closing a channel.
 154        /// </summary>
 155        /// <value>
 156        /// The channel close timeout. The default value is 1 second.
 157        /// </value>
 158        /// <remarks>
 159        /// If a server does not send a <c>SSH_MSG_CHANNEL_CLOSE</c> message before the specified timeout
 160        /// elapses, the channel will be closed immediately.
 161        /// </remarks>
 4506162        public TimeSpan ChannelCloseTimeout { get; set; }
 163
 164        /// <summary>
 165        /// Gets or sets the character encoding.
 166        /// </summary>
 167        /// <value>
 168        /// The character encoding. The default is <see cref="Encoding.UTF8"/>.
 169        /// </value>
 6841170        public Encoding Encoding { get; set; }
 171
 172        /// <summary>
 173        /// Gets or sets number of retry attempts when session channel creation failed.
 174        /// </summary>
 175        /// <value>
 176        /// The number of retry attempts when session channel creation failed. The default
 177        /// value is 10.
 178        /// </value>
 4561179        public int RetryAttempts { get; set; }
 180
 181        /// <summary>
 182        /// Gets or sets maximum number of session channels to be open simultaneously.
 183        /// </summary>
 184        /// <value>
 185        /// The maximum number of session channels to be open simultaneously. The default
 186        /// value is 10.
 187        /// </value>
 3958188        public int MaxSessions { get; set; }
 189
 190        /// <summary>
 191        /// Occurs when authentication banner is sent by the server.
 192        /// </summary>
 193        /// <example>
 194        ///     <code source="..\..\src\Renci.SshNet.Tests\Classes\PasswordConnectionInfoTest.cs" region="Example Passwo
 195        /// </example>
 196        public event EventHandler<AuthenticationBannerEventArgs> AuthenticationBanner;
 197
 198        /// <summary>
 199        /// Gets the current key exchange algorithm.
 200        /// </summary>
 3629201        public string CurrentKeyExchangeAlgorithm { get; internal set; }
 202
 203        /// <summary>
 204        /// Gets the current server encryption.
 205        /// </summary>
 2397206        public string CurrentServerEncryption { get; internal set; }
 207
 208        /// <summary>
 209        /// Gets the current client encryption.
 210        /// </summary>
 2397211        public string CurrentClientEncryption { get; internal set; }
 212
 213        /// <summary>
 214        /// Gets the current server hash algorithm.
 215        /// </summary>
 2397216        public string CurrentServerHmacAlgorithm { get; internal set; }
 217
 218        /// <summary>
 219        /// Gets the current client hash algorithm.
 220        /// </summary>
 2397221        public string CurrentClientHmacAlgorithm { get; internal set; }
 222
 223        /// <summary>
 224        /// Gets the current host key algorithm.
 225        /// </summary>
 1199226        public string CurrentHostKeyAlgorithm { get; internal set; }
 227
 228        /// <summary>
 229        /// Gets the current server compression algorithm.
 230        /// </summary>
 1199231        public string CurrentServerCompressionAlgorithm { get; internal set; }
 232
 233        /// <summary>
 234        /// Gets the server version.
 235        /// </summary>
 1817236        public string ServerVersion { get; internal set; }
 237
 238        /// <summary>
 239        /// Gets the client version.
 240        /// </summary>
 1817241        public string ClientVersion { get; internal set; }
 242
 243        /// <summary>
 244        /// Gets the current client compression algorithm.
 245        /// </summary>
 1199246        public string CurrentClientCompressionAlgorithm { get; internal set; }
 247
 248        /// <summary>
 249        /// Initializes a new instance of the <see cref="ConnectionInfo"/> class.
 250        /// </summary>
 251        /// <param name="host">The host.</param>
 252        /// <param name="username">The username.</param>
 253        /// <param name="authenticationMethods">The authentication methods.</param>
 254        /// <exception cref="ArgumentNullException"><paramref name="host"/> is <see langword="null"/>.</exception>
 255        /// <exception cref="ArgumentException"><paramref name="host"/> is a zero-length string.</exception>
 256        /// <exception cref="ArgumentException"><paramref name="username" /> is <see langword="null"/>, a zero-length st
 257        /// <exception cref="ArgumentNullException"><paramref name="authenticationMethods"/> is <see langword="null"/>.<
 258        /// <exception cref="ArgumentException">No <paramref name="authenticationMethods"/> specified.</exception>
 259        public ConnectionInfo(string host, string username, params AuthenticationMethod[] authenticationMethods)
 429260            : this(host, DefaultPort, username, ProxyTypes.None, proxyHost: null, 0, proxyUsername: null, proxyPassword:
 429261        {
 429262        }
 263
 264        /// <summary>
 265        /// Initializes a new instance of the <see cref="ConnectionInfo"/> class.
 266        /// </summary>
 267        /// <param name="host">The host.</param>
 268        /// <param name="port">The port.</param>
 269        /// <param name="username">The username.</param>
 270        /// <param name="authenticationMethods">The authentication methods.</param>
 271        /// <exception cref="ArgumentNullException"><paramref name="host"/> is <see langword="null"/>.</exception>
 272        /// <exception cref="ArgumentException"><paramref name="username" /> is <see langword="null"/>, a zero-length st
 273        /// <exception cref="ArgumentOutOfRangeException"><paramref name="port" /> is not within <see cref="IPEndPoint.M
 274        /// <exception cref="ArgumentNullException"><paramref name="authenticationMethods"/> is <see langword="null"/>.<
 275        /// <exception cref="ArgumentException">No <paramref name="authenticationMethods"/> specified.</exception>
 276        public ConnectionInfo(string host, int port, string username, params AuthenticationMethod[] authenticationMethod
 1675277            : this(host, port, username, ProxyTypes.None, proxyHost: null, 0, proxyUsername: null, proxyPassword: null, 
 1675278        {
 1675279        }
 280
 281        /// <summary>
 282        /// Initializes a new instance of the <see cref="ConnectionInfo" /> class.
 283        /// </summary>
 284        /// <param name="host">Connection host.</param>
 285        /// <param name="port">Connection port.</param>
 286        /// <param name="username">Connection username.</param>
 287        /// <param name="proxyType">Type of the proxy.</param>
 288        /// <param name="proxyHost">The proxy host.</param>
 289        /// <param name="proxyPort">The proxy port.</param>
 290        /// <param name="proxyUsername">The proxy username.</param>
 291        /// <param name="proxyPassword">The proxy password.</param>
 292        /// <param name="authenticationMethods">The authentication methods.</param>
 293        /// <exception cref="ArgumentNullException"><paramref name="host"/> is <see langword="null"/>.</exception>
 294        /// <exception cref="ArgumentException"><paramref name="username" /> is <see langword="null"/>, a zero-length st
 295        /// <exception cref="ArgumentOutOfRangeException"><paramref name="port" /> is not within <see cref="IPEndPoint.M
 296        /// <exception cref="ArgumentNullException"><paramref name="proxyType"/> is not <see cref="ProxyTypes.None"/> an
 297        /// <exception cref="ArgumentOutOfRangeException"><paramref name="proxyType"/> is not <see cref="ProxyTypes.None
 298        /// <exception cref="ArgumentNullException"><paramref name="authenticationMethods"/> is <see langword="null"/>.<
 299        /// <exception cref="ArgumentException">No <paramref name="authenticationMethods"/> specified.</exception>
 2846300        public ConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyP
 2846301        {
 2846302            if (host is null)
 6303            {
 6304                throw new ArgumentNullException(nameof(host));
 305            }
 306
 2840307            port.ValidatePort("port");
 308
 2828309            if (username is null)
 3310            {
 3311                throw new ArgumentNullException(nameof(username));
 312            }
 313
 2825314            if (username.All(char.IsWhiteSpace))
 6315            {
 6316                throw new ArgumentException("Cannot be empty or contain only whitespace.", nameof(username));
 317            }
 318
 2819319            if (proxyType != ProxyTypes.None)
 435320            {
 435321                if (proxyHost is null)
 3322                {
 3323                    throw new ArgumentNullException(nameof(proxyHost));
 324                }
 325
 432326                proxyPort.ValidatePort("proxyPort");
 426327            }
 328
 2810329            if (authenticationMethods is null)
 3330            {
 3331                throw new ArgumentNullException(nameof(authenticationMethods));
 332            }
 333
 2807334            if (authenticationMethods.Length == 0)
 3335            {
 3336                throw new ArgumentException("At least one authentication method should be specified.", nameof(authentica
 337            }
 338
 339            // Set default connection values
 2804340            Timeout = DefaultTimeout;
 2804341            ChannelCloseTimeout = DefaultChannelCloseTimeout;
 2804342            RetryAttempts = 10;
 2804343            MaxSessions = 10;
 2804344            Encoding = Encoding.UTF8;
 345
 2804346            KeyExchangeAlgorithms = new Dictionary<string, Type>
 2804347                {
 2804348                    { "curve25519-sha256", typeof(KeyExchangeECCurve25519) },
 2804349                    { "curve25519-sha256@libssh.org", typeof(KeyExchangeECCurve25519) },
 2804350                    { "ecdh-sha2-nistp256", typeof(KeyExchangeECDH256) },
 2804351                    { "ecdh-sha2-nistp384", typeof(KeyExchangeECDH384) },
 2804352                    { "ecdh-sha2-nistp521", typeof(KeyExchangeECDH521) },
 2804353                    { "diffie-hellman-group-exchange-sha256", typeof(KeyExchangeDiffieHellmanGroupExchangeSha256) },
 2804354                    { "diffie-hellman-group-exchange-sha1", typeof(KeyExchangeDiffieHellmanGroupExchangeSha1) },
 2804355                    { "diffie-hellman-group16-sha512", typeof(KeyExchangeDiffieHellmanGroup16Sha512) },
 2804356                    { "diffie-hellman-group14-sha256", typeof(KeyExchangeDiffieHellmanGroup14Sha256) },
 2804357                    { "diffie-hellman-group14-sha1", typeof(KeyExchangeDiffieHellmanGroup14Sha1) },
 2804358                    { "diffie-hellman-group1-sha1", typeof(KeyExchangeDiffieHellmanGroup1Sha1) },
 2804359                };
 360
 2804361            Encryptions = new Dictionary<string, CipherInfo>
 2804362                {
 2360363                    { "aes128-ctr", new CipherInfo(128, (key, iv) => new AesCipher(key, iv, AesCipherMode.CTR, pkcs7Padd
 6364                    { "aes192-ctr", new CipherInfo(192, (key, iv) => new AesCipher(key, iv, AesCipherMode.CTR, pkcs7Padd
 6365                    { "aes256-ctr", new CipherInfo(256, (key, iv) => new AesCipher(key, iv, AesCipherMode.CTR, pkcs7Padd
 6366                    { "aes128-cbc", new CipherInfo(128, (key, iv) => new AesCipher(key, iv, AesCipherMode.CBC, pkcs7Padd
 6367                    { "aes192-cbc", new CipherInfo(192, (key, iv) => new AesCipher(key, iv, AesCipherMode.CBC, pkcs7Padd
 6368                    { "aes256-cbc", new CipherInfo(256, (key, iv) => new AesCipher(key, iv, AesCipherMode.CBC, pkcs7Padd
 6369                    { "3des-cbc", new CipherInfo(192, (key, iv) => new TripleDesCipher(key, new CbcCipherMode(iv), paddi
 0370                    { "blowfish-cbc", new CipherInfo(128, (key, iv) => new BlowfishCipher(key, new CbcCipherMode(iv), pa
 0371                    { "twofish-cbc", new CipherInfo(256, (key, iv) => new TwofishCipher(key, new CbcCipherMode(iv), padd
 0372                    { "twofish192-cbc", new CipherInfo(192, (key, iv) => new TwofishCipher(key, new CbcCipherMode(iv), p
 0373                    { "twofish128-cbc", new CipherInfo(128, (key, iv) => new TwofishCipher(key, new CbcCipherMode(iv), p
 0374                    { "twofish256-cbc", new CipherInfo(256, (key, iv) => new TwofishCipher(key, new CbcCipherMode(iv), p
 0375                    { "arcfour", new CipherInfo(128, (key, iv) => new Arc4Cipher(key, dischargeFirstBytes: false)) },
 0376                    { "arcfour128", new CipherInfo(128, (key, iv) => new Arc4Cipher(key, dischargeFirstBytes: true)) },
 0377                    { "arcfour256", new CipherInfo(256, (key, iv) => new Arc4Cipher(key, dischargeFirstBytes: true)) },
 0378                    { "cast128-cbc", new CipherInfo(128, (key, iv) => new CastCipher(key, new CbcCipherMode(iv), padding
 2804379                };
 380
 2804381            HmacAlgorithms = new Dictionary<string, HashInfo>
 2804382                {
 2804383                    { "hmac-md5", new HashInfo(16*8, CryptoAbstraction.CreateHMACMD5) },
 6384                    { "hmac-md5-96", new HashInfo(16*8, key => CryptoAbstraction.CreateHMACMD5(key, 96)) },
 2804385                    { "hmac-sha1", new HashInfo(20*8, CryptoAbstraction.CreateHMACSHA1) },
 6386                    { "hmac-sha1-96", new HashInfo(20*8, key => CryptoAbstraction.CreateHMACSHA1(key, 96)) },
 2804387                    { "hmac-sha2-256", new HashInfo(32*8, CryptoAbstraction.CreateHMACSHA256) },
 0388                    { "hmac-sha2-256-96", new HashInfo(32*8, key => CryptoAbstraction.CreateHMACSHA256(key, 96)) },
 2804389                    { "hmac-sha2-512", new HashInfo(64 * 8, CryptoAbstraction.CreateHMACSHA512) },
 0390                    { "hmac-sha2-512-96", new HashInfo(64 * 8,  key => CryptoAbstraction.CreateHMACSHA512(key, 96)) },
 2804391                    { "hmac-ripemd160", new HashInfo(160, CryptoAbstraction.CreateHMACRIPEMD160) },
 2804392                    { "hmac-ripemd160@openssh.com", new HashInfo(160, CryptoAbstraction.CreateHMACRIPEMD160) },
 2804393                };
 394
 2804395            HostKeyAlgorithms = new Dictionary<string, Func<byte[], KeyHostAlgorithm>>
 2804396                {
 3397                    { "ssh-ed25519", data => new KeyHostAlgorithm("ssh-ed25519", new ED25519Key(), data) },
 0398                    { "ecdsa-sha2-nistp256", data => new KeyHostAlgorithm("ecdsa-sha2-nistp256", new EcdsaKey(), data) }
 0399                    { "ecdsa-sha2-nistp384", data => new KeyHostAlgorithm("ecdsa-sha2-nistp384", new EcdsaKey(), data) }
 0400                    { "ecdsa-sha2-nistp521", data => new KeyHostAlgorithm("ecdsa-sha2-nistp521", new EcdsaKey(), data) }
 2804401#pragma warning disable SA1107 // Code should not contain multiple statements on one line
 4748402                    { "rsa-sha2-512", data => { var key = new RsaKey(); return new KeyHostAlgorithm("rsa-sha2-512", key,
 12403                    { "rsa-sha2-256", data => { var key = new RsaKey(); return new KeyHostAlgorithm("rsa-sha2-256", key,
 2804404#pragma warning restore SA1107 // Code should not contain multiple statements on one line
 3405                    { "ssh-rsa", data => new KeyHostAlgorithm("ssh-rsa", new RsaKey(), data) },
 3406                    { "ssh-dss", data => new KeyHostAlgorithm("ssh-dss", new DsaKey(), data) },
 2804407                };
 408
 2804409            CompressionAlgorithms = new Dictionary<string, Type>
 2804410                {
 2804411                    { "none", null },
 2804412                };
 413
 2804414            ChannelRequests = new Dictionary<string, RequestInfo>
 2804415                {
 2804416                    { EnvironmentVariableRequestInfo.Name, new EnvironmentVariableRequestInfo() },
 2804417                    { ExecRequestInfo.Name, new ExecRequestInfo() },
 2804418                    { ExitSignalRequestInfo.Name, new ExitSignalRequestInfo() },
 2804419                    { ExitStatusRequestInfo.Name, new ExitStatusRequestInfo() },
 2804420                    { PseudoTerminalRequestInfo.Name, new PseudoTerminalRequestInfo() },
 2804421                    { ShellRequestInfo.Name, new ShellRequestInfo() },
 2804422                    { SignalRequestInfo.Name, new SignalRequestInfo() },
 2804423                    { SubsystemRequestInfo.Name, new SubsystemRequestInfo() },
 2804424                    { WindowChangeRequestInfo.Name, new WindowChangeRequestInfo() },
 2804425                    { X11ForwardingRequestInfo.Name, new X11ForwardingRequestInfo() },
 2804426                    { XonXoffRequestInfo.Name, new XonXoffRequestInfo() },
 2804427                    { EndOfWriteRequestInfo.Name, new EndOfWriteRequestInfo() },
 2804428                    { KeepAliveRequestInfo.Name, new KeepAliveRequestInfo() },
 2804429                };
 430
 2804431            Host = host;
 2804432            Port = port;
 2804433            Username = username;
 434
 2804435            ProxyType = proxyType;
 2804436            ProxyHost = proxyHost;
 2804437            ProxyPort = proxyPort;
 2804438            ProxyUsername = proxyUsername;
 2804439            ProxyPassword = proxyPassword;
 440
 2804441            AuthenticationMethods = authenticationMethods;
 2804442        }
 443
 444        /// <summary>
 445        /// Authenticates the specified session.
 446        /// </summary>
 447        /// <param name="session">The session to be authenticated.</param>
 448        /// <param name="serviceFactory">The factory to use for creating new services.</param>
 449        /// <exception cref="ArgumentNullException"><paramref name="session"/> is <see langword="null"/>.</exception>
 450        /// <exception cref="ArgumentNullException"><paramref name="serviceFactory"/> is <see langword="null"/>.</except
 451        /// <exception cref="SshAuthenticationException">No suitable authentication method found to complete authenticat
 452        internal void Authenticate(ISession session, IServiceFactory serviceFactory)
 1837453        {
 1837454            if (serviceFactory is null)
 3455            {
 3456                throw new ArgumentNullException(nameof(serviceFactory));
 457            }
 458
 1834459            IsAuthenticated = false;
 1834460            var clientAuthentication = serviceFactory.CreateClientAuthentication();
 1834461            clientAuthentication.Authenticate(this, session);
 1818462            IsAuthenticated = true;
 1818463        }
 464
 465        /// <summary>
 466        /// Signals that an authentication banner message was received from the server.
 467        /// </summary>
 468        /// <param name="sender">The session in which the banner message was received.</param>
 469        /// <param name="e">The banner message.</param>
 470        void IConnectionInfoInternal.UserAuthenticationBannerReceived(object sender, MessageEventArgs<BannerMessage> e)
 0471        {
 0472            AuthenticationBanner?.Invoke(this, new AuthenticationBannerEventArgs(Username, e.Message.Message, e.Message.
 0473        }
 474
 475        /// <summary>
 476        /// Creates a <c>none</c> authentication method.
 477        /// </summary>
 478        /// <returns>
 479        /// A <c>none</c> authentication method.
 480        /// </returns>
 481        IAuthenticationMethod IConnectionInfoInternal.CreateNoneAuthenticationMethod()
 1198482        {
 1198483            return new NoneAuthenticationMethod(Username);
 1198484        }
 485
 486        /// <summary>
 487        /// Gets the supported authentication methods for this connection.
 488        /// </summary>
 489        /// <value>
 490        /// The supported authentication methods for this connection.
 491        /// </value>
 492        IList<IAuthenticationMethod> IConnectionInfoInternal.AuthenticationMethods
 493        {
 494#pragma warning disable S2365 // Properties should not make collection or array copies
 3591495            get { return AuthenticationMethods.Cast<IAuthenticationMethod>().ToList(); }
 496#pragma warning restore S2365 // Properties should not make collection or array copies
 497        }
 498    }
 499}