简体   繁体   English

Firebird 2.5中的Windows身份验证

[英]Windows Authentication in Firebird 2.5

Can I login to firebird database using a Windows user instead of using SYSDBA and MASTERKEY credential? 我可以使用Windows用户而不是使用SYSDBA和MASTERKEY凭据登录firebird数据库吗? If Yes, please let me know the way to connect to the firebird database. 如果是,请告诉我连接firebird数据库的方法。

I am using Delphi XE3 and Firebird 2.5. 我正在使用Delphi XE3和Firebird 2.5。 I need to authenticate user by logged in user after updating config file for "trusted" in place of default "native" as specified here: https://firebirdsql.org/file/documentation/release_notes/html/en/2_5/rnfb25-fbconf-authent.html 我需要在更新“受信任”的配置文件后,通过登录用户验证用户,而不是默认的“native”,如下所示: https//firebirdsql.org/file/documentation/release_notes/html/en/2_5/rnfb25- fbconf-authent.html

This is my code : 这是我的代码:

SQLConnection1.LoginPrompt := False;
//SQLConnection1.Params.add('user_name='); 
//SQLConnection1.Params.add('password='); 
SQLConnection1.Params.add('os authentication=True') ; 
SQLConnection1.Connected:= True

It still asks for credentials. 它仍然要求提供证书。

(V.2.1) From Firebird 2.1 onward, Windows “Trusted User” security can be applied for authenticating Firebird users on a Windows host. (V.2.1)从Firebird 2.1开始,可以应用Windows“可信用户”安全性来验证Windows主机上的Firebird用户。 The Trusted User's security context is passed to the Firebird server and, if it succeeds, it is used to determine the Firebird security user name. 可信用户的安全上下文将传递给Firebird服务器,如果成功,则用于确定Firebird安全用户名。

Simply omitting the user and password parameters from the DPB/SPB will automatically cause Windows Trusted User authentication to be applied, in almost all cases. 在几乎所有情况下,只需从DPB / SPB中省略用户和密码参数,就会自动导致应用Windows受信任用户身份验证。 See the Environment section, below, for exceptions 有关例外情况,请参阅下面的“环境”部分

from official documentation 来自官方文件

Also, take a look at this question - https://dba.stackexchange.com/questions/154735/how-to-enable-windows-authentication-in-firebird-2-5 另外,看看这个问题 - https://dba.stackexchange.com/questions/154735/how-to-enable-windows-authentication-in-firebird-2-5

If User_Name parameter of the TSQLConnection object is not set (User_Name= ) , Windows Authentication connection mode is used. 如果未设置TSQLConnection对象的User_Name参数(User_Name= ) ,则使用Windows身份验证连接模式。

Also set Authentication = mixed or trusted in firebird.conf file, and restart FirebirdServer service 还要在firebird.conf文件中设置Authentication = mixed或trusted, 并重新启动FirebirdServer服务

If you don't set user_name and 'password' params in code (In your code have been commented), add them in design time. 如果未在代码中设置user_name和'password'参数(在代码中已注释),请在设计时添加它们。 It's enough to add only User_Name . 仅添加User_Name足够了。

If you want to use : 如果你想使用:

SQLConnection1.Params.add('user_name='); // this is enough
SQLConnection1.Params.add('password='); 

remove user_name and password params from SQLConnection.Params in design time. 在设计时从SQLConnection.Params中删除user_namepassword参数。

Note : Do not use: 注意: 不要使用:

SQLConnection1.Params.Values['User_Name'] := '';

This just removes parameter from list. 这只是从列表中删除参数。

Update 更新

在此输入图像描述

This works for me. 这适合我。 As you see in firebird.conf Autentication is trusted only. 正如您在firebird.conf中看到的那样,Autentication仅受信任。 SQLConnection params : user name and password are empty. SQLConnection参数:用户名和密码为空。 And SQLConnection is connected. 并且SQLConnection已连接。

Try to repeat this picture. 尝试重复这张照片。

A'm using Delphi 2010. A'm使用Delphi 2010。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM