src/fedoidcmsg/entity.py
def self_sign(self, req, receiver='', aud=None):
        """
        Sign the extended request.

        :param req: Request, a :py:class:`fedoidcmsg.MetadataStatement' instance
        :param receiver: The intended user of this metadata statement
        :param aud: The audience, a list of receivers.
        :return: An augmented set of request arguments
        """
        if self.entity_id:
            _iss = self.entity_id
        else:
            _iss = self.iss

        creq = req.copy()
        if not 'metadata_statement_uris' in creq and not \
                'metadata_statements' in creq:
            _copy = creq.copy()
            _jws = self.self_signer.sign(_copy, receiver=receiver, iss=_iss,
                                         aud=aud)
            sms_spec = {'metadata_statements': {self.iss: _jws}}
        else:
            for ref in ['metadata_statement_uris', 'metadata_statements']:
                try:
                    del creq[ref]
                except KeyError:
                    pass

            sms_spec = {'metadata_statements': Message()}

            for ref in ['metadata_statement_uris', 'metadata_statements']:
                if ref not in req:
                    continue

                for foid, value in req[ref].items():
                    _copy = creq.copy()
                    _copy[ref] = Message()
                    _copy[ref][foid] = value
                    _jws = self.self_signer.sign(_copy, receiver=receiver,
                                                 iss=_iss, aud=aud)
                    sms_spec['metadata_statements'][foid] = _jws

        creq.update(sms_spec)
        return creq
def self_sign(self, req, receiver='', aud=None):
        if self.entity_id:
            _iss = self.entity_id
        else:
            _iss = self.iss

        creq = req.copy()
        if not 'metadata_statement_uris' in creq and not \
                'metadata_statements' in creq:
            _copy = creq.copy()
            _jws = self.self_signer.sign(_copy, receiver=receiver, iss=_iss,
                                         aud=aud)
            sms_spec = {'metadata_statements': {self.iss: _jws}}
        else:
            for ref in ['metadata_statement_uris', 'metadata_statements']:
                try:
                    del creq[ref]
                except KeyError:
                    pass

            sms_spec = {'metadata_statements': Message()}

            for ref in ['metadata_statement_uris', 'metadata_statements']:
                if ref not in req:
                    continue

                for foid, value in req[ref].items():
                    _copy = creq.copy()
                    _copy[ref] = Message()
                    _copy[ref][foid] = value
                    _jws = self.self_signer.sign(_copy, receiver=receiver,
                                                 iss=_iss, aud=aud)
                    sms_spec['metadata_statements'][foid] = _jws

        creq.update(sms_spec)
        return creq
def self_sign ( self , req , receiver = '' , aud = None ) : if self . entity_id : _iss = self . entity_id else : _iss = self . iss creq = req . copy ( ) if not 'metadata_statement_uris' in creq and not 'metadata_statements' in creq : _copy = creq . copy ( ) _jws = self . self_signer . sign ( _copy , receiver = receiver , iss = _iss , aud = aud ) sms_spec = { 'metadata_statements' : { self . iss : _jws } } else : for ref in [ 'metadata_statement_uris' , 'metadata_statements' ] : try : del creq [ ref ] except KeyError : pass sms_spec = { 'metadata_statements' : Message ( ) } for ref in [ 'metadata_statement_uris' , 'metadata_statements' ] : if ref not in req : continue for foid , value in req [ ref ] . items ( ) : _copy = creq . copy ( ) _copy [ ref ] = Message ( ) _copy [ ref ] [ foid ] = value _jws = self . self_signer . sign ( _copy , receiver = receiver , iss = _iss , aud = aud ) sms_spec [ 'metadata_statements' ] [ foid ] = _jws creq . update ( sms_spec ) return creq
Sign the extended request.

        :param req: Request, a :py:class:`fedoidcmsg.MetadataStatement' instance
        :param receiver: The intended user of this metadata statement
        :param aud: The audience, a list of receivers.
        :return: An augmented set of request arguments
Sign the extended request .