通过 Active Directory 使用 LDAP 在 PHP 中进行身份验证 [英] Authenticating in PHP using LDAP through Active Directory

查看:43
本文介绍了通过 Active Directory 使用 LDAP 在 PHP 中进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种使用 PHP 通过 LDAP 验证用户身份的方法(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?

  • 我更喜欢带有可随时使用的代码的库/类...当有人已经这样做时再发明轮子是愚蠢的.

推荐答案

当您基本上只需要两行代码时,导入整个库似乎效率低下...

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
}

这篇关于通过 Active Directory 使用 LDAP 在 PHP 中进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆