You are here

public function JwtAuthIssuerSubscriber::setDrupalClaims in JSON Web Token Authentication (JWT) 8.0

Same name and namespace in other branches
  1. 8 modules/jwt_auth_issuer/src/EventSubscriber/JwtAuthIssuerSubscriber.php \Drupal\jwt_auth_issuer\EventSubscriber\JwtAuthIssuerSubscriber::setDrupalClaims()

Sets claims for a Drupal consumer on the JWT.

Parameters

\Drupal\jwt\Authentication\Event\JwtAuthGenerateEvent $event: The event.

File

modules/jwt_auth_issuer/src/EventSubscriber/JwtAuthIssuerSubscriber.php, line 61

Class

JwtAuthIssuerSubscriber
Class JwtAuthIssuerSubscriber.

Namespace

Drupal\jwt_auth_issuer\EventSubscriber

Code

public function setDrupalClaims(JwtAuthGenerateEvent $event) {
  $event
    ->addClaim([
    'drupal',
    'uid',
  ], $this->currentUser
    ->id());
}