protected function getSignedJwt(ISubject $subject) : SignedJwt
    {
        $jwtPayload = new JwtPayload();
        $jwtPayload->setIssuer($this->issuer);
        $jwtPayload->setAudience($this->audience);
        $jwtPayload->setSubject($subject->getPrimaryPrincipal()->getId());
        $jwtPayload->setValidFrom((new DateTimeImmutable)->add($this->validFromInterval));
        $jwtPayload->setValidTo((new DateTimeImmutable)->add($this->validToInterval));
        $jwtPayload->setIssuedAt(new DateTimeImmutable());
        $this->addCustomClaims($jwtPayload, $subject);
        $unsignedJwt = new UnsignedJwt(new JwtHeader(), $jwtPayload);

        return SignedJwt::createFromUnsignedJwt($unsignedJwt, $this->signer->sign($unsignedJwt->getUnsignedValue()));
    }