1
我在Yii2工作与Adldap扩展在这里找到:https://github.com/Adldap2/Adldap2Adldap2认证总是返回true - Yii2
我遇到一个问题,当我尝试我的LDAP服务器上的用户进行身份验证。我可以成功建立连接并检索用户数据,但在尝试验证用户的用户名和密码是否正确时,即使信用卡错误,它也会始终返回true。下面是我的代码段(与配置阵列没有显示的路线):
$ad->addProvider($config);
try {
// If a successful connection is made to your server, the provider will be returned.
$provider = $ad->connect();
//User below does return the correct information from the ldap server
$user = $provider->search()->users()->find('quillin');
try{
$provider->auth()->attempt("wrongUsername","wrongPassword");
die("WIN");
}catch(Exception $e){
die("Exception " . $e);
}
}catch (\Adldap\Auth\BindException $e) {
die("There was an issue binding/connecting to the server. <br />" . $e);
}
不管是什么,我把用户名和密码字段,它总是返回true,打模(“WIN”);线。在我composer.json文件,我使用“adldap2/adldap2”:“V7.0 *”
我也曾尝试使用用户绑定如下:
try{
$provider->auth()->attempt("wrongUsername","wrongPassword", $bindAsUser = true);
die("WIN");
}catch(Exception $e){
die("lose :(");
die("Exception " . $e);
}
这也总是返回true;