Island: Rename KEY_FILE_DIRECTORY -> DATA_DIR
Neither the AuthenticationService, nor the function that initializes it needs to know what the data_dir is for. AuthenticationService only needs to know that datastore_encryptor needs it, but not why.
This commit is contained in:
parent
c3412ac58f
commit
5e7a252a6b
|
@ -10,14 +10,14 @@ from monkey_island.cc.setup.mongo.database_initializer import reset_database
|
||||||
|
|
||||||
|
|
||||||
class AuthenticationService:
|
class AuthenticationService:
|
||||||
KEY_FILE_DIRECTORY = None
|
DATA_DIR = None
|
||||||
|
|
||||||
# TODO: A number of these services should be instance objects instead of
|
# TODO: A number of these services should be instance objects instead of
|
||||||
# static/singleton hybrids. At the moment, this requires invasive refactoring that's
|
# static/singleton hybrids. At the moment, this requires invasive refactoring that's
|
||||||
# not a priority.
|
# not a priority.
|
||||||
@classmethod
|
@classmethod
|
||||||
def initialize(cls, key_file_directory):
|
def initialize(cls, data_dir: str):
|
||||||
cls.KEY_FILE_DIRECTORY = key_file_directory
|
cls.DATA_DIR = data_dir
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def needs_registration() -> bool:
|
def needs_registration() -> bool:
|
||||||
|
@ -41,12 +41,12 @@ class AuthenticationService:
|
||||||
@classmethod
|
@classmethod
|
||||||
def _unlock_datastore_encryptor(cls, username: str, password: str):
|
def _unlock_datastore_encryptor(cls, username: str, password: str):
|
||||||
secret = _get_secret_from_credentials(username, password)
|
secret = _get_secret_from_credentials(username, password)
|
||||||
unlock_datastore_encryptor(cls.KEY_FILE_DIRECTORY, secret)
|
unlock_datastore_encryptor(cls.DATA_DIR, secret)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _reset_datastore_encryptor(cls, username: str, password: str):
|
def _reset_datastore_encryptor(cls, username: str, password: str):
|
||||||
secret = _get_secret_from_credentials(username, password)
|
secret = _get_secret_from_credentials(username, password)
|
||||||
reset_datastore_encryptor(cls.KEY_FILE_DIRECTORY, secret)
|
reset_datastore_encryptor(cls.DATA_DIR, secret)
|
||||||
|
|
||||||
|
|
||||||
def _hash_password(plaintext_password):
|
def _hash_password(plaintext_password):
|
||||||
|
|
|
@ -6,4 +6,4 @@ from monkey_island.cc.services.run_local_monkey import LocalMonkeyRunService
|
||||||
def initialize_services(data_dir):
|
def initialize_services(data_dir):
|
||||||
PostBreachFilesService.initialize(data_dir)
|
PostBreachFilesService.initialize(data_dir)
|
||||||
LocalMonkeyRunService.initialize(data_dir)
|
LocalMonkeyRunService.initialize(data_dir)
|
||||||
AuthenticationService.initialize(key_file_directory=data_dir)
|
AuthenticationService.initialize(data_dir)
|
||||||
|
|
Loading…
Reference in New Issue