Exemple #1
0
 /**
  * Creates a new JSON web token por provided API key
  *
  * @param ApiKey $apiKey
  * @param int $lifetime
  * @return string
  */
 public function create(ApiKey $apiKey, $lifetime = self::DEFAULT_LIFETIME)
 {
     $currentTimestamp = time();
     return $this->encode(['iss' => $this->appOptions->__toString(), 'iat' => $currentTimestamp, 'exp' => $currentTimestamp + $lifetime, 'sub' => 'auth', 'key' => $apiKey->getId()]);
 }