Exemple #1
0
def session_setup(session, path, index=0):
    _keys = session.keys()
    for key in _keys:
        if key.startswith("_"):
            continue
        elif key in [
                "tests", "graph", "flow_names", "response_type", "test_info",
                "profiles"
        ]:  # don't touch !
            continue
        else:
            del session[key]

    ots = OIDCTestSetup(CONF, TEST_FLOWS, str(CONF.PORT))
    session["testid"] = path
    session["node"] = in_tree(session["graph"], path)
    sequence_info = ots.make_sequence(path)
    sequence_info = ots.add_init(sequence_info)
    session["seq_info"] = sequence_info
    trace = Trace()
    client_conf = ots.config.CLIENT
    conv = Conversation(ots.client, client_conf, trace, None, message_factory,
                        check_factory)
    conv.cache = CACHE
    session["ots"] = ots
    session["conv"] = conv
    session["index"] = index
    session["response_type"] = ""

    return conv, sequence_info, ots, trace, index
Exemple #2
0
def session_setup(session, path, index=0):
    _keys = session.keys()
    for key in _keys:
        if key.startswith("_"):
            continue
        elif key in ["tests", "graph", "flow_names", "response_type",
                     "test_info", "profiles"]:  # don't touch !
            continue
        else:
            del session[key]

    ots = OIDCTestSetup(CONF, TEST_FLOWS, str(CONF.PORT))
    session["testid"] = path
    session["node"] = in_tree(session["graph"], path)
    sequence_info = ots.make_sequence(path)
    sequence_info = ots.add_init(sequence_info)
    session["seq_info"] = sequence_info
    trace = Trace()
    client_conf = ots.config.CLIENT
    conv = Conversation(ots.client, client_conf, trace, None,
                        message_factory, check_factory)
    conv.cache = CACHE
    session["ots"] = ots
    session["conv"] = conv
    session["index"] = index
    session["response_type"] = ""

    return conv, sequence_info, ots, trace, index
Exemple #3
0
def verify_support(conv, ots, graph):
    """
    Verifies whether a OP is likely to be able to pass a specific test.
    All based on the checks that are run before the requests within a
    slow is sent.

    :param conv: The conversation
    :param ots: The OIDC RP setup.
    :param graph: A graph representation of the possible test flows.
    """
    for key, val in ots.test_defs.FLOWS.items():
        sequence_info = ots.make_sequence(key)
        for op in sequence_info["sequence"]:
            try:
                req, resp = op
            except TypeError:
                continue

            conv.req = req(conv)
            if issubclass(req, TEST_FLOWS.AccessTokenRequest):
                chk = CheckTokenEndpointAuthMethod()
                res = chk(conv)
                if res["status"] > 1:
                    node = in_tree(graph, key)
                    node.state = 4

            if "pre" in conv.req.tests:
                for test in conv.req.tests["pre"]:
                    do_check = False
                    for check in [
                            CheckTokenEndpointAuthMethod, CheckOPSupported,
                            CheckSupportedTrue, CheckEndpoint,
                            CheckRequestURIParameterSupported,
                            CheckTokenEndpointAuthMethod
                    ]:
                        if issubclass(test, check):
                            do_check = True
                            break

                    if do_check:
                        chk = test()
                        res = chk(conv)
                        if res["status"] > 1:
                            node = in_tree(graph, key)
                            node.state = 4
Exemple #4
0
def verify_support(conv, ots, graph):
    """
    Verifies whether a OP is likely to be able to pass a specific test.
    All based on the checks that are run before the requests within a
    slow is sent.

    :param conv: The conversation
    :param ots: The OIDC RP setup.
    :param graph: A graph representation of the possible test flows.
    """
    for key, val in ots.test_defs.FLOWS.items():
        sequence_info = ots.make_sequence(key)
        for op in sequence_info["sequence"]:
            try:
                req, resp = op
            except TypeError:
                continue

            conv.req = req(conv)
            if issubclass(req, TEST_FLOWS.AccessTokenRequest):
                chk = CheckTokenEndpointAuthMethod()
                res = chk(conv)
                if res["status"] > 1:
                    node = in_tree(graph, key)
                    node.state = 4

            if "pre" in conv.req.tests:
                for test in conv.req.tests["pre"]:
                    do_check = False
                    for check in [CheckTokenEndpointAuthMethod,
                                  CheckOPSupported,
                                  CheckSupportedTrue, CheckEndpoint,
                                  CheckRequestURIParameterSupported,
                                  CheckTokenEndpointAuthMethod]:
                        if issubclass(test, check):
                            do_check = True
                            break

                    if do_check:
                        chk = test()
                        res = chk(conv)
                        if res["status"] > 1:
                            node = in_tree(graph, key)
                            node.state = 4