ConnectionInfo.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Renci.SshNet.Abstractions;
  6. using Renci.SshNet.Security;
  7. using Renci.SshNet.Messages.Connection;
  8. using Renci.SshNet.Common;
  9. using Renci.SshNet.Messages.Authentication;
  10. using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
  11. using Renci.SshNet.Security.Cryptography.Ciphers;
  12. namespace Renci.SshNet
  13. {
  14. /// <summary>
  15. /// Represents remote connection information class.
  16. /// </summary>
  17. /// <remarks>
  18. /// This class is NOT thread-safe. Do not use the same <see cref="ConnectionInfo"/> with multiple
  19. /// client instances.
  20. /// </remarks>
  21. public class ConnectionInfo : IConnectionInfoInternal
  22. {
  23. internal static int DefaultPort = 22;
  24. /// <summary>
  25. /// The default connection timeout.
  26. /// </summary>
  27. /// <value>
  28. /// 30 seconds.
  29. /// </value>
  30. private static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(30);
  31. /// <summary>
  32. /// The default channel close timeout.
  33. /// </summary>
  34. /// <value>
  35. /// 1 second.
  36. /// </value>
  37. private static readonly TimeSpan DefaultChannelCloseTimeout = TimeSpan.FromSeconds(1);
  38. /// <summary>
  39. /// Gets supported key exchange algorithms for this connection.
  40. /// </summary>
  41. public IDictionary<string, Type> KeyExchangeAlgorithms { get; private set; }
  42. /// <summary>
  43. /// Gets supported encryptions for this connection.
  44. /// </summary>
  45. public IDictionary<string, CipherInfo> Encryptions { get; private set; }
  46. /// <summary>
  47. /// Gets supported hash algorithms for this connection.
  48. /// </summary>
  49. public IDictionary<string, HashInfo> HmacAlgorithms { get; private set; }
  50. /// <summary>
  51. /// Gets supported host key algorithms for this connection.
  52. /// </summary>
  53. public IDictionary<string, Func<byte[], KeyHostAlgorithm>> HostKeyAlgorithms { get; private set; }
  54. /// <summary>
  55. /// Gets supported authentication methods for this connection.
  56. /// </summary>
  57. public IList<AuthenticationMethod> AuthenticationMethods { get; private set; }
  58. /// <summary>
  59. /// Gets supported compression algorithms for this connection.
  60. /// </summary>
  61. public IDictionary<string, Type> CompressionAlgorithms { get; private set; }
  62. /// <summary>
  63. /// Gets the supported channel requests for this connection.
  64. /// </summary>
  65. /// <value>
  66. /// The supported channel requests for this connection.
  67. /// </value>
  68. public IDictionary<string, RequestInfo> ChannelRequests { get; private set; }
  69. /// <summary>
  70. /// Gets a value indicating whether connection is authenticated.
  71. /// </summary>
  72. /// <value>
  73. /// <c>true</c> if connection is authenticated; otherwise, <c>false</c>.
  74. /// </value>
  75. public bool IsAuthenticated { get; private set; }
  76. /// <summary>
  77. /// Gets connection host.
  78. /// </summary>
  79. public string Host { get; private set; }
  80. /// <summary>
  81. /// Gets connection port.
  82. /// </summary>
  83. /// <value>
  84. /// The connection port. The default value is 22.
  85. /// </value>
  86. public int Port { get; private set; }
  87. /// <summary>
  88. /// Gets connection username.
  89. /// </summary>
  90. public string Username { get; private set; }
  91. /// <summary>
  92. /// Gets proxy type.
  93. /// </summary>
  94. /// <value>
  95. /// The type of the proxy.
  96. /// </value>
  97. public ProxyTypes ProxyType { get; private set; }
  98. /// <summary>
  99. /// Gets proxy connection host.
  100. /// </summary>
  101. public string ProxyHost { get; private set; }
  102. /// <summary>
  103. /// Gets proxy connection port.
  104. /// </summary>
  105. public int ProxyPort { get; private set; }
  106. /// <summary>
  107. /// Gets proxy connection username.
  108. /// </summary>
  109. public string ProxyUsername { get; private set; }
  110. /// <summary>
  111. /// Gets proxy connection password.
  112. /// </summary>
  113. public string ProxyPassword { get; private set; }
  114. /// <summary>
  115. /// Gets or sets connection timeout.
  116. /// </summary>
  117. /// <value>
  118. /// The connection timeout. The default value is 30 seconds.
  119. /// </value>
  120. /// <example>
  121. /// <code source="..\..\src\Renci.SshNet.Tests\Classes\SshClientTest.cs" region="Example SshClient Connect Timeout" language="C#" title="Specify connection timeout" />
  122. /// </example>
  123. public TimeSpan Timeout { get; set; }
  124. /// <summary>
  125. /// Gets or sets the timeout to used when waiting for a server to acknowledge closing a channel.
  126. /// </summary>
  127. /// <value>
  128. /// The channel close timeout. The default value is 1 second.
  129. /// </value>
  130. /// <remarks>
  131. /// If a server does not send a <c>SSH2_MSG_CHANNEL_CLOSE</c> message before the specified timeout
  132. /// elapses, the channel will be closed immediately.
  133. /// </remarks>
  134. public TimeSpan ChannelCloseTimeout { get; set; }
  135. /// <summary>
  136. /// Gets or sets the character encoding.
  137. /// </summary>
  138. /// <value>
  139. /// The character encoding. The default is <see cref="System.Text.Encoding.UTF8"/>.
  140. /// </value>
  141. public Encoding Encoding { get; set; }
  142. /// <summary>
  143. /// Gets or sets number of retry attempts when session channel creation failed.
  144. /// </summary>
  145. /// <value>
  146. /// The number of retry attempts when session channel creation failed. The default
  147. /// value is 10.
  148. /// </value>
  149. public int RetryAttempts { get; set; }
  150. /// <summary>
  151. /// Gets or sets maximum number of session channels to be open simultaneously.
  152. /// </summary>
  153. /// <value>
  154. /// The maximum number of session channels to be open simultaneously. The default
  155. /// value is 10.
  156. /// </value>
  157. public int MaxSessions { get; set; }
  158. /// <summary>
  159. /// Occurs when authentication banner is sent by the server.
  160. /// </summary>
  161. /// <example>
  162. /// <code source="..\..\src\Renci.SshNet.Tests\Classes\PasswordConnectionInfoTest.cs" region="Example PasswordConnectionInfo AuthenticationBanner" language="C#" title="Display authentication banner" />
  163. /// </example>
  164. public event EventHandler<AuthenticationBannerEventArgs> AuthenticationBanner;
  165. /// <summary>
  166. /// Gets the current key exchange algorithm.
  167. /// </summary>
  168. public string CurrentKeyExchangeAlgorithm { get; internal set; }
  169. /// <summary>
  170. /// Gets the current server encryption.
  171. /// </summary>
  172. public string CurrentServerEncryption { get; internal set; }
  173. /// <summary>
  174. /// Gets the current client encryption.
  175. /// </summary>
  176. public string CurrentClientEncryption { get; internal set; }
  177. /// <summary>
  178. /// Gets the current server hash algorithm.
  179. /// </summary>
  180. public string CurrentServerHmacAlgorithm { get; internal set; }
  181. /// <summary>
  182. /// Gets the current client hash algorithm.
  183. /// </summary>
  184. public string CurrentClientHmacAlgorithm { get; internal set; }
  185. /// <summary>
  186. /// Gets the current host key algorithm.
  187. /// </summary>
  188. public string CurrentHostKeyAlgorithm { get; internal set; }
  189. /// <summary>
  190. /// Gets the current server compression algorithm.
  191. /// </summary>
  192. public string CurrentServerCompressionAlgorithm { get; internal set; }
  193. /// <summary>
  194. /// Gets the server version.
  195. /// </summary>
  196. public string ServerVersion { get; internal set; }
  197. /// <summary>
  198. /// Get the client version.
  199. /// </summary>
  200. public string ClientVersion { get; internal set; }
  201. /// <summary>
  202. /// Gets the current client compression algorithm.
  203. /// </summary>
  204. public string CurrentClientCompressionAlgorithm { get; internal set; }
  205. /// <summary>
  206. /// Initializes a new instance of the <see cref="ConnectionInfo"/> class.
  207. /// </summary>
  208. /// <param name="host">The host.</param>
  209. /// <param name="username">The username.</param>
  210. /// <param name="authenticationMethods">The authentication methods.</param>
  211. /// <exception cref="ArgumentNullException"><paramref name="host"/> is <c>null</c>.</exception>
  212. /// <exception cref="ArgumentException"><paramref name="host"/> is a zero-length string.</exception>
  213. /// <exception cref="ArgumentException"><paramref name="username" /> is <c>null</c>, a zero-length string or contains only whitespace characters.</exception>
  214. /// <exception cref="ArgumentNullException"><paramref name="authenticationMethods"/> is <c>null</c>.</exception>
  215. /// <exception cref="ArgumentException">No <paramref name="authenticationMethods"/> specified.</exception>
  216. public ConnectionInfo(string host, string username, params AuthenticationMethod[] authenticationMethods)
  217. : this(host, DefaultPort, username, ProxyTypes.None, null, 0, null, null, authenticationMethods)
  218. {
  219. }
  220. /// <summary>
  221. /// Initializes a new instance of the <see cref="ConnectionInfo"/> class.
  222. /// </summary>
  223. /// <param name="host">The host.</param>
  224. /// <param name="port">The port.</param>
  225. /// <param name="username">The username.</param>
  226. /// <param name="authenticationMethods">The authentication methods.</param>
  227. /// <exception cref="ArgumentNullException"><paramref name="host"/> is <c>null</c>.</exception>
  228. /// <exception cref="ArgumentException"><paramref name="username" /> is <c>null</c>, a zero-length string or contains only whitespace characters.</exception>
  229. /// <exception cref="ArgumentOutOfRangeException"><paramref name="port" /> is not within <see cref="F:System.Net.IPEndPoint.MinPort" /> and <see cref="F:System.Net.IPEndPoint.MaxPort" />.</exception>
  230. /// <exception cref="ArgumentNullException"><paramref name="authenticationMethods"/> is <c>null</c>.</exception>
  231. /// <exception cref="ArgumentException">No <paramref name="authenticationMethods"/> specified.</exception>
  232. public ConnectionInfo(string host, int port, string username, params AuthenticationMethod[] authenticationMethods)
  233. : this(host, port, username, ProxyTypes.None, null, 0, null, null, authenticationMethods)
  234. {
  235. }
  236. /// <summary>
  237. /// Initializes a new instance of the <see cref="ConnectionInfo" /> class.
  238. /// </summary>
  239. /// <param name="host">Connection host.</param>
  240. /// <param name="port">Connection port.</param>
  241. /// <param name="username">Connection username.</param>
  242. /// <param name="proxyType">Type of the proxy.</param>
  243. /// <param name="proxyHost">The proxy host.</param>
  244. /// <param name="proxyPort">The proxy port.</param>
  245. /// <param name="proxyUsername">The proxy username.</param>
  246. /// <param name="proxyPassword">The proxy password.</param>
  247. /// <param name="authenticationMethods">The authentication methods.</param>
  248. /// <exception cref="ArgumentNullException"><paramref name="host"/> is <c>null</c>.</exception>
  249. /// <exception cref="ArgumentException"><paramref name="username" /> is <c>null</c>, a zero-length string or contains only whitespace characters.</exception>
  250. /// <exception cref="ArgumentOutOfRangeException"><paramref name="port" /> is not within <see cref="F:System.Net.IPEndPoint.MinPort" /> and <see cref="F:System.Net.IPEndPoint.MaxPort" />.</exception>
  251. /// <exception cref="ArgumentNullException"><paramref name="proxyType"/> is not <see cref="ProxyTypes.None"/> and <paramref name="proxyHost" /> is <c>null</c>.</exception>
  252. /// <exception cref="ArgumentOutOfRangeException"><paramref name="proxyType"/> is not <see cref="ProxyTypes.None"/> and <paramref name="proxyPort" /> is not within <see cref="F:System.Net.IPEndPoint.MinPort" /> and <see cref="F:System.Net.IPEndPoint.MaxPort" />.</exception>
  253. /// <exception cref="ArgumentNullException"><paramref name="authenticationMethods"/> is <c>null</c>.</exception>
  254. /// <exception cref="ArgumentException">No <paramref name="authenticationMethods"/> specified.</exception>
  255. public ConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword, params AuthenticationMethod[] authenticationMethods)
  256. {
  257. if (host == null)
  258. throw new ArgumentNullException("host");
  259. port.ValidatePort("port");
  260. if (username == null)
  261. throw new ArgumentNullException("username");
  262. if (username.All(char.IsWhiteSpace))
  263. throw new ArgumentException("Cannot be empty or contain only whitespace.", "username");
  264. if (proxyType != ProxyTypes.None)
  265. {
  266. if (proxyHost == null)
  267. throw new ArgumentNullException("proxyHost");
  268. proxyPort.ValidatePort("proxyPort");
  269. }
  270. if (authenticationMethods == null)
  271. throw new ArgumentNullException("authenticationMethods");
  272. if (authenticationMethods.Length == 0)
  273. throw new ArgumentException("At least one authentication method should be specified.", "authenticationMethods");
  274. // Set default connection values
  275. Timeout = DefaultTimeout;
  276. ChannelCloseTimeout = DefaultChannelCloseTimeout;
  277. RetryAttempts = 10;
  278. MaxSessions = 10;
  279. Encoding = Encoding.UTF8;
  280. KeyExchangeAlgorithms = new Dictionary<string, Type>
  281. {
  282. {"curve25519-sha256", typeof(KeyExchangeECCurve25519)},
  283. {"curve25519-sha256@libssh.org", typeof(KeyExchangeECCurve25519)},
  284. {"ecdh-sha2-nistp256", typeof(KeyExchangeECDH256)},
  285. {"ecdh-sha2-nistp384", typeof(KeyExchangeECDH384)},
  286. {"ecdh-sha2-nistp521", typeof(KeyExchangeECDH521)},
  287. {"diffie-hellman-group-exchange-sha256", typeof (KeyExchangeDiffieHellmanGroupExchangeSha256)},
  288. {"diffie-hellman-group-exchange-sha1", typeof (KeyExchangeDiffieHellmanGroupExchangeSha1)},
  289. {"diffie-hellman-group14-sha1", typeof (KeyExchangeDiffieHellmanGroup14Sha1)},
  290. {"diffie-hellman-group1-sha1", typeof (KeyExchangeDiffieHellmanGroup1Sha1)},
  291. //"gss-group1-sha1-toWM5Slw5Ew8Mqkay+al2g==" - WinSSHD
  292. //"gss-gex-sha1-toWM5Slw5Ew8Mqkay+al2g==" - WinSSHD
  293. };
  294. Encryptions = new Dictionary<string, CipherInfo>
  295. {
  296. {"aes256-ctr", new CipherInfo(256, (key, iv) => new AesCipher(key, new CtrCipherMode(iv), null))},
  297. {"3des-cbc", new CipherInfo(192, (key, iv) => new TripleDesCipher(key, new CbcCipherMode(iv), null))},
  298. {"aes128-cbc", new CipherInfo(128, (key, iv) => new AesCipher(key, new CbcCipherMode(iv), null))},
  299. {"aes192-cbc", new CipherInfo(192, (key, iv) => new AesCipher(key, new CbcCipherMode(iv), null))},
  300. {"aes256-cbc", new CipherInfo(256, (key, iv) => new AesCipher(key, new CbcCipherMode(iv), null))},
  301. {"blowfish-cbc", new CipherInfo(128, (key, iv) => new BlowfishCipher(key, new CbcCipherMode(iv), null))},
  302. {"twofish-cbc", new CipherInfo(256, (key, iv) => new TwofishCipher(key, new CbcCipherMode(iv), null))},
  303. {"twofish192-cbc", new CipherInfo(192, (key, iv) => new TwofishCipher(key, new CbcCipherMode(iv), null))},
  304. {"twofish128-cbc", new CipherInfo(128, (key, iv) => new TwofishCipher(key, new CbcCipherMode(iv), null))},
  305. {"twofish256-cbc", new CipherInfo(256, (key, iv) => new TwofishCipher(key, new CbcCipherMode(iv), null))},
  306. ////{"serpent256-cbc", typeof(CipherSerpent256CBC)},
  307. ////{"serpent192-cbc", typeof(...)},
  308. ////{"serpent128-cbc", typeof(...)},
  309. {"arcfour", new CipherInfo(128, (key, iv) => new Arc4Cipher(key, false))},
  310. {"arcfour128", new CipherInfo(128, (key, iv) => new Arc4Cipher(key, true))},
  311. {"arcfour256", new CipherInfo(256, (key, iv) => new Arc4Cipher(key, true))},
  312. ////{"idea-cbc", typeof(...)},
  313. {"cast128-cbc", new CipherInfo(128, (key, iv) => new CastCipher(key, new CbcCipherMode(iv), null))},
  314. ////{"rijndael-cbc@lysator.liu.se", typeof(...)},
  315. {"aes128-ctr", new CipherInfo(128, (key, iv) => new AesCipher(key, new CtrCipherMode(iv), null))},
  316. {"aes192-ctr", new CipherInfo(192, (key, iv) => new AesCipher(key, new CtrCipherMode(iv), null))},
  317. };
  318. HmacAlgorithms = new Dictionary<string, HashInfo>
  319. {
  320. {"hmac-md5", new HashInfo(16*8, CryptoAbstraction.CreateHMACMD5)},
  321. {"hmac-md5-96", new HashInfo(16*8, key => CryptoAbstraction.CreateHMACMD5(key, 96))},
  322. {"hmac-sha1", new HashInfo(20*8, CryptoAbstraction.CreateHMACSHA1)},
  323. {"hmac-sha1-96", new HashInfo(20*8, key => CryptoAbstraction.CreateHMACSHA1(key, 96))},
  324. {"hmac-sha2-256", new HashInfo(32*8, CryptoAbstraction.CreateHMACSHA256)},
  325. {"hmac-sha2-256-96", new HashInfo(32*8, key => CryptoAbstraction.CreateHMACSHA256(key, 96))},
  326. {"hmac-sha2-512", new HashInfo(64 * 8, CryptoAbstraction.CreateHMACSHA512)},
  327. {"hmac-sha2-512-96", new HashInfo(64 * 8, key => CryptoAbstraction.CreateHMACSHA512(key, 96))},
  328. //{"umac-64@openssh.com", typeof(HMacSha1)},
  329. {"hmac-ripemd160", new HashInfo(160, CryptoAbstraction.CreateHMACRIPEMD160)},
  330. {"hmac-ripemd160@openssh.com", new HashInfo(160, CryptoAbstraction.CreateHMACRIPEMD160)},
  331. //{"none", typeof(...)},
  332. };
  333. HostKeyAlgorithms = new Dictionary<string, Func<byte[], KeyHostAlgorithm>>
  334. {
  335. {"ssh-ed25519", data => new KeyHostAlgorithm("ssh-ed25519", new ED25519Key(), data)},
  336. #if FEATURE_ECDSA
  337. {"ecdsa-sha2-nistp256", data => new KeyHostAlgorithm("ecdsa-sha2-nistp256", new EcdsaKey(), data)},
  338. {"ecdsa-sha2-nistp384", data => new KeyHostAlgorithm("ecdsa-sha2-nistp384", new EcdsaKey(), data)},
  339. {"ecdsa-sha2-nistp521", data => new KeyHostAlgorithm("ecdsa-sha2-nistp521", new EcdsaKey(), data)},
  340. #endif
  341. {"ssh-rsa", data => new KeyHostAlgorithm("ssh-rsa", new RsaKey(), data)},
  342. {"ssh-dss", data => new KeyHostAlgorithm("ssh-dss", new DsaKey(), data)},
  343. //{"x509v3-sign-rsa", () => { ... },
  344. //{"x509v3-sign-dss", () => { ... },
  345. //{"spki-sign-rsa", () => { ... },
  346. //{"spki-sign-dss", () => { ... },
  347. //{"pgp-sign-rsa", () => { ... },
  348. //{"pgp-sign-dss", () => { ... },
  349. };
  350. CompressionAlgorithms = new Dictionary<string, Type>
  351. {
  352. //{"zlib@openssh.com", typeof(ZlibOpenSsh)},
  353. //{"zlib", typeof(Zlib)},
  354. {"none", null},
  355. };
  356. ChannelRequests = new Dictionary<string, RequestInfo>
  357. {
  358. {EnvironmentVariableRequestInfo.Name, new EnvironmentVariableRequestInfo()},
  359. {ExecRequestInfo.Name, new ExecRequestInfo()},
  360. {ExitSignalRequestInfo.Name, new ExitSignalRequestInfo()},
  361. {ExitStatusRequestInfo.Name, new ExitStatusRequestInfo()},
  362. {PseudoTerminalRequestInfo.Name, new PseudoTerminalRequestInfo()},
  363. {ShellRequestInfo.Name, new ShellRequestInfo()},
  364. {SignalRequestInfo.Name, new SignalRequestInfo()},
  365. {SubsystemRequestInfo.Name, new SubsystemRequestInfo()},
  366. {WindowChangeRequestInfo.Name, new WindowChangeRequestInfo()},
  367. {X11ForwardingRequestInfo.Name, new X11ForwardingRequestInfo()},
  368. {XonXoffRequestInfo.Name, new XonXoffRequestInfo()},
  369. {EndOfWriteRequestInfo.Name, new EndOfWriteRequestInfo()},
  370. {KeepAliveRequestInfo.Name, new KeepAliveRequestInfo()},
  371. };
  372. Host = host;
  373. Port = port;
  374. Username = username;
  375. ProxyType = proxyType;
  376. ProxyHost = proxyHost;
  377. ProxyPort = proxyPort;
  378. ProxyUsername = proxyUsername;
  379. ProxyPassword = proxyPassword;
  380. AuthenticationMethods = authenticationMethods;
  381. }
  382. /// <summary>
  383. /// Authenticates the specified session.
  384. /// </summary>
  385. /// <param name="session">The session to be authenticated.</param>
  386. /// <param name="serviceFactory">The factory to use for creating new services.</param>
  387. /// <exception cref="ArgumentNullException"><paramref name="session"/> is <c>null</c>.</exception>
  388. /// <exception cref="ArgumentNullException"><paramref name="serviceFactory"/> is <c>null</c>.</exception>
  389. /// <exception cref="SshAuthenticationException">No suitable authentication method found to complete authentication, or permission denied.</exception>
  390. internal void Authenticate(ISession session, IServiceFactory serviceFactory)
  391. {
  392. if (serviceFactory == null)
  393. throw new ArgumentNullException("serviceFactory");
  394. IsAuthenticated = false;
  395. var clientAuthentication = serviceFactory.CreateClientAuthentication();
  396. clientAuthentication.Authenticate(this, session);
  397. IsAuthenticated = true;
  398. }
  399. /// <summary>
  400. /// Signals that an authentication banner message was received from the server.
  401. /// </summary>
  402. /// <param name="sender">The session in which the banner message was received.</param>
  403. /// <param name="e">The banner message.{</param>
  404. void IConnectionInfoInternal.UserAuthenticationBannerReceived(object sender, MessageEventArgs<BannerMessage> e)
  405. {
  406. var authenticationBanner = AuthenticationBanner;
  407. if (authenticationBanner != null)
  408. {
  409. authenticationBanner(this,
  410. new AuthenticationBannerEventArgs(Username, e.Message.Message, e.Message.Language));
  411. }
  412. }
  413. IAuthenticationMethod IConnectionInfoInternal.CreateNoneAuthenticationMethod()
  414. {
  415. return new NoneAuthenticationMethod(Username);
  416. }
  417. IList<IAuthenticationMethod> IConnectionInfoInternal.AuthenticationMethods
  418. {
  419. get { return AuthenticationMethods.Cast<IAuthenticationMethod>().ToList(); }
  420. }
  421. }
  422. }