Jump to content

Using Authorization Manager (AzMan) and Active Directory with UniGUI?


rasaliad

Recommended Posts

Hi,

 

We have to develop a new project for a customer, and we are planing to use Unigui to develop it. The custometo ono jr ask us to use Active Directory and AzMan (Authorization Manager), and may question is?:

 

Has someone use AzMan with UniGui?, How to use it?, the customer say that other application  (Asp.Net) use it... How can i implement this.?

 

Also I want how to use Active Directory with Unigui, is it possibly?

 

 

 

Thanks in Advanced

Link to comment
Share on other sites

  • 6 years later...

Hi 

I am using this code it may help you

  TdmLoginModule = class(TDataModule)
    qryUser: TFDQuery;
    qryUserRoles: TFDQuery;
  private
    { Private declarations }
    function LDAPLogin(ADomain, AUserCode, APassword: string): Boolean;
  public
    { Public declarations }
    function UserLogin(ADomain, AUserCode, APassword: string): Boolean;
  end;
 

function TdmLoginModule.LDAPLogin(ADomain, AUserCode, APassword: string): Boolean;
var
  hToken: THandle;
begin
  Result := False;
  if (LogonUser(pChar(AUserCode), pChar(ADomain), pChar(APassword), LOGON32_LOGON_INTERACTIVE,
   LOGON32_PROVIDER_DEFAULT, hToken)) then
  begin
    CloseHandle(hToken);
    Result := True;
  end;
end;
 

function TdmLoginModule.UserLogin(ADomain, AUserCode, APassword: string): Boolean;
var
  I: Integer;
  AuthSuccess: Boolean;
begin
  Result := False;
  AuthSuccess := False;

  if (Trim(AUserCode) = '') or (Trim(APassword) = '') then
    Exit;

  if Trim(ADomain) <> '' then
  begin
    AuthSuccess := LDAPLogin(ADomain, AUserCode, APassword);
    if not AuthSuccess then
      Exit;
    AUserCode := AUserCode + '@' + ADomain;
  end;

................

Just disregard AUserCode := AUserCode + '@' + ADomain; I just use it for domain users for internal reasons.

Other than that Above code works

That is it.

 

 

Link to comment
Share on other sites

Thank you all

My problem was solved this way ....

Quote

function TdmLoginModule.LDAPLogin(ADomain, AUserCode, APassword: string): Boolean;
var
  hToken: THandle;
begin
  Result := False;
  if (LogonUser(pChar(AUserCode), pChar(ADomain), pChar(APassword), LOGON32_LOGON_INTERACTIVE,
   LOGON32_PROVIDER_DEFAULT, hToken)) then
  begin
    CloseHandle(hToken);
    Result := True;
  end;
end;


To use this component, there is a ready-made sample that can be used to obtain the necessary skills from its source

Quote

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...