Island: Use ICredentialsRepository to retrieve propagation credentials

This commit is contained in:
Ilija Lazoroski 2022-07-06 12:58:23 +02:00
parent 45b2558ddd
commit dc1eb5f12c
1 changed files with 8 additions and 7 deletions

View File

@ -1,15 +1,16 @@
from flask import make_response
from monkey_island.cc.repository import ICredentialsRepository
from monkey_island.cc.resources.AbstractResource import AbstractResource
from monkey_island.cc.services.config import ConfigService
class PropagationCredentials(AbstractResource):
urls = ["/api/propagation-credentials"]
def __init__(self, credentials_repository: ICredentialsRepository):
self._credentials_repository = credentials_repository
def get(self):
config = ConfigService.get_flat_config(should_decrypt=True)
propagation_credentials = self._credentials_repository.get_all_credentials()
propagation_credentials = ConfigService.get_config_propagation_credentials_from_flat_config(
config
)
return {"propagation_credentials": propagation_credentials}
return make_response({"propagation_credentials": propagation_credentials})