You are here

public function ApiKeyAuth::handleException in Services API Key Authentication 8

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. 3.0.x 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(GetResponseForExceptionEvent $event) {
  $exception = $event
    ->getException();
  if ($exception instanceof AccessDeniedHttpException) {
    $event
      ->setException(new UnauthorizedHttpException('Invalid consumer origin.', $exception));
    return TRUE;
  }
  return FALSE;
}