예제 #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)