app/app/Services/Ldap/LdapAuthUserProvider.php
/**
     * Retrieve a user by the given credentials.
     *
     * @param  array  $credentials
     * @return Illuminate\Auth\GenericUser|null
     */
Retrieve a user by the given credentials.
@param  array  $credentials
@return Illuminate\Auth\GenericUser|null
Retrieve a user by the given credentials . @param array $credentials @return Illuminate \ Auth \ GenericUser|null
public function retrieveByCredentials(array $credentials)
    {
        if ( ! $user = $credentials[$this->getUsernameField()] ) {
            throw new \InvalidArgumentException;
        }
        $infoCollection = $this->ad->user()->infoCollection($user, array('*'));
        if ($infoCollection) {
            $ldapUserInfo = $this->setInfoArray($infoCollection);
            if ($this->model) {
                $query = $this->createModel()->newQuery();
                foreach ($credentials as $k => $credential) {
                    if ( ! str_contains($k, 'password') && ! str_contains($k, '_token') ) $query->where($k, $credential);
                }
                if ($model = $query->first()) {
                    return $this->addLdapToModel($model, $ldapUserInfo);
                }
            }
            return new LdapUser((array) $ldapUserInfo);
        }
    }
public function retrieveByCredentials ( array $ credentials ) { if ( ! $ user = $ credentials [ $ this -> getUsernameField ( ) ] ) { throw new \ InvalidArgumentException ; } $ infoCollection = $ this -> ad -> user ( ) -> infoCollection ( $ user , array ( '*' ) ) ; if ( $ infoCollection ) { $ ldapUserInfo = $ this -> setInfoArray ( $ infoCollection ) ; if ( $ this -> model ) { $ query = $ this -> createModel ( ) -> newQuery ( ) ; foreach ( $ credentials as $ k => $ credential ) { if ( ! str_contains ( $ k , 'password' ) && ! str_contains ( $ k , '_token' ) ) $ query -> where ( $ k , $ credential ) ; } if ( $ model = $ query -> first ( ) ) { return $ this -> addLdapToModel ( $ model , $ ldapUserInfo ) ; } } return new LdapUser ( ( array ) $ ldapUserInfo ) ; } }
Retrieve a user by the given credentials.
Retrieve a user by the given credentials .
// dd(! $user = $credentials[$this->getUsernameField()]);