コード例 #1
0
ファイル: JWTManager.php プロジェクト: dskeba/jwt-auth
 /**
  * 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);
     }
     // return the new token
     return $this->encode($this->payloadFactory->make(['sub' => $payload['sub'], 'iat' => $payload['iat']]));
 }
コード例 #2
0
 /**
  * Register the bindings for the Payload Factory.
  */
 protected function registerPayloadFactory()
 {
     $this->app['tymon.jwt.payload.factory'] = $this->app->share(function ($app) {
         $factory = new PayloadFactory($app['tymon.jwt.claim.factory'], $app['request'], $app['tymon.jwt.validators.payload']);
         return $factory->setTTL($this->config('ttl'));
     });
 }
コード例 #3
0
 /**
  * Set the refresh flow.
  *
  * @param bool $refreshFlow
  * @return $this 
  * @static 
  */
 public static function setRefreshFlow($refreshFlow = true)
 {
     return \Tymon\JWTAuth\PayloadFactory::setRefreshFlow($refreshFlow);
 }