I am currently working on the application that uses SFTP. Our users are using FileZilla client to upload files that are stored in Azure Storage and then those files are processed by our api. Currently we found a bug when the file from user A was saved in the directory of the user B(it should not be there). I would like to simulate the process in which the user authenticate through filezilla in my local environment and then upload files. When I was debugging the code it always come to this point below, but I am not able to step into the code. I am assuming that if I log into the filezilla and click quickconnect it should automatically hit the breakpoint where user authenticate, but I was not able to do so. How do you debug this in your local environment. Think about this as a localhost in web development, how do I achieve the same functionality, I would like to just login and see what is inside that code.
server = new FileServer();
// I Want to step into this and see what is inside how to trigger this event???
server.Authentication += (sender, e) =>
{
MyDbUser myUser;
// try authenticating the user against a custom user database
if (MyUserDatabase.TryAuthenticate(
e.UserName, e.Password, out myUser))
{
// construct a user object
var user = new FileServerUser(myUser.UserName, null, myUser.VirtualRoot);
// accept authentication attempt with this user object
e.Accept(user);
}
else
{
// reject authentication attempt
e.Reject();
}
};
Ok so in order to step into that event you have to run the application in the local environment and when you start server choose sftp and target port 22. Then you have to allow inbound firewall rule for that port(dont forget to turn it off once you stop your debugging session). In filezilla you have to use 127.0.0.1 as a host, and then just put your username and password which will be validated against your custom authentication. This way you can run it in your local environment. As long as you hit quickconnect it will hit the breakpoint inside server.Authentication