/**
  *
  * @param string         $message
  * @param integer        $code
  * @param Exception|null $previous
  * @param string         $realmName
  */
 public function __construct($message = '', $code = 401, Exception $previous = null, $realmName = 'API')
 {
     if (empty($message)) {
         $message = $this->getMessageKey();
     }
     parent::__construct($message, $code, $previous);
     $this->statusCode = $code;
     $this->errorCode = 'invalid_token';
     $this->realmName = $realmName;
 }
Пример #2
0
 /**
  * Create a http response.
  *
  * @param AuthenticationCredentialsNotFoundException $exception The exception to create a response for.
  *
  * @return JsonResponse
  */
 private function createUnauthenticatedResponse(AuthenticationCredentialsNotFoundException $exception)
 {
     return new JsonResponse(['status' => 'ERROR', 'message' => $exception->getMessageKey()], JsonResponse::HTTP_UNAUTHORIZED);
 }