src/fedoidcmsg/signing_service.py
def sign(self, req, receiver='', iss='', lifetime=0, sign_alg='', aud=None):
        """
        Creates a signed JWT

        :param req: Original metadata statement as a
            :py:class:`MetadataStatement` instance
        :param receiver: The intended audience for the JWS
        :param iss: Issuer or the JWT
        :param lifetime: Lifetime of the signature
        :param sign_alg: Which signature algorithm to use
        :param aud: The audience, a list of receivers.
        :return: A signed JWT
        """
        if not sign_alg:
            for key_type, s_alg in [('RSA', 'RS256'), ('EC', 'ES256')]:
                if self.keyjar.get_signing_key(key_type=key_type):
                    sign_alg = s_alg
                    break

        if not sign_alg:
            raise NoSigningKeys('Could not find any signing keys')

        return self.pack(req=req, receiver=receiver, iss=iss, lifetime=lifetime,
                         sign=True, encrypt=False, sign_alg=sign_alg)
def sign(self, req, receiver='', iss='', lifetime=0, sign_alg='', aud=None):
        """
        Creates a signed JWT

        :param req: Original metadata statement as a
            :py:class:`MetadataStatement` instance
        :param receiver: The intended audience for the JWS
        :param iss: Issuer or the JWT
        :param lifetime: Lifetime of the signature
        :param sign_alg: Which signature algorithm to use
        :param aud: The audience, a list of receivers.
        :return: A signed JWT
        """
        if not sign_alg:
            for key_type, s_alg in [('RSA', 'RS256'), ('EC', 'ES256')]:
                if self.keyjar.get_signing_key(key_type=key_type):
                    sign_alg = s_alg
                    break

        if not sign_alg:
            raise NoSigningKeys('Could not find any signing keys')

        return self.pack(req=req, receiver=receiver, iss=iss, lifetime=lifetime,
                         sign=True, encrypt=False, sign_alg=sign_alg)
Creates a signed JWT

        :param req: Original metadata statement as a
            :py:class:`MetadataStatement` instance
        :param receiver: The intended audience for the JWS
        :param iss: Issuer or the JWT
        :param lifetime: Lifetime of the signature
        :param sign_alg: Which signature algorithm to use
        :param aud: The audience, a list of receivers.
        :return: A signed JWT