You are here

protected function UsersJwtAuth::debugLog in JSON Web Token Authentication (JWT) 8

Log the reason that a JWT could not be used to authenticate.

Parameters

string $cause:

\Exception|null $e:

\StdClass|null $payload:

\Drupal\users_jwt\UsersKey|null $key:

\Drupal\user\UserInterface|null $user:

Return value

null

1 call to UsersJwtAuth::debugLog()
UsersJwtAuth::authenticate in modules/users_jwt/src/Authentication/Provider/UsersJwtAuth.php
Authenticates the user.

File

modules/users_jwt/src/Authentication/Provider/UsersJwtAuth.php, line 136

Class

UsersJwtAuth
Class UsersJwtAuth.

Namespace

Drupal\users_jwt\Authentication\Provider

Code

protected function debugLog($cause, \Exception $e = NULL, \StdClass $payload = NULL, UsersKey $key = NULL, UserInterface $user = NULL) {
  if ($this->settings::get('jwt.debug_log')) {
    $this->loggerFactory
      ->get('users_jwt')
      ->error('Error authenticating with a JWT "%cause". Exception: "%exception" Payload: "%payload" Key: "%key" User: "%user"', [
      '%cause' => $cause,
      '%exception' => $e ? get_class($e) . ' ' . $e
        ->getMessage() : 'null',
      '%payload' => $payload ? var_export($payload, TRUE) : 'null',
      '%key' => $key ? var_export($key, TRUE) : 'null',
      '%user' => $user ? var_export($user
        ->toArray(), TRUE) : var_export($user, TRUE),
    ]);
  }
  return NULL;
}