我正在为Symfony项目中的LDAP身份验证而苦苦挣扎。
我的服务看起来像这样:
ldap:
class: SymfonyComponentLdapLdap
factory: ['SymfonyComponentLdapLdap', 'create']
arguments:
- 'ext_ldap'
- host: 'ldap.example.com'
绑定和示例查询LDAP服务器的工作正常:
$ldap = $this->get('ldap');
$ldap->bind('binduser', 'bindpw');
$query = $ldap->query('OU=MyBusiness,DC=example,DC=com', 'sAMAccountName=xxx');
现在,我想对LDAP服务器进行身份验证。我已经从http://symfony.com/doc/current/security/ldap.html#configuration-example-form-form-login使用了防火墙设置。但是,一个很好的问题是将绑定凭据放在哪里?
相应的日志条目是:
php.DEBUG: Warning: ldap_bind(): Unable to bind to server: Invalid credentials
所以很明显缺少什么,但是我找不到一种向form_login_ldap提供绑定凭证的方法。
http://symfony.com/doc/current/referent/configuration/security.html上的参考也不显示如何提供它们。
谢谢!
绑定凭据是从用户中以表格提交的凭据。
您在这里看到http://symfony.com/doc/current/security/ldap.html#configuration-example-for-form-login
service: ldap
dn_string: 'uid={username},dc=example,dc=com'
您只需要指定DN_STRING,用户将通过致电LDAP_BIND进行身份验证。
您的用户(您以表格中输入的用户)有权授权ldap_bind?您在LDAP用户提供商的配置中输入的一个(如果您有)为此目的没有用。
表单登录是一种传统的登录表单,可以在此之后完成http://symfony.com/doc/current/security/security/form_login_setup.html