0 votes
by (120 points)

Can I use SQL to store users credentials ?


Applies to: File Server

1 Answer

0 votes
by (58.9k points)
edited by

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
        // reject authentication attempt
    } };

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).