22
33namespace Adldap \Laravel \Listeners ;
44
5- use Adldap \Laravel \Auth \Provider ;
65use Adldap \Laravel \Facades \Resolver ;
76use Adldap \Laravel \Traits \HasLdapUser ;
7+ use Adldap \Laravel \Auth \DatabaseUserProvider ;
88use Illuminate \Support \Facades \Auth ;
99use Illuminate \Contracts \Auth \Authenticatable ;
1010
@@ -13,7 +13,7 @@ class BindsLdapUserModel
1313 /**
1414 * Binds the LDAP user record to their model.
1515 *
16- * @param mixed $event
16+ * @param \Illuminate\Auth\Events\Login|\Illuminate\Auth\Events\Authenticated $event
1717 *
1818 * @return void
1919 */
@@ -23,7 +23,7 @@ public function handle($event)
2323 // Adldap authentication provider, the required trait, and the
2424 // users LDAP property has not already been set.
2525 if (
26- $ this ->isUsingAdldapProvider ()
26+ $ this ->isUsingAdldapProvider ($ event -> guard )
2727 && $ this ->canBind ($ event ->user )
2828 && is_null ($ event ->user ->ldap )
2929 ) {
@@ -36,11 +36,13 @@ public function handle($event)
3636 /**
3737 * Determines if the Auth Provider is an instance of the Adldap Provider.
3838 *
39+ * @param string $guard
40+ *
3941 * @return bool
4042 */
41- protected function isUsingAdldapProvider () : bool
43+ protected function isUsingAdldapProvider ($ guard ) : bool
4244 {
43- return Auth::getProvider () instanceof Provider ;
45+ return Auth::guard ( $ guard )-> getProvider () instanceof DatabaseUserProvider ;
4446 }
4547
4648 /**
0 commit comments