示例#1
0
文件: client.py 项目: vkadam/pysaml2
    def do_assertion_id_request(self,
                                assertion_ids,
                                entity_id,
                                consent=None,
                                extensions=None,
                                sign=False):

        srvs = self.metadata.assertion_id_request_service(
            entity_id, BINDING_SOAP)
        if not srvs:
            raise NoServiceDefined("%s: %s" %
                                   (entity_id, "assertion_id_request_service"))

        if isinstance(assertion_ids, six.string_types):
            assertion_ids = [assertion_ids]

        _id_refs = [AssertionIDRef(_id) for _id in assertion_ids]

        for destination in locations(srvs):
            res = self._use_soap(destination,
                                 "assertion_id_request",
                                 assertion_id_refs=_id_refs,
                                 consent=consent,
                                 extensions=extensions,
                                 sign=sign)
            if res:
                return res

        return None
示例#2
0
    def create_assertion_id_request(self,
                                    assertion_id_refs,
                                    destination=None,
                                    id=0,
                                    consent=None,
                                    extensions=None,
                                    sign=False):
        """

        :param assertion_id_refs:
        :param destination: The IdP endpoint to send the request to
        :param id: Message identifier
        :param consent: If the principal gave her consent to this request
        :param extensions: Possible request extensions
        :param sign: Whether the request should be signed or not.
        :return: AssertionIDRequest instance
        """
        id_refs = [AssertionIDRef(text=s) for s in assertion_id_refs]

        return self._message(AssertionIDRequest,
                             destination,
                             id,
                             consent,
                             extensions,
                             sign,
                             assertion_id_refs=id_refs)