public function authenticate(array $providers = [])
    {
        // Caught exceptions
        $exceptionStack = [];

        // Spin through each of the registered authentication providers and attempt to
        // authenticate through one of them. This allows a developer to implement
        // and allow a number of different authentication mechanisms.
        foreach ($this->filterProviders($providers) as $provider) {
            try {
                // Authenticate user with current provider
                $user = $provider->authenticate($this->router->getCurrentRequest(), $this->router->getCurrentRoute());

                // Set successful provider
                $this->providerUsed = $provider;

                return $this->user = $user;
            } catch (NodesException $exception) {
                $exceptionStack[] = $exception;
            } catch (UnauthorizedHttpException $exception) {
                $exceptionStack[] = $exception;
            } catch (BadRequestHttpException $exception) {
                // We won't add this exception to the stack as it's thrown when the provider
                // is unable to authenticate due to the correct authorization header not
                // being set. We will throw an exception for this below.
            }
        }

        $this->throwUnauthorizedException($exceptionStack);
    }
public function authenticate(array $providers = [])
    {
        // Caught exceptions
        $exceptionStack = [];

        // Spin through each of the registered authentication providers and attempt to
        // authenticate through one of them. This allows a developer to implement
        // and allow a number of different authentication mechanisms.
        foreach ($this->filterProviders($providers) as $provider) {
            try {
                // Authenticate user with current provider
                $user = $provider->authenticate($this->router->getCurrentRequest(), $this->router->getCurrentRoute());

                // Set successful provider
                $this->providerUsed = $provider;

                return $this->user = $user;
            } catch (NodesException $exception) {
                $exceptionStack[] = $exception;
            } catch (UnauthorizedHttpException $exception) {
                $exceptionStack[] = $exception;
            } catch (BadRequestHttpException $exception) {
                // We won't add this exception to the stack as it's thrown when the provider
                // is unable to authenticate due to the correct authorization header not
                // being set. We will throw an exception for this below.
            }
        }

        $this->throwUnauthorizedException($exceptionStack);
    }
public function authenticate ( array $ providers = [ ] ) { // Caught exceptions $ exceptionStack = [ ] ; // Spin through each of the registered authentication providers and attempt to // authenticate through one of them. This allows a developer to implement // and allow a number of different authentication mechanisms. foreach ( $ this -> filterProviders ( $ providers ) as $ provider ) { try { // Authenticate user with current provider $ user = $ provider -> authenticate ( $ this -> router -> getCurrentRequest ( ) , $ this -> router -> getCurrentRoute ( ) ) ; // Set successful provider $ this -> providerUsed = $ provider ; return $ this -> user = $ user ; } catch ( NodesException $ exception ) { $ exceptionStack [ ] = $ exception ; } catch ( UnauthorizedHttpException $ exception ) { $ exceptionStack [ ] = $ exception ; } catch ( BadRequestHttpException $ exception ) { // We won't add this exception to the stack as it's thrown when the provider // is unable to authenticate due to the correct authorization header not // being set. We will throw an exception for this below. } } $ this -> throwUnauthorizedException ( $ exceptionStack ) ; }
Authenticate request.

@author Morten Rugaard <moru@nodes.dk>

@param  array $providers
@return \Illuminate\Database\Eloquent\Model
@throws \Nodes\Exceptions\Exception
@throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
@throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
Authenticate request .