예제 #1
0
 /**
  * Refresh a Token and return a new Token.
  *
  * @param  \Tymon\JWTAuth\Token  $token
  *
  * @return \Tymon\JWTAuth\Token
  */
 public function refresh(Token $token)
 {
     $payload = $this->setRefreshFlow()->decode($token);
     if ($this->blacklistEnabled) {
         // invalidate old token
         $this->blacklist->add($payload);
     }
     // persist the subject and issued at claims
     $claims = array_merge($this->customClaims, ['sub' => $payload['sub'], 'iat' => $payload['iat']]);
     // return the new token
     return $this->encode($this->payloadFactory->customClaims($claims)->make());
 }
예제 #2
0
 /**
  * Register the bindings for the Payload Factory
  */
 protected function registerPayloadFactory()
 {
     $this->app->singleton('tymon.jwt.payload.factory', function ($app) {
         $factory = new Factory(new ClaimFactory(), $app['request'], $app['tymon.jwt.validators.payload']);
         return $factory->setTTL($this->config('ttl'));
     });
 }