English 中文(简体)
利用Unicode进行认证
原标题:AD authentication using Unicode

在C#采用以下方法实施:

DirectoryEntry entry = 
  new DirectoryEntry(_path, domainAndUsername, pwd, AuthenticationTypes.Secure);

域名(例如域名控制器的排位)

现在我不得不使用德尔菲语这样做。 因此,我发现Solomon s excelent Del 2007 LDAP implementation at

  1. Have anyone a working version for Delphi 2009+ (unicode)?
  2. Have anyone a working sample with simple AD Authentication processing(eg. validating) domainuserid and password?

在C#中,单单单是通过LDAP进行一度的搜索,而只是要检查用户是否认证。

问题回答

托尼·卡杜托为我提供了“协同”解决办法:

我把这 st倒在我制造的认证标语中,我不想说整个话,因为其中还有其他一些非相关的 st子。

This should get you going, the key is to concatenate the AD username with @your.ad.domain.name After you succesfully bind, you can then do searches against the AD directory by supplying a base DN and using the search function of the ldapsend unit.

I have found this to be faster than other methods and it s solid. You do need to get the trunk version of synapse so it works with the later versions of delphi.

uses ldapsend

var
    fldap:tldapsend;
    fad_domain,ausername,apassword:string;
begin
ausername:= your AD username ;
apassword:= your AD password ;
fldap := TLDAPSend.Create;
fad_domain:=  your.ad.domain ;
fldap.TargetHost:=fad_domain;
//next line is the key to getting AD authentication working
fldap.UserName := ausername+ @ +fad_domain;
fldap.Password := apassword;
try
   try
      if fldap.Login then
         if fldap.Bind then
            begin
                    //user is succesfully authenticated at this point

            end else
                raise exception.Create( LDAP bind failed. );
   except
         on e:exception do
            //whatever
   end;
finally
       fldap.logout;
       freeandnil(fldap);
end;
end;

感谢托尼!





相关问题
determining the character set to use

my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...

Help with strange Delphi 5 IDE problems

Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签