You are here

public function JwtAuthIssuerSubscriber::setStandardClaims 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::setStandardClaims()

Sets the standard claims set for a JWT.

Parameters

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

File

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

Class

JwtAuthIssuerSubscriber
Class JwtAuthIssuerSubscriber.

Namespace

Drupal\jwt_auth_issuer\EventSubscriber

Code

public function setStandardClaims(JwtAuthGenerateEvent $event) {
  $event
    ->addClaim('iat', time());

  // @todo: make these more configurable.
  $event
    ->addClaim('exp', strtotime('+1 hour'));
}