Quantcast
Channel: Rebex Q&A Forum - Recent questions and answers
Viewing all articles
Browse latest Browse all 3862

Answered: Using SQL to store users for SFTP Server

$
0
0

Yes, this is possible with Rebex File Server component. Just implement your own custom authentication provider with the help of the Authentication event, e.g.:

// register authentication event handler 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();
    } };

In the above example you have to replace the MyUserDatabase.TryAuthenticate method with your own method that will will access your database and check whether user is allowed to authenticate or not based on the content of the database).


Viewing all articles
Browse latest Browse all 3862

Trending Articles