예제 #1
0
 /**
  * Finds the bearer token and looks up the value.
  *
  * @return void
  */
 protected function processRequest()
 {
     if ($this->isRequestProcessed) {
         return;
     }
     $authorizationHeaderValue = $this->request->getHeader('Authorization');
     if (!$authorizationHeaderValue) {
         $this->isRequestProcessed = true;
         return;
     }
     $headerPieces = explode(" ", $authorizationHeaderValue);
     if (count($headerPieces) !== 2) {
         $this->isRequestProcessed = true;
         return;
     }
     $tokenType = strtolower($headerPieces[0]);
     if ($tokenType !== 'bearer') {
         $this->isRequestProcessed = true;
         return;
     }
     $bearerToken = $headerPieces[1];
     $token = $this->tokenFactory->create()->loadByToken($bearerToken);
     if (!$token->getId() || $token->getRevoked()) {
         $this->isRequestProcessed = true;
         return;
     }
     $this->setUserDataViaToken($token);
     $this->isRequestProcessed = true;
 }