コード例 #1
0
    def none_request_response(self, sequence_info, index, session, conv):
        req_c, arg = sequence_info["sequence"][index]
        req = req_c()
        if isinstance(req, Notice):
            kwargs = {
                "url":
                "%scontinue?path=%s&index=%d" %
                (self.conf.BASE, session["testid"], session["index"]),
                "back":
                self.conf.BASE
            }
            try:
                kwargs["url"] += "&ckey=%s" % session["ckey"]
            except KeyError:
                pass
            try:
                kwargs["note"] = session["node"].kwargs["note"]
            except KeyError:
                pass
            try:
                kwargs["op"] = conv.client.provider_info["issuer"]
            except (KeyError, TypeError):
                pass

            if isinstance(req, DisplayUserInfo):
                for presp, _ in conv.protocol_response:
                    if isinstance(presp, OpenIDSchema):
                        kwargs["table"] = presp
                        break
            elif isinstance(req, DisplayIDToken):
                instance, _ = get_protocol_response(conv,
                                                    AccessTokenResponse)[0]
                kwargs["table"] = instance["id_token"]
            else:
                kwargs["table"] = {}

            try:
                key = req.cache(self.cache, conv, sequence_info["cache"])
            except KeyError:
                pass
            else:
                kwargs["url"] += "&key=%s" % key

            return req(self.lookup, self.environ, self.start_response,
                       **kwargs)
        else:
            try:
                return req(conv)
            except RequirementsNotMet as err:
                return self.err_response(session, "run_sequence", err)
コード例 #2
0
ファイル: oprp.py プロジェクト: rohe/oictest
    def none_request_response(self, sequence_info, index, session, conv):
        req_c, arg = sequence_info["sequence"][index]
        req = req_c()
        if isinstance(req, Notice):
            kwargs = {
                "url": "%scontinue?path=%s&index=%d" % (
                    self.conf.BASE, session["testid"], session["index"]),
                "back": self.conf.BASE}
            try:
                kwargs["url"] += "&ckey=%s" % session["ckey"]
            except KeyError:
                pass
            try:
                kwargs["note"] = session["node"].kwargs["note"]
            except KeyError:
                pass
            try:
                kwargs["op"] = conv.client.provider_info["issuer"]
            except (KeyError, TypeError):
                pass

            if isinstance(req, DisplayUserInfo):
                for presp, _ in conv.protocol_response:
                    if isinstance(presp, OpenIDSchema):
                        kwargs["table"] = presp
                        break
            elif isinstance(req, DisplayIDToken):
                instance, _ = get_protocol_response(
                    conv, AccessTokenResponse)[0]
                kwargs["table"] = instance["id_token"]
            else:
                kwargs["table"] = {}

            try:
                key = req.cache(self.cache, conv, sequence_info["cache"])
            except KeyError:
                pass
            else:
                kwargs["url"] += "&key=%s" % key

            return req(self.lookup, self.environ, self.start_response, **kwargs)
        else:
            try:
                return req(conv)
            except RequirementsNotMet as err:
                return self.err_response(session, "run_sequence", err)
コード例 #3
0
ファイル: oprp.py プロジェクト: simudream/oictest
def none_request_response(sequence_info, index, session, conv, environ,
                          start_response):
    req = sequence_info["sequence"][index]()
    if isinstance(req, TEST_FLOWS.Notice):
        kwargs = {
            "url":
            "%scontinue?path=%s&index=%d" %
            (CONF.BASE, session["testid"], session["index"]),
            "back":
            CONF.BASE
        }
        try:
            kwargs["note"] = sequence_info["note"]
        except KeyError:
            pass
        try:
            kwargs["op"] = conv.client.provider_info["issuer"]
        except (KeyError, TypeError):
            pass

        if isinstance(req, TEST_FLOWS.DisplayUserInfo):
            for presp, _ in conv.protocol_response:
                if isinstance(presp, OpenIDSchema):
                    kwargs["table"] = presp
                    break
        elif isinstance(req, TEST_FLOWS.DisplayIDToken):
            instance, _ = get_protocol_response(conv, AccessTokenResponse)[0]
            kwargs["table"] = instance["id_token"]

        try:
            key = req.cache(CACHE, conv, sequence_info["cache"])
        except KeyError:
            pass
        else:
            kwargs["url"] += "&key=%s" % key

        return req(LOOKUP, environ, start_response, **kwargs)
    else:
        try:
            req(conv)
            return None
        except TEST_FLOWS.RequirementsNotMet as err:
            return err_response(environ, start_response, session,
                                "run_sequence", err)
コード例 #4
0
ファイル: oprp.py プロジェクト: dallerbarn/oictest
def none_request_response(sequence_info, index, session, conv, environ,
                          start_response):
    req = sequence_info["sequence"][index]()
    if isinstance(req, TEST_FLOWS.Notice):
        kwargs = {
            "url": "%scontinue?path=%s&index=%d" % (
                CONF.BASE, session["testid"], session["index"]),
            "back": CONF.BASE}
        try:
            kwargs["note"] = sequence_info["note"]
        except KeyError:
            pass
        try:
            kwargs["op"] = conv.client.provider_info["issuer"]
        except (KeyError, TypeError):
            pass

        if isinstance(req, TEST_FLOWS.DisplayUserInfo):
            for presp, _ in conv.protocol_response:
                if isinstance(presp, OpenIDSchema):
                    kwargs["table"] = presp
                    break
        elif isinstance(req, TEST_FLOWS.DisplayIDToken):
            instance, _ = get_protocol_response(
                conv, AccessTokenResponse)[0]
            kwargs["table"] = instance["id_token"]

        try:
            key = req.cache(CACHE, conv, sequence_info["cache"])
        except KeyError:
            pass
        else:
            kwargs["url"] += "&key=%s" % key

        return req(LOOKUP, environ, start_response, **kwargs)
    else:
        try:
            req(conv)
            return None
        except TEST_FLOWS.RequirementsNotMet as err:
            return err_response(environ, start_response, session,
                                "run_sequence", err)