From dc1eb5f12cf40027082734d32e65c90ce1574300 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Wed, 6 Jul 2022 12:58:23 +0200 Subject: [PATCH] Island: Use ICredentialsRepository to retrieve propagation credentials --- .../cc/resources/propagation_credentials.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/monkey/monkey_island/cc/resources/propagation_credentials.py b/monkey/monkey_island/cc/resources/propagation_credentials.py index d2d03730c..43dca03ba 100644 --- a/monkey/monkey_island/cc/resources/propagation_credentials.py +++ b/monkey/monkey_island/cc/resources/propagation_credentials.py @@ -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})