jueves, agosto 28, 2008

Firebird Windows Authentication

Most of the applications I write that use Firebird are Client/Server applications storing the user name and password to access the database in the connection string in the client machine.

Now with Firebird 2.1 you can use windows authentication so the client will use the windows user to log on to the server. This way I don't need to store the user name and password on the connection string in the client.

MS SQL Server has this feature for long time now. but it's great to have it on Firebird too.

Using Delphi or C++ Builder with DbExpress to accesss firebird in the dbconnections.ini file I just leave blank the user_name and password values, so I could have something like this:

[MyFirebirdDatabase]
DriverName=INTERBASE
GETDRIVERFUNC=getSQLDriverINTERBASE
DATABASE=Server:Database
PASSWORD=
USER_NAME=
SQLDIALECT=3

Using the Firebird .Net Data Provider the connection string will end up like this:
Database=MyDatabase.fdb;DataSource=MyServer;Dialect=3;

If the windows user is an administrator it will log in to the server as the SYSADMIN user. if the user is not an admin then the user will log in as the windows user.

Now I only have to add the windows users as database users and Windows will take care of authenticate them.

4 comentarios:

  1. Because the FirebirdClient is native implementation (it's not using fbclient) just omitting username and password will not work. When using WinAuth the process is different internally.

    ResponderEliminar
  2. I test the connection string for the .net provider and It work just omitting username and password.

    I tested with the client and server in the same machine.

    Thanks for the feedback

    ResponderEliminar
  3. It is possible trusted login with Delphi IBX (XE2)? Pavel

    ResponderEliminar