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()));
    }
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()));
    }
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 ( ) ) ) ; }
Gets the signed JWT for a subject

@param ISubject $subject The subject whose credential we're creating
@return SignedJwt The signed JWT
Gets the signed JWT for a subject