public function createToken(AuthenticatableContract $user) { $payload = $this->buildTokenPayload($user); $this->builder->unsign(); // set additional payload data foreach ($payload as $key => $value) { $this->builder->set($key, $value); } $now = time(); $lifespanSecs = $this->config['lifespan'] * 60; return $this->builder->setIssuedAt($now)->setExpiration($now + $lifespanSecs)->sign(new $this->signer(), $this->secret)->getToken(); // Retrieves the generated token }
/** * @test * * @depends signMustKeepAFluentInterface * * @covers Lcobucci\JWT\Builder::unsign */ public function unsignMustRemoveTheSignature(Builder $builder) { $builder->unsign(); $this->assertAttributeSame(null, 'signature', $builder); }