diff --git a/monkey/monkey_island/cc/services/authentication/authentication_service.py b/monkey/monkey_island/cc/services/authentication/authentication_service.py index 9e52a2649..8e825fbea 100644 --- a/monkey/monkey_island/cc/services/authentication/authentication_service.py +++ b/monkey/monkey_island/cc/services/authentication/authentication_service.py @@ -13,12 +13,12 @@ from monkey_island.cc.server_utils.encryption import ( ) from monkey_island.cc.setup.mongo.database_initializer import reset_database -from .i_user_datastore import IUserDatastore +from .i_user_datastore import IUserRepository from .user_creds import UserCreds class AuthenticationService: - def __init__(self, data_dir: Path, user_datastore: IUserDatastore): + def __init__(self, data_dir: Path, user_datastore: IUserRepository): self._data_dir = data_dir self._user_datastore = user_datastore diff --git a/monkey/monkey_island/cc/services/authentication/i_user_datastore.py b/monkey/monkey_island/cc/services/authentication/i_user_datastore.py index 38e93922e..c25c11ee6 100644 --- a/monkey/monkey_island/cc/services/authentication/i_user_datastore.py +++ b/monkey/monkey_island/cc/services/authentication/i_user_datastore.py @@ -3,7 +3,7 @@ import abc from .user_creds import UserCreds -class IUserDatastore(metaclass=abc.ABCMeta): +class IUserRepository(metaclass=abc.ABCMeta): """ Allows user credentials to be stored and retrieved. """ diff --git a/monkey/monkey_island/cc/services/authentication/json_file_user_datastore.py b/monkey/monkey_island/cc/services/authentication/json_file_user_datastore.py index ff66a7c9b..8ac3e35d7 100644 --- a/monkey/monkey_island/cc/services/authentication/json_file_user_datastore.py +++ b/monkey/monkey_island/cc/services/authentication/json_file_user_datastore.py @@ -8,13 +8,13 @@ from common.utils.exceptions import ( ) from monkey_island.cc.server_utils.file_utils import open_new_securely_permissioned_file -from .i_user_datastore import IUserDatastore +from .i_user_datastore import IUserRepository from .user_creds import UserCreds CREDENTIALS_FILE = "credentials.json" -class JsonFileUserDatastore(IUserDatastore): +class JsonFileUserDatastore(IUserRepository): def __init__(self, data_dir: Path): self._credentials = None self._credentials_file = data_dir / CREDENTIALS_FILE diff --git a/monkey/monkey_island/cc/services/initialize.py b/monkey/monkey_island/cc/services/initialize.py index 54148e2a1..02068c382 100644 --- a/monkey/monkey_island/cc/services/initialize.py +++ b/monkey/monkey_island/cc/services/initialize.py @@ -41,7 +41,7 @@ from monkey_island.cc.services.telemetry.processing.processing import ( from monkey_island.cc.setup.mongo.mongo_setup import MONGO_URL from . import AuthenticationService, JsonFileUserDatastore -from .authentication.i_user_datastore import IUserDatastore +from .authentication.i_user_datastore import IUserRepository from .reporting.report import ReportService logger = logging.getLogger(__name__) @@ -95,7 +95,7 @@ def _register_repositories(container: DIContainer, data_dir: Path): container.register_instance( ICredentialsRepository, container.resolve(MongoCredentialsRepository) ) - container.register_instance(IUserDatastore, container.resolve(JsonFileUserDatastore)) + container.register_instance(IUserRepository, container.resolve(JsonFileUserDatastore)) def _decorate_file_repository(file_repository: IFileRepository) -> IFileRepository: diff --git a/monkey/tests/unit_tests/monkey_island/cc/services/test_authentication_service.py b/monkey/tests/unit_tests/monkey_island/cc/services/test_authentication_service.py index 402f77616..673d9ab33 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/services/test_authentication_service.py +++ b/monkey/tests/unit_tests/monkey_island/cc/services/test_authentication_service.py @@ -10,7 +10,7 @@ from common.utils.exceptions import ( ) from monkey_island.cc.services import AuthenticationService from monkey_island.cc.services.authentication import authentication_service -from monkey_island.cc.services.authentication.i_user_datastore import IUserDatastore +from monkey_island.cc.services.authentication.i_user_datastore import IUserRepository from monkey_island.cc.services.authentication.user_creds import UserCreds USERNAME = "user1" @@ -18,7 +18,7 @@ PASSWORD = "test" PASSWORD_HASH = "$2b$12$YsGjjuJFddYJ6z5S5/nMCuKkCzKHB1AWY9SXkQ02i25d8TgdhIRS2" -class MockUserDatastore(IUserDatastore): +class MockUserDatastore(IUserRepository): def __init__(self, has_registered_users, add_user, get_user_credentials): self._has_registered_users = has_registered_users self._add_user = add_user