public function authenticate(Request $request): Request
    {
        $now = new \DateTimeImmutable();

        if (!$this->jws || $this->jwsValidTo < $now) {
            $this->jws = $this->signatureGenerator->generate($this->jwt);
            $this->jwsValidTo = $this->jwsLifetime ? ($now)->add($this->jwsLifetime) : $this->jwsValidTo;
        }

        $request = $request->withHeader('authorization', sprintf('bearer %s', $this->jws));

        return $request;
    }
public function authenticate(Request $request): Request
    {
        $now = new \DateTimeImmutable();

        if (!$this->jws || $this->jwsValidTo < $now) {
            $this->jws = $this->signatureGenerator->generate($this->jwt);
            $this->jwsValidTo = $this->jwsLifetime ? ($now)->add($this->jwsLifetime) : $this->jwsValidTo;
        }

        $request = $request->withHeader('authorization', sprintf('bearer %s', $this->jws));

        return $request;
    }
{@inheritdoc}