src/fedoidcmsg/entity.py
def add_sms_spec_to_request(self, req, federation='', loes=None,
                                context='', url=''):
        """
        Add signed metadata statements to the request

        :param req: The request so far
        :param federation: If only signed metadata statements from a specific
            set of federations should be included this is the set.
        :param loes: - not used -
        :param context: What kind of request/response it is: 'registration',
            'discovery' or 'response'. The later being registration response.
        :param url: Just for testing !!
        :return: A possibly augmented request.
        """
        # fetch the signed metadata statement collection

        if federation:
            if not isinstance(federation, list):
                federation = [federation]

        if not url:
            url = "{}/getsmscol/{}/{}".format(self.mdss_endpoint, context,
                                              quote_plus(self.entity_id))

        http_resp = self.httpcli(method='GET', url=url, verify=self.verify_ssl)

        if http_resp.status_code >= 400:
            raise ConnectionError('HTTP Error: {}'.format(http_resp.text))

        msg = JsonWebToken().from_jwt(http_resp.text, keyjar=self.mdss_keys)

        if msg['iss'] != self.mdss_owner:
            raise KeyError('Wrong iss')

        if federation:
            _sms = dict(
                [(fo, _ms) for fo, _ms in msg.items() if fo in federation])
        else:
            _sms = msg.extra()
            try:
                del _sms['kid']
            except KeyError:
                pass

        req.update({'metadata_statement_uris': _sms})
        return req
def add_sms_spec_to_request(self, req, federation='', loes=None,
                                context='', url=''):
        """
        Add signed metadata statements to the request

        :param req: The request so far
        :param federation: If only signed metadata statements from a specific
            set of federations should be included this is the set.
        :param loes: - not used -
        :param context: What kind of request/response it is: 'registration',
            'discovery' or 'response'. The later being registration response.
        :param url: Just for testing !!
        :return: A possibly augmented request.
        """
        # fetch the signed metadata statement collection

        if federation:
            if not isinstance(federation, list):
                federation = [federation]

        if not url:
            url = "{}/getsmscol/{}/{}".format(self.mdss_endpoint, context,
                                              quote_plus(self.entity_id))

        http_resp = self.httpcli(method='GET', url=url, verify=self.verify_ssl)

        if http_resp.status_code >= 400:
            raise ConnectionError('HTTP Error: {}'.format(http_resp.text))

        msg = JsonWebToken().from_jwt(http_resp.text, keyjar=self.mdss_keys)

        if msg['iss'] != self.mdss_owner:
            raise KeyError('Wrong iss')

        if federation:
            _sms = dict(
                [(fo, _ms) for fo, _ms in msg.items() if fo in federation])
        else:
            _sms = msg.extra()
            try:
                del _sms['kid']
            except KeyError:
                pass

        req.update({'metadata_statement_uris': _sms})
        return req
def add_sms_spec_to_request ( self , req , federation = '' , loes = None , context = '' , url = '' ) : # fetch the signed metadata statement collection if federation : if not isinstance ( federation , list ) : federation = [ federation ] if not url : url = "{}/getsmscol/{}/{}" . format ( self . mdss_endpoint , context , quote_plus ( self . entity_id ) ) http_resp = self . httpcli ( method = 'GET' , url = url , verify = self . verify_ssl ) if http_resp . status_code >= 400 : raise ConnectionError ( 'HTTP Error: {}' . format ( http_resp . text ) ) msg = JsonWebToken ( ) . from_jwt ( http_resp . text , keyjar = self . mdss_keys ) if msg [ 'iss' ] != self . mdss_owner : raise KeyError ( 'Wrong iss' ) if federation : _sms = dict ( [ ( fo , _ms ) for fo , _ms in msg . items ( ) if fo in federation ] ) else : _sms = msg . extra ( ) try : del _sms [ 'kid' ] except KeyError : pass req . update ( { 'metadata_statement_uris' : _sms } ) return req
Add signed metadata statements to the request

        :param req: The request so far
        :param federation: If only signed metadata statements from a specific
            set of federations should be included this is the set.
        :param loes: - not used -
        :param context: What kind of request/response it is: 'registration',
            'discovery' or 'response'. The later being registration response.
        :param url: Just for testing !!
        :return: A possibly augmented request.
Add signed metadata statements to the request