it authenticate user

@param  string  $provider
@param Request  $request
@return User
192627
public function authenticate($provider, $code=False)
    {
        if($code){
            return $this->handleProviderCallback($provider);
        }

        return $this->redirectToProvider($provider);
    }
792349
public function authenticate(RequestInterface $request)
    {
        $token = $this->token();

        if (!$token && !$this->findMatchingArea($request)) {
            return $this;
        }

        if (!$token) {
            throw new AuthenticationException('Unable to authenticate, token is missing');
        }

        foreach ($this->providers as $provider) {
            if (!$provider->supportsToken($token)) {
                continue;
            }

            if (!$provider->authenticate($token)) {
                $this->stash()
                     ->destroy();

                throw new AuthenticationException(sprintf('Token could not be authenticated in provider "%s", destroying token', get_class($provider)));
            }

            $this->user = $provider->get($token);

            return $this;
        }

        $this->stash()
             ->destroy();

        throw new AuthenticationException(sprintf('Missing provider supporting token "%s", destroying token', get_class($token)));
    }
46477
public function setRequestUser (Request $request)
    {
        $request->addUserCallback ('accounts', function (Request $request) {

            $userid = $request->getSession ()->get ('catlab-user-id');

            if ($userid)
            {
                $user = MapperFactory::getUserMapper ()->getFromId ($userid);
                if ($user)
                    return $user;
            }

            return null;
        });
    }
302394
public function authenticate(Request $request)
    {
        if ($request->hasSession()) {
            $request->session()->reflash();
        }

        return Broadcast::auth($request);
    }
903882
public function authenticate(Request $request, Route $route)
    {
        $this->validateAuthorizationHeader($request);

        try {
            if (! $user = $this->auth->parseToken()->authenticate()) {
                throw new UnauthorizedHttpException('JWTAuth', 'Unable to authenticate with invalid token.');
            }
        } catch (JWTException $exception) {
            throw new UnauthorizedHttpException('JWTAuth', $exception->getMessage(), $exception);
        }

        return $user;
    }
182430
public function login(Request $request, AuthenticateUser $authenticate, ThrottlesCommand $throttles)
    {
        $username = Authen::getIdentifierName();

        $input = $request->only([$username, 'password', 'remember']);

        $throttles->setRequest($request)->setLoginKey($username);

        return $authenticate($this, $input, $throttles);
    }
875098
protected function login(Request $request, User $user)
    {
        impersonate()->login($user);

        // if redirect url in request
        if ($request->has('redirect_to')) {
            return redirect($request->get('redirect_to'));
        }

        return back();
    }
989008
public function postLogin(Request $request)
    {
        $this->validate($request, [
            'user'      => 'required',
            'password'  => 'required',
        ]);

        $credentials = $request->only('user', 'password');

        if(auth()->guard('pulsar')->attempt($credentials, $request->has('remember')))
        {
            // check if user has access
            if(!auth()->guard('pulsar')->user()->access_010)
            {
                auth()->guard('pulsar')->logout();
                return redirect($this->loginPath)
                    ->withInput($request->only('user', 'remember'))
                    ->withErrors([
                        'loginErrors' => 3
                    ]);
            }

            // set user access control list
            session(['userAcl' => AclLibrary::getProfileAcl(auth()->guard('pulsar')->user()->profile_id_010)]);

            // check if user has permission to access
            if (!is_allowed('pulsar', 'access'))
            {
                auth()->guard('pulsar')->logout();
                return redirect($this->loginPath)
                    ->withInput($request->only('user', 'remember'))
                    ->withErrors([
                        'loginErrors' => 2
                    ]);
            }

            session(['packages' => Package::getRecords(['active_012' => true, 'orderBy' => ['column' => 'sorting_012', 'order' => 'desc']])]);
            session(['baseLang' => Lang::getBaseLang()]);

            return redirect()->intended($this->redirectTo);
        }

        return redirect($this->loginPath)
            ->withInput($request->only('user', 'remember'))
            ->withErrors([
                'loginErrors' => 1
            ]);
    }
224908
private function getUser(Request $request)
    {
        if ($this->configurationHandler->getParameter('terms_of_service')
            && 'claroline_locale_change' !== $request->get('_route')
            && 'claroline_locale_select' !== $request->get('_route')
            && 'bazinga_exposetranslation_js' !== $request->get('_route')
            && ($token = $this->tokenStorage->getToken())
            && ($user = $token->getUser())
            && $user instanceof User
        ) {
            return $user;
        }

        return null;
    }
983560
public function authenticate(Request $request)
    {
        $form = $this->app->form(new PhraseaAuthenticationForm($this->app));
        $redirector = function (array $params = []) {
            return $this->app->redirectPath('homepage', $params);
        };

        try {
            return $this->doAuthentication($request, $form, $redirector);
        } catch (AuthenticationException $e) {
            return $e->getResponse();
        }
    }
152398
public function authenticate(AbstractAuthenticationProvider $provider)
    {
        if (null === $provider->getRepository()) {
            $provider->setRepository(new DatabaseRepository(ConnectionManager::get('default')));
        }

        $output = $provider->authenticate();

        $this->storage->flush();

        if (is_array($output)) {
            if (null !== $this->userDetails) {
                $output = $this->userDetails->getDetails($output);
            }

            $this->storage->write($output);

            return true;
        }

        return $output;
    }
375163
public static function user(Request $request)
    {
        try {

            $data = self::token($request);
            $repository = db::em()->getRepository(cfg::USER_ENTITY);
            return $repository->find($data->data->id ?? 0);
        } catch (HeaderWithoutAuthorizationException $ex) {
            return false;
        }
    }
1090459
public static function getUserProvider(Authenticatable $user)
    {
        foreach (config('auth.providers') as $provider => $config) {
            if ($user instanceof $config['model']) {
                return $provider;
            }
        }

        throw MissingConfigException::provider($user);
    }
1057796
protected function getUserFromRequest(Request $request)
    {
        $username = $request->get('username');

        return $this->userService->findByEmail($username);
    }
1180399
protected function authenticateViaBearerToken($request)
    {
        // First, we will convert the Symfony request to a PSR-7 implementation which will
        // be compatible with the base OAuth2 library. The Symfony bridge can perform a
        // conversion for us to a Zend Diactoros implementation of the PSR-7 request.
        $psr = (new DiactorosFactory)->createRequest($request);

        try {
            $psr = $this->server->validateAuthenticatedRequest($psr);

            // If the access token is valid we will retrieve the user according to the user ID
            // associated with the token. We will use the provider implementation which may
            // be used to retrieve users from Eloquent. Next, we'll be ready to continue.
            $user = $this->provider->retrieveById(
                $psr->getAttribute('oauth_user_id')
            );

            if (! $user) {
                return;
            }

            // Next, we will assign a token instance to this user which the developers may use
            // to determine if the token has a given scope, etc. This will be useful during
            // authorization such as within the developer's Laravel model policy classes.
            $token = $this->tokens->find(
                $psr->getAttribute('oauth_access_token_id')
            );

            $clientId = $psr->getAttribute('oauth_client_id');

            // Finally, we will verify if the client that issued this token is still valid and
            // its tokens may still be used. If not, we will bail out since we don't want a
            // user to be able to send access tokens for deleted or revoked applications.
            if ($this->clients->revoked($clientId)) {
                return;
            }

            return $token ? $user->withAccessToken($token) : null;
        } catch (OAuthServerException $e) {
            return Container::getInstance()->make(
                ExceptionHandler::class
            )->report($e);
        }
    }
54520
public function authenticate(Request $request)
    {
        if (Auth::user()) {
            return false;
        }

        $this->checkForToken($request);

        try {
            if (!JWTAuth::parseToken()->authenticate()) {
                throw new UnauthorizedHttpException('jwt-auth', 'User not found');
            }
        } catch (TokenExpiredException $e) {
            // If the token is expired, then it will be refreshed and added to the headers
            try {
                return Auth::refresh();
            } catch (TokenExpiredException $e) {
                throw new UnauthorizedHttpException('jwt-auth', 'Refresh token has expired.');
            }
        } catch (TokenBlacklistedException $e) {
            throw new TokenBlacklistedException($e->getMessage(), 401);
        } catch (JWTException $e) {
            throw new UnauthorizedHttpException('jwt-auth', $e->getMessage(), $e, $e->getCode());
        }
    }
985790
protected function authenticateRequest(Request $request)
    {
        if ($this->authenticator && $this->authenticate) {
            return $this->authenticator->authenticate($request);
        }

        return $request;
    }