[英]php bind ldap to active directory
In PHP, how can you bind using a property other than the default cn? 在PHP中,如何使用默认cn以外的属性进行绑定? (I'm not asking how to validate a user account using LDAP search queries, I'm specifically asking how I can bind using a sAMAaccountname and password in PHP). (我不是在问如何使用LDAP搜索查询来验证用户帐户,我是在问如何在PHP中使用sAMAaccountname和密码进行绑定)。
In Perl, this is possible by specifying the property to query directly on the LDAP string: 在Perl中,可以通过指定直接在LDAP字符串上查询的属性来实现:
ldap://ldap.example.com/dc=example,dc=com?sAMAccountName
The php ldap_connect funciton only takes a server name so these additional parameters are not able to be passed. php ldap_connect函数仅使用服务器名称,因此无法传递这些附加参数。 Also the bind function only takes a connection, username, and password. 同样,bind函数仅接受连接,用户名和密码。
Connect simply opens the connection it doesn't set any credentials on the connection. Connect只是打开连接而未在连接上设置任何凭据。 Once the connection is open you bind it to a set of credentials using ldap_bind . 打开连接后,您可以使用ldap_bind将其绑定到一组凭据。
In connecting to AD you can use 3 different formats for the username. 在连接到AD时,您可以为用户名使用3种不同的格式。
Domain\\samAccountName
. samAccountName可能需要也可能不需要以Domain\\samAccountName
作为前缀的Domain\\samAccountName
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.