• 信息系统中用户的域AD认证功能


    {

    The LogonUser function attempts to log a user on to the local computer. The local computer is the computer from which LogonUser was called. You cannot use LogonUser to log on to a remote computer. You specify the user with a user name and domain and authenticate the user with a plaintext password. If the function succeeds, you receive a handle to a token that represents the logged-on user. You can then use this token handle to impersonate the specified user or, in most cases, to create a process that runs in the context of the specified user.

    BOOL LogonUser(
      __in      LPTSTR lpszUsername,//UserName
      __in_opt  LPTSTR lpszDomain,//Domain
      __in_opt  LPTSTR lpszPassword,//password
      __in      DWORD dwLogonType,//Logon Type
      __in      DWORD dwLogonProvider,//LogonProvider
      __out     PHANDLE phToken//A pointer to a handle variable that receives a handle to a token that represents the specified user

    );

    }

     1 function   ValidateUserLogonAPI(const   UserName:   string; const   PassWord:   string):   boolean;
     2 
     3 var
     4 
     5     Retvar:   boolean;
     6 
     7     LHandle:   THandle;
     8 
     9 begin
    10 
    11     Retvar   :=   LogonUser(PChar(UserName),
    12 
    13         PChar(string(OP_ADDomain)),   PChar(PassWord),
    14 
    15         LOGON32_LOGON_NETWORK,//This logon type is intended for high performance servers to authenticate plaintext passwords. The LogonUser function does not                                              //cache credentials for this logon type.
    16 
    17         LOGON32_PROVIDER_DEFAULT,//Use the standard logon provider for the system.
    18 
    19         LHandle);
    20 
    21     if   Retvar   then
    22 
    23         CloseHandle(LHandle);//close the handle
    24 
    25     Result   :=   Retvar;
    26 
    27 end;
  • 相关阅读:
    IO基础
    集合框架
    数据结构基础
    进程和线程
    matlab绘制三维图形
    matlab figure 窗口最大化
    Matlab中的fread函数
    matlab中fopen 和 fprintf函数总结
    matlab中findstr,strfind,strcmp,strncmp区别与联系
    matlab取消和添加注释以及一些快捷键
  • 原文地址:https://www.cnblogs.com/songrun/p/3125992.html
Copyright © 2020-2023  润新知