Ejemplo n.º 1
0
def handle_get_op_config(session, response_encoder):
    """
    Handles the get config Gui structure request
    :return A configuration Gui structure which is based on the configuration
    file saved in the session
    """
    if OP_CONFIG in session:
        try:
            _op_config = session[OP_CONFIG]
        except KeyError:
            _op_config = None

        if not isinstance(_op_config, dict):
            raise InvalidConfigType(
                "Failed to load the configuration file. "
                "Please check if the stored configuration is a valid "
                "json file.")

        config_gui_structure = convert_config_file(_op_config)
        config_gui_structure = set_issuer(session[ISSUER_QUERY_KEY],
                                          config_gui_structure)
        return response_encoder.return_json(json.dumps(config_gui_structure))

    raise MissingSessionInformation(
        "Failed to load the configuration from the current session.")
Ejemplo n.º 2
0
def handle_get_op_config(session, response_encoder):
    """
    Handles the get config Gui structure request
    :return A configuration Gui structure which is based on the configuration
    file saved in the session
    """
    if OP_CONFIG in session:
        try:
            _op_config = session[OP_CONFIG]
        except KeyError:
            _op_config = None

        if not isinstance(_op_config, dict):
            raise InvalidConfigType("Failed to load the configuration file. "
                                    "Please check if the stored configuration is a valid "
                                    "json file.")

        config_gui_structure = convert_config_file(_op_config)
        config_gui_structure = set_issuer(session[ISSUER_QUERY_KEY], config_gui_structure)
        return response_encoder.return_json(json.dumps(config_gui_structure))

    raise MissingSessionInformation("Failed to load the configuration from the current session.")
Ejemplo n.º 3
0
 def test_set_static_and_dynamic_disco_issuer(self):
     config = set_issuer(ISSUER, create_new_configuration_dict())
     gui_config = GuiConfig(config)
     assert ISSUER == gui_config.get_static_discovery_issuer()
     assert ISSUER == gui_config.get_dynamic_discovery_issuer()