You are here

public function ApiKeyAuth::handleException in Services API Key Authentication 3.0.x

Same name and namespace in other branches
  1. 8.2 src/Authentication/Provider/ApiKeyAuth.php \Drupal\services_api_key_auth\Authentication\Provider\ApiKeyAuth::handleException()
  2. 8 src/Authentication/Provider/ApiKeyAuth.php \Drupal\services_api_key_auth\Authentication\Provider\ApiKeyAuth::handleException()
  3. 2.0.x src/Authentication/Provider/ApiKeyAuth.php \Drupal\services_api_key_auth\Authentication\Provider\ApiKeyAuth::handleException()

File

src/Authentication/Provider/ApiKeyAuth.php, line 91

Class

ApiKeyAuth
HTTP Basic authentication provider.

Namespace

Drupal\services_api_key_auth\Authentication\Provider

Code

public function handleException(ExceptionEvent $event) {
  $exception = $event
    ->getThrowable();
  if ($exception instanceof AccessDeniedHttpException) {
    $event
      ->setThrowable(new UnauthorizedHttpException('Invalid consumer origin.', $exception));
    return TRUE;
  }
  return FALSE;
}