diff --git a/Renci.SshClient/Renci.SshNet/AuthenticationMethod.cs b/Renci.SshClient/Renci.SshNet/AuthenticationMethod.cs
index ea5b7f9b..30999909 100644
--- a/Renci.SshClient/Renci.SshNet/AuthenticationMethod.cs
+++ b/Renci.SshClient/Renci.SshNet/AuthenticationMethod.cs
@@ -16,16 +16,6 @@ namespace Renci.SshNet
///
public abstract string Name { get; }
- ///
- /// Gets connection host.
- ///
- public string Host { get; private set; }
-
- ///
- /// Gets connection port.
- ///
- public int Port { get; private set; }
-
///
/// Gets connection username.
///
@@ -39,22 +29,12 @@ namespace Renci.SshNet
///
/// Initializes a new instance of the class.
///
- /// The host.
- /// The port.
/// The username.
- protected AuthenticationMethod(string host, int port, string username)
+ protected AuthenticationMethod(string username)
{
- if (!host.IsValidHost())
- throw new ArgumentException("host");
-
- if (!port.IsValidPort())
- throw new ArgumentOutOfRangeException("port");
-
if (username.IsNullOrWhiteSpace())
throw new ArgumentException("username");
- this.Host = host;
- this.Port = port;
this.Username = username;
}
diff --git a/Renci.SshClient/Renci.SshNet/ConnectionInfo.cs b/Renci.SshClient/Renci.SshNet/ConnectionInfo.cs
index df52b52b..4704f405 100644
--- a/Renci.SshClient/Renci.SshNet/ConnectionInfo.cs
+++ b/Renci.SshClient/Renci.SshNet/ConnectionInfo.cs
@@ -175,6 +175,29 @@ namespace Renci.SshNet
///
public string CurrentClientCompressionAlgorithm { get; internal set; }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The host.
+ /// The username.
+ /// The authentication methods.
+ public ConnectionInfo(string host, string username, params AuthenticationMethod[] authenticationMethods)
+ : this(host, 22, username, ProxyTypes.None, string.Empty, 0, string.Empty, string.Empty, authenticationMethods)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The host.
+ /// The port.
+ /// The username.
+ /// The authentication methods.
+ public ConnectionInfo(string host, int port, string username, params AuthenticationMethod[] authenticationMethods)
+ : this(host, port, username, ProxyTypes.None, string.Empty, 0, string.Empty, string.Empty, authenticationMethods)
+ {
+ }
+
///
/// Initializes a new instance of the class.
///
@@ -328,7 +351,7 @@ namespace Renci.SshNet
session.UserAuthenticationBannerReceived += Session_UserAuthenticationBannerReceived;
// Try to authenticate against none
- var noneAuthenticationMethod = new NoneAuthenticationMethod(this.Host, this.Port, this.Username);
+ var noneAuthenticationMethod = new NoneAuthenticationMethod(this.Username);
authenticated = noneAuthenticationMethod.Authenticate(session);
diff --git a/Renci.SshClient/Renci.SshNet/KeyboardInteractiveAuthenticationMethod.cs b/Renci.SshClient/Renci.SshNet/KeyboardInteractiveAuthenticationMethod.cs
index 15017563..e8d9d6de 100644
--- a/Renci.SshClient/Renci.SshNet/KeyboardInteractiveAuthenticationMethod.cs
+++ b/Renci.SshClient/Renci.SshNet/KeyboardInteractiveAuthenticationMethod.cs
@@ -43,8 +43,8 @@ namespace Renci.SshNet
/// The host.
/// The port.
/// The username.
- public KeyboardInteractiveAuthenticationMethod(string host, int port, string username)
- : base(host, port, username)
+ public KeyboardInteractiveAuthenticationMethod(string username)
+ : base(username)
{
this._requestMessage = new RequestMessageKeyboardInteractive(ServiceName.Connection, username);
}
diff --git a/Renci.SshClient/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs b/Renci.SshClient/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs
index 1b8f215e..5dd8803e 100644
--- a/Renci.SshClient/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs
+++ b/Renci.SshClient/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs
@@ -122,7 +122,7 @@ namespace Renci.SshNet
/// The proxy username.
/// The proxy password.
public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
- : base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new KeyboardInteractiveAuthenticationMethod(host, port, username))
+ : base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new KeyboardInteractiveAuthenticationMethod(username))
{
foreach (var authenticationMethod in this.AuthenticationMethods.OfType())
{
diff --git a/Renci.SshClient/Renci.SshNet/NoneAuthenticationMethod.cs b/Renci.SshClient/Renci.SshNet/NoneAuthenticationMethod.cs
index 30ace68f..655e1ecf 100644
--- a/Renci.SshClient/Renci.SshNet/NoneAuthenticationMethod.cs
+++ b/Renci.SshClient/Renci.SshNet/NoneAuthenticationMethod.cs
@@ -30,25 +30,14 @@ namespace Renci.SshNet
///
public IEnumerable AllowedAuthentications { get; private set; }
- ///
- /// Initializes a new instance of the class.
- ///
- /// The host.
- /// The username.
- public NoneAuthenticationMethod(string host, string username)
- : this(host, 22, username)
- {
-
- }
-
///
/// Initializes a new instance of the class.
///
/// The host.
/// The port.
/// The username.
- public NoneAuthenticationMethod(string host, int port, string username)
- : base(host, port, username)
+ public NoneAuthenticationMethod(string username)
+ : base(username)
{
}
diff --git a/Renci.SshClient/Renci.SshNet/PasswordAuthenticationMethod.cs b/Renci.SshClient/Renci.SshNet/PasswordAuthenticationMethod.cs
index b148e287..dab19cf1 100644
--- a/Renci.SshClient/Renci.SshNet/PasswordAuthenticationMethod.cs
+++ b/Renci.SshClient/Renci.SshNet/PasswordAuthenticationMethod.cs
@@ -46,8 +46,8 @@ namespace Renci.SshNet
/// The port.
/// The username.
/// The password.
- public PasswordAuthenticationMethod(string host, int port, string username, string password)
- : base(host, port, username)
+ public PasswordAuthenticationMethod(string username, string password)
+ : base(username)
{
if (password == null)
throw new ArgumentNullException("password");
diff --git a/Renci.SshClient/Renci.SshNet/PasswordConnectionInfo.cs b/Renci.SshClient/Renci.SshNet/PasswordConnectionInfo.cs
index db89da4c..021b580c 100644
--- a/Renci.SshClient/Renci.SshNet/PasswordConnectionInfo.cs
+++ b/Renci.SshClient/Renci.SshNet/PasswordConnectionInfo.cs
@@ -132,7 +132,7 @@ namespace Renci.SshNet
/// The proxy username.
/// The proxy password.
public PasswordConnectionInfo(string host, int port, string username, string password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
- : base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new PasswordAuthenticationMethod(host, port, username, password))
+ : base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new PasswordAuthenticationMethod(username, password))
{
foreach (var authenticationMethod in this.AuthenticationMethods.OfType())
{
diff --git a/Renci.SshClient/Renci.SshNet/PrivateKeyAuthenticationMethod.cs b/Renci.SshClient/Renci.SshNet/PrivateKeyAuthenticationMethod.cs
index 004503c6..306d3ad5 100644
--- a/Renci.SshClient/Renci.SshNet/PrivateKeyAuthenticationMethod.cs
+++ b/Renci.SshClient/Renci.SshNet/PrivateKeyAuthenticationMethod.cs
@@ -41,8 +41,8 @@ namespace Renci.SshNet
/// The port.
/// The username.
/// The key files.
- public PrivateKeyAuthenticationMethod(string host, int port, string username, params PrivateKeyFile[] keyFiles)
- : base(host, port, username)
+ public PrivateKeyAuthenticationMethod(string username, params PrivateKeyFile[] keyFiles)
+ : base(username)
{
this.KeyFiles = new Collection(keyFiles);
}
diff --git a/Renci.SshClient/Renci.SshNet/PrivateKeyConnectionInfo.cs b/Renci.SshClient/Renci.SshNet/PrivateKeyConnectionInfo.cs
index d0dd6dc3..5868a477 100644
--- a/Renci.SshClient/Renci.SshNet/PrivateKeyConnectionInfo.cs
+++ b/Renci.SshClient/Renci.SshNet/PrivateKeyConnectionInfo.cs
@@ -129,7 +129,7 @@ namespace Renci.SshNet
/// The proxy password.
/// The key files.
public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword, params PrivateKeyFile[] keyFiles)
- : base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new PrivateKeyAuthenticationMethod(host, port, username, keyFiles))
+ : base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new PrivateKeyAuthenticationMethod(username, keyFiles))
{
this.KeyFiles = new Collection(keyFiles);
}