How to use the satosa.satosa_config.SATOSAConfig function in SATOSA

To help you get started, we’ve selected a few SATOSA examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IdentityPython / SATOSA / tests / satosa / test_base.py View on Github external
def satosa_config(self, satosa_config_dict):
        return SATOSAConfig(satosa_config_dict)
github IdentityPython / SATOSA / tests / satosa / test_satosa_config.py View on Github external
def test_can_read_endpoint_configs_from_dict(self, satosa_config_dict, modules_key):
        expected_config = [{"foo": "bar"}, {"abc": "xyz"}]
        satosa_config_dict[modules_key] = expected_config

        config = SATOSAConfig(satosa_config_dict)
        assert config[modules_key] == expected_config
github IdentityPython / SATOSA / tests / satosa / test_satosa_config.py View on Github external
def test_can_read_endpoint_configs_from_file(self, satosa_config_dict, modules_key):
        satosa_config_dict[modules_key] = ["/fake_file_path"]
        expected_config = {"foo": "bar"}

        with patch("builtins.open", mock_open(read_data=json.dumps(expected_config))):
            config = SATOSAConfig(satosa_config_dict)

        assert config[modules_key] == [expected_config]
github IdentityPython / SATOSA / tests / satosa / test_satosa_config.py View on Github external
def test_read_senstive_config_data_from_env_var(self, monkeypatch, non_sensitive_config_dict):
        monkeypatch.setenv("SATOSA_STATE_ENCRYPTION_KEY", "state_encryption_key")
        config = SATOSAConfig(non_sensitive_config_dict)
        assert config["STATE_ENCRYPTION_KEY"] == "state_encryption_key"
github IdentityPython / SATOSA / tools / make_satosa_saml_metadata.py View on Github external
def make_satosa_metadata(option):
    """
    Creates metadata files from a VOPaaS proxy config
    :type option: MetadataOption
    :param option: The creation settings
    """
    conf_mod = SATOSAConfig(option.config_file)

    frontend_modules = load_frontends(conf_mod, None, conf_mod.INTERNAL_ATTRIBUTES).values()
    backend_modules = load_backends(conf_mod, None, conf_mod.INTERNAL_ATTRIBUTES).values()

    frontend_names = [p.name for p in frontend_modules]
    backend_names = [p.name for p in backend_modules]
    logger.info("Loaded frontend plugins: {}".format(frontend_names))
    logger.info("Loaded backend plugins: {}".format(backend_names))

    backend_metadata = {}
    if option.generate_backend:
        for plugin_module in backend_modules:
            if isinstance(plugin_module, SAMLBackend):
                logger.info("Generating saml backend '%s' metadata..." % plugin_module.name)
                backend_metadata[plugin_module.name] = _make_metadata(plugin_module.config["config"], option)
github IdentityPython / SATOSA / example / proxy_server.py View on Github external
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('-d', action='store_true', dest="debug",
                        help="Enable debug mode.")
    parser.add_argument('-e', dest="entityid",
                        help="Entity id for the underlying IdP. If not "
                             "specified, a discovery server will be used "
                             "instead.")
    parser.add_argument(dest="proxy_config",
                        help="Configuration file for the SATOSA proxy.")
    args = parser.parse_args()

    sys.path.insert(0, os.getcwd())

    server_config = SATOSAConfig(args.proxy_config)

    base_formatter = logging.Formatter("[%(asctime)-19.19s] [%(levelname)-5.5s]: %(message)s")

    satosa_logger = logging.getLogger("satosa")
    hdlr = logging.FileHandler("satosa.log")
    hdlr.setFormatter(base_formatter)
    satosa_logger.addHandler(hdlr)
    satosa_logger.setLevel(logging.DEBUG)

    satosa_logger = logging.getLogger("cherrypy")
    hdlr = logging.FileHandler("cherrypy.log")
    hdlr.setFormatter(base_formatter)
    satosa_logger.addHandler(hdlr)
    satosa_logger.setLevel(logging.DEBUG)

    wsgi_app = WsgiApplication(server_config, args.debug).run_server