We run a project with two separate user tables and auth providers (the Laravel default users for the admin panel, and a 'members' table for frontend users).
We are using the Adldap2 package for authenticating only our frontend users, which are set up with a custom guard frontend in config/auth.php.
Everything went super smooth (we use the DatabaseUserProvider and import users to our DB), also authentication works 👍.
The only problem we have now is, that the LDAP user is not being bound to our Laravel member model. The HasLdapUser trait is set on the model. $user->ldap stays null after a successful auth attempt.
I found out that in the BindsLdapUserModel class, you are checking for a 'guard' property on the event object.
// We'll retrieve the auth guard if available.
if (property_exists($event, 'guard')) {
$guard = $event->guard;
}
dd($guard) // returns null
Binding actually works if I manually set $guard = 'frontend'; in this file. So now my question is, how does the event even get a guard property? Am I missing something?
Our LoginController is more or less untouched and uses the Laravel default logic. Only thing we do is override the guard method to return our custom guard:
protected function guard() {
return Auth::guard('frontend');
}
First of all, thank you for this awesome package!
Description:
We run a project with two separate user tables and auth providers (the Laravel default users for the admin panel, and a 'members' table for frontend users).
We are using the Adldap2 package for authenticating only our frontend users, which are set up with a custom guard
frontend
inconfig/auth.php
.Everything went super smooth (we use the DatabaseUserProvider and import users to our DB), also authentication works 👍.
The only problem we have now is, that the LDAP user is not being bound to our Laravel member model. The
HasLdapUser
trait is set on the model.$user->ldap
stays null after a successful auth attempt.I found out that in the
BindsLdapUserModel
class, you are checking for a 'guard' property on the event object.Binding actually works if I manually set
$guard = 'frontend';
in this file. So now my question is, how does the event even get a guard property? Am I missing something?Our
LoginController
is more or less untouched and uses the Laravel default logic. Only thing we do is override theguard
method to return our custom guard:Config
ldap_auth.php