You are here

public function OAuth2DrupalAuthProvider::handleException in OAuth2 Server 8

Same name and namespace in other branches
  1. 2.0.x src/Authentication/Provider/OAuth2DrupalAuthProvider.php \Drupal\oauth2_server\Authentication\Provider\OAuth2DrupalAuthProvider::handleException()

Handle exception.

@todo Doesn't appear to be used.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event: The exception object.

Return value

bool Whether the exception s valid or not.

File

src/Authentication/Provider/OAuth2DrupalAuthProvider.php, line 212

Class

OAuth2DrupalAuthProvider
OAuth2 Drupal Auth Provider.

Namespace

Drupal\oauth2_server\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;
}