getCurrentRequest() public method

Get the current request instance.
public getCurrentRequest ( ) : Dingo\Api\Http\Request
return Dingo\Api\Http\Request
Example #1
0
 /**
  * Authenticate the current request.
  *
  * @param array $providers
  *
  * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
  *
  * @return mixed
  */
 public function authenticate(array $providers = [])
 {
     $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 {
             $user = $provider->authenticate($this->router->getCurrentRequest(), $this->router->getCurrentRoute());
             $this->providerUsed = $provider;
             return $this->user = $user;
         } 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);
 }