我设法使连接工作到AD,但我似乎不能使Auth::尝试工作。永远都是假的。有人有主意或者暗示吗?
public function login(Request $request) {
$search = Adldap::search()->where('samaccountname', '=', 'tba')->get();
// this is returning the correct user
dd($search);
//'username' => 'tba'
// 'passwrod' => 'is the entered password'
//this goes into error part
if (Auth::attempt(request()->only('username', 'password'))) {
dd('success');
} else {
dd('error');
}
}‘用户名’=> [
/*
|--------------------------------------------------------------------------
| LDAP
|--------------------------------------------------------------------------
|
| This is the LDAP users attribute that you use to authenticate
| against your LDAP server. This is usually the users
|'sAMAccountName' / 'userprincipalname' attribute.
|
| If you'd like to use their username to login instead, insert `samaccountname`.
|
*/
'ldap' => 'samaccountname',
/*
|--------------------------------------------------------------------------
| Eloquent
|--------------------------------------------------------------------------
|
| This is the attribute that is used for locating
| and storing the LDAP username above.
|
| If you're using a `username` field instead, change this to `username`.
|
| This option is only applicable to the DatabaseUserProvider.
|
*/
'eloquent' => 'username',啊对,而且
( Adldap::auth()->attempt(request()->only('username',‘密码’)
为Adldap\Auth\卫队::ErrorException()提供一个ErrorException:缺失参数2,在第63行和defined<中调用
更新:
我终于成功了:
if (Adldap::auth()->attempt(request()->get('username'), request()->get('password'))) {
dd('success');
} else {
dd('error');
}我可以获得成功,奇怪的是,我必须使用CN名称作为用户名。如果我使用samaccountname是"tba“,它就不工作了。
更有趣的是,奥斯根本没有工作。返回假
Auth::attempt(request()->only('username', 'password'))我需要一些帮助/介绍。
发布于 2017-06-09 08:36:15
我觉得这挺直接的。函数需要2个参数,您要传递给它一个参数。快速查看文档显示,第一个参数是用户名,第二个参数是密码。在执行request()->only('args')时,您将得到一个array。
相反,做Auth::attempt(request()-get('username'), request()->get('password'))
https://stackoverflow.com/questions/44452972
复制相似问题