forked from p15670423/monkey
Island: Use MONGO_OBJECT_ID_KEY in MongoCredentialsRepository
This commit is contained in:
parent
bf6125dd55
commit
10d8d8e756
|
@ -7,6 +7,8 @@ from monkey_island.cc.repository import RemovalError, RetrievalError, StorageErr
|
||||||
from monkey_island.cc.repository.i_credentials_repository import ICredentialsRepository
|
from monkey_island.cc.repository.i_credentials_repository import ICredentialsRepository
|
||||||
from monkey_island.cc.server_utils.encryption import ILockableEncryptor
|
from monkey_island.cc.server_utils.encryption import ILockableEncryptor
|
||||||
|
|
||||||
|
from .consts import MONGO_OBJECT_ID_KEY
|
||||||
|
|
||||||
|
|
||||||
class MongoCredentialsRepository(ICredentialsRepository):
|
class MongoCredentialsRepository(ICredentialsRepository):
|
||||||
"""
|
"""
|
||||||
|
@ -51,7 +53,7 @@ class MongoCredentialsRepository(ICredentialsRepository):
|
||||||
collection_result = []
|
collection_result = []
|
||||||
list_collection_result = list(collection.find({}))
|
list_collection_result = list(collection.find({}))
|
||||||
for encrypted_credentials in list_collection_result:
|
for encrypted_credentials in list_collection_result:
|
||||||
del encrypted_credentials["_id"]
|
del encrypted_credentials[MONGO_OBJECT_ID_KEY]
|
||||||
plaintext_credentials = self._decrypt_credentials_mapping(encrypted_credentials)
|
plaintext_credentials = self._decrypt_credentials_mapping(encrypted_credentials)
|
||||||
collection_result.append(Credentials.from_mapping(plaintext_credentials))
|
collection_result.append(Credentials.from_mapping(plaintext_credentials))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue