0
需要您的幫助以根據LDAP驗證活動目錄用戶ID。我的問題是獨特的。讓我在這裏解釋。在發佈這個問題之前,我已經搜索了它,並且在這個論壇中搜索,沒有得到任何匹配的帖子。PHP - 針對Windows 2003 Active Directory的LDAP身份驗證(與名字和姓氏不同的用戶ID)
這是問題 我有一個Windows 2003域控制器。我公司的政策是在域中創建的用戶ID如下
First Name = John
Last Name = Wagner
User ID = [email protected] (domain controller is company.com)
當我更新Active Directory用戶和計算機用戶屬性,我必須更新全部第一和完整姓氏 - 約翰·瓦格納
當我嘗試使用用戶標識在php中驗證html web表單時,它不起作用。 但是,當我使用名字和姓氏進行身份驗證時,它可以正常工作。
//username is given as jwagner in the html form in this case. Authentication Fails.
//username is given as "john wagner" (without the quotes). Authentication Success.
if ((isset($_POST['username'])) && (isset($_POST['password'])))
{
$username=$_POST['username'];
$password=$_POST['password'];
$adServer = "10.23.1.1";
$ldapconn = ldap_connect($adServer)
or die("Could not connect to LDAP server.");
$ldaprdn = $username;
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $password);
if ($ldapbind)
{
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
header("Location: http://company.com/website1");
}
else
{
//if authentication fails, redirect back to the login page
header("Location: http://company.com/index.php");
}
}
我不知道我錯在哪裏。如果用戶標識與活動目錄帳戶的名字和姓氏不相同,是不是可以使用php來驗證活動目錄帳戶?
感謝您提前給予的所有建議和幫助。
問候, 維奈
非常感謝JPBlanc。它按預期工作。 –