def __init__(self): user_folder = conan_expand_user("~") server_folder = os.path.join(user_folder, '.conan_server') server_config = migrate_and_get_server_config(user_folder) custom_auth = server_config.custom_authenticator if custom_auth: authenticator = load_authentication_plugin(server_folder, custom_auth) else: authenticator = BasicAuthenticator(dict(server_config.users)) authorizer = BasicAuthorizer(server_config.read_permissions, server_config.write_permissions) credentials_manager = JWTCredentialsManager( server_config.jwt_secret, server_config.jwt_expire_time) updown_auth_manager = JWTUpDownAuthManager( server_config.updown_secret, server_config.authorize_timeout) file_manager = get_file_manager( server_config, updown_auth_manager=updown_auth_manager) search_adapter = DiskSearchAdapter() search_manager = DiskSearchManager( SimplePaths(server_config.disk_storage_path), search_adapter) server_capabilities = SERVER_CAPABILITIES self.ra = ConanServer(server_config.port, credentials_manager, updown_auth_manager, authorizer, authenticator, file_manager, search_manager, Version(SERVER_VERSION), Version(MIN_CLIENT_COMPATIBLE_VERSION), server_capabilities)
def __init__(self, base_path=None, read_permissions=None, write_permissions=None, users=None, base_url=None, plugins=None, server_version=None, min_client_compatible_version=None, server_capabilities=None): plugins = plugins or [] if not base_path: base_path = temp_folder() if server_capabilities is None: server_capabilities = SERVER_CAPABILITIES # Default enabled if not os.path.exists(base_path): raise Exception("Base path not exist! %s") # Define storage_folder, if not, it will be readed from conf file and pointed to real user home self.storage_folder = os.path.join(base_path, ".conan_server", "data") mkdir(self.storage_folder) server_config = migrate_and_get_server_config(base_path, self.storage_folder) if TestServerLauncher.port == 0: TestServerLauncher.port = server_config.port # Encode and Decode signature for Upload and Download service updown_auth_manager = JWTUpDownAuthManager(server_config.updown_secret, server_config.authorize_timeout) self.file_manager = get_file_manager(server_config, public_url=base_url, updown_auth_manager=updown_auth_manager) self.search_manager = DiskSearchManager(SimplePaths(server_config.disk_storage_path)) # Prepare some test users if not read_permissions: read_permissions = server_config.read_permissions read_permissions.append(("private_library/1.0.0@private_user/testing", "*")) read_permissions.append(("*/*@*/*", "*")) if not write_permissions: write_permissions = server_config.write_permissions if not users: users = dict(server_config.users) users[TESTING_REMOTE_PRIVATE_USER] = TESTING_REMOTE_PRIVATE_PASS authorizer = BasicAuthorizer(read_permissions, write_permissions) authenticator = BasicAuthenticator(users) credentials_manager = JWTCredentialsManager(server_config.jwt_secret, server_config.jwt_expire_time) logger.debug("Storage path: %s" % self.storage_folder) self.port = TestServerLauncher.port self.ra = ConanServer(self.port, credentials_manager, updown_auth_manager, authorizer, authenticator, self.file_manager, self.search_manager, server_version, min_client_compatible_version, server_capabilities) for plugin in plugins: self.ra.api_v1.install(plugin)
def __init__(self): user_folder = conan_expand_user("~") server_folder = os.path.join(user_folder, '.conan_server') server_config = migrate_and_get_server_config(user_folder) custom_auth = server_config.custom_authenticator if custom_auth: authenticator = load_authentication_plugin(server_folder, custom_auth) else: authenticator = BasicAuthenticator(dict(server_config.users)) authorizer = BasicAuthorizer(server_config.read_permissions, server_config.write_permissions) credentials_manager = JWTCredentialsManager(server_config.jwt_secret, server_config.jwt_expire_time) updown_auth_manager = JWTUpDownAuthManager(server_config.updown_secret, server_config.authorize_timeout) file_manager = get_file_manager(server_config, updown_auth_manager=updown_auth_manager) search_manager = DiskSearchManager(SimplePaths(server_config.disk_storage_path)) server_capabilities = SERVER_CAPABILITIES self.ra = ConanServer(server_config.port, credentials_manager, updown_auth_manager, authorizer, authenticator, file_manager, search_manager, Version(SERVER_VERSION), Version(MIN_CLIENT_COMPATIBLE_VERSION), server_capabilities)
def __init__(self): user_folder = conan_expand_user("~") server_config = migrate_and_get_server_config(user_folder) authorizer = BasicAuthorizer(server_config.read_permissions, server_config.write_permissions) authenticator = BasicAuthenticator(dict(server_config.users)) credentials_manager = JWTCredentialsManager( server_config.jwt_secret, server_config.jwt_expire_time) updown_auth_manager = JWTUpDownAuthManager( server_config.updown_secret, server_config.authorize_timeout) file_manager = get_file_manager( server_config, updown_auth_manager=updown_auth_manager) search_adapter = DiskSearchAdapter() search_manager = DiskSearchManager( SimplePaths(server_config.disk_storage_path), search_adapter) self.ra = ConanServer(server_config.port, server_config.ssl_enabled, credentials_manager, updown_auth_manager, authorizer, authenticator, file_manager, search_manager, Version(SERVER_VERSION), Version(MIN_CLIENT_COMPATIBLE_VERSION))
def __init__(self): user_folder = os.path.expanduser("~") server_config = migrate_and_get_server_config(user_folder) authorizer = BasicAuthorizer(server_config.read_permissions, server_config.write_permissions) authenticator = BasicAuthenticator(dict(server_config.users)) credentials_manager = JWTCredentialsManager(server_config.jwt_secret, server_config.jwt_expire_time) updown_auth_manager = JWTUpDownAuthManager(server_config.updown_secret, server_config.authorize_timeout) file_manager = get_file_manager(server_config, updown_auth_manager=updown_auth_manager) self.ra = ConanServer(server_config.port, server_config.ssl_enabled, credentials_manager, updown_auth_manager, authorizer, authenticator, file_manager, Version(SERVER_VERSION), Version(MIN_CLIENT_COMPATIBLE_VERSION))