/**
  * @param $route
  * @param $request
  * @param null $scope
  * @return null|BridgeResponse
  */
 public function filter($route, $request, $scope = null)
 {
     $beforeAccessResult = $this->dispatcher->until('oauth.access.before', array($scope));
     if ($beforeAccessResult) {
         return null;
     }
     /** @var BridgeRequest $bridgeRequest */
     $bridgeRequest = BridgeRequest::createFromRequest($request);
     $bridgeResponse = new BridgeResponse();
     $resController = $this->server->getResourceController();
     if (!$resController->verifyResourceRequest($bridgeRequest, $bridgeResponse, $scope)) {
         $this->dispatcher->fire('oauth.access.failed');
         return $bridgeResponse;
     }
     $token = $resController->getAccessTokenData($bridgeRequest, $bridgeResponse);
     $client = $this->clientRepo->find($token['client_id']);
     $tokenScope = $token['scope'];
     $user = null;
     if (isset($token['user_id'])) {
         $user = $this->userProvider->retrieveById($token['user_id']);
     }
     if ($tokenScope) {
         $tokenScope = explode(' ', $tokenScope);
     }
     $eventPayload = array($client, $user, $tokenScope);
     $this->dispatcher->fire('oauth.access.valid', $eventPayload);
 }
Beispiel #2
0
 /**
  * Determine if the daemon should process on this iteration.
  *
  * @return bool
  */
 protected function daemonShouldRun()
 {
     if ($this->manager->isDownForMaintenance()) {
         return false;
     }
     return $this->events->until('illuminate.queue.looping') !== false;
 }
 /**
  * Call the given route filter.
  *
  * @param  string  $filter
  * @param  array  $parameters
  * @param  \Illuminate\Routing\Route  $route
  * @param  \Illuminate\Http\Request  $request
  * @param  \Illuminate\Http\Response|null $response
  * @return mixed
  */
 public function callRouteFilter($filter, $parameters, $route, $request, $response = null)
 {
     if (!$this->filtering) {
         return null;
     }
     $data = array_merge(array($route, $request, $response), $parameters);
     return $this->events->until('router.filter: ' . $filter, $this->cleanFilterParameters($data));
 }
Beispiel #4
0
 /**
  * Fire an event until the first non-null response is returned.
  *
  * @param string|object $event
  * @param array $payload
  * @return mixed 
  * @static 
  */
 public static function until($event, $payload = array())
 {
     return \Illuminate\Events\Dispatcher::until($event, $payload);
 }
 /**
  * Determine if the daemon should process on this iteration.
  *
  * @return bool
  */
 protected function daemonShouldRun()
 {
     return $this->events->until('illuminate.queue.looping') !== false;
 }