def create_and_sign_jwt(certificate, private_key)
      JWT.encode(payload, private_key, RS256, header(certificate))
    end
def create_and_sign_jwt(certificate, private_key)
      JWT.encode(payload, private_key, RS256, header(certificate))
    end
Constructs a new SelfSignedJwtFactory.

 @param String client_id
   The client id of the calling application.
 @param String token_endpoint
   The token endpoint that will accept the certificate.

 Creates a JWT from a client certificate and signs it with a private key.

 @param OpenSSL::X509::Certificate certificate
   The certifcate object to be converted to a JWT and signed for use
   in an authentication flow.
 @param OpenSSL::PKey::RSA private_key
   The private key used to sign the certificate.
 @return String