/**
  * @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);
 }
Exemple #2
0
 /**
  * Log the given user ID into the application without sessions or cookies.
  *
  * @param  mixed  $id
  * @return bool
  */
 public function onceUsingId($id)
 {
     $this->setUser($this->provider->retrieveById($id));
     return $this->user instanceof UserInterface;
 }
 /**
  * Log the given user ID into the application.
  *
  * @param  mixed  $id
  * @param  bool   $remember
  * @return \Illuminate\Auth\UserInterface
  */
 public function loginUsingId($id, $remember = false)
 {
     $this->session->put($this->getName(), $id);
     return $this->login($this->provider->retrieveById($id), $remember);
 }