Exemple #1
0
 /**
  * Claims is an additional set of claims supplied by end-user
  * There are default claims in Payload class
  * If end-user supplies claims with same name as default claims, the default claims in the Payload class will be overwritten
  *
  * @param array $claims
  * @return string
  */
 public function create(array $claims = array())
 {
     $this->payload->setClaims($claims);
     $this->jws->setPayload($this->payload->getPayload());
     $algo = $this->algoFactory->make();
     $this->jws->sign($algo->getKeyForSigning());
     $this->jti->create(['jti' => $this->payload->getClaim('jti'), 'exp' => $this->payload->getClaim('exp')]);
     return $this->jws->getTokenString();
 }