在PHP中验证通过Active Directory使用LDAP

问题描述:

我在寻找一种方法,通过LDAP用PHP来验证用户身份(使用Active Directory作为供应商)。理想情况下,应该能够在IIS 7上运行( adLDAP 做它在Apache)。任何人做过类似的话,成功?

I'm looking for a way to authenticate users through LDAP with PHP (with Active Directory being the provider). Ideally, it should be able to run on IIS 7 (adLDAP does it on Apache). Anyone had done anything similar, with success?

  • 编辑:我想preFER库/类code,它已经准备好去...这将会是愚蠢的发明*,当有人已经这样做了

导入全库似乎效率不高时,你需要的是本质上的两行code ...

Importing a whole library seems inefficient when all you need is essentially two lines of code...

$ldap = ldap_connect("ldap.example.com");
if ($bind = ldap_bind($ldap, $_POST['username'], $_POST['password'])) {
  // log them in!
} else {
  // error message
}