diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-03-17 16:42:53 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-03-24 16:21:25 +0100 |
commit | 6be7aa112f6174c1406cfef5449836124a7f6f50 (patch) | |
tree | 5029bf9659caeab8702e9fabbbdeb9a2cd849bfa /lib/private/Security | |
parent | fbf1334dc8c192ebdd335663cacfb810daf4d841 (diff) | |
download | nextcloud-server-6be7aa112f6174c1406cfef5449836124a7f6f50.tar.gz nextcloud-server-6be7aa112f6174c1406cfef5449836124a7f6f50.zip |
Migrate from ILogger to LoggerInterface in lib/private
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/Security')
-rw-r--r-- | lib/private/Security/Bruteforce/Throttler.php | 13 | ||||
-rw-r--r-- | lib/private/Security/CertificateManager.php | 18 | ||||
-rw-r--r-- | lib/private/Security/IdentityProof/Manager.php | 7 |
3 files changed, 11 insertions, 27 deletions
diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php index abbe77c6637..c47d102b881 100644 --- a/lib/private/Security/Bruteforce/Throttler.php +++ b/lib/private/Security/Bruteforce/Throttler.php @@ -36,8 +36,8 @@ use OC\Security\Normalizer\IpAddress; use OCP\AppFramework\Utility\ITimeFactory; use OCP\IConfig; use OCP\IDBConnection; -use OCP\ILogger; use OCP\Security\Bruteforce\MaxDelayReached; +use Psr\Log\LoggerInterface; /** * Class Throttler implements the bruteforce protection for security actions in @@ -62,22 +62,15 @@ class Throttler { private $db; /** @var ITimeFactory */ private $timeFactory; - /** @var ILogger */ - private $logger; + private LoggerInterface $logger; /** @var IConfig */ private $config; /** @var bool */ private $hasAttemptsDeleted = false; - /** - * @param IDBConnection $db - * @param ITimeFactory $timeFactory - * @param ILogger $logger - * @param IConfig $config - */ public function __construct(IDBConnection $db, ITimeFactory $timeFactory, - ILogger $logger, + LoggerInterface $logger, IConfig $config) { $this->db = $db; $this->timeFactory = $timeFactory; diff --git a/lib/private/Security/CertificateManager.php b/lib/private/Security/CertificateManager.php index 74ea59c3792..fa26c19ceae 100644 --- a/lib/private/Security/CertificateManager.php +++ b/lib/private/Security/CertificateManager.php @@ -36,8 +36,8 @@ use OC\Files\Filesystem; use OCP\ICertificate; use OCP\ICertificateManager; use OCP\IConfig; -use OCP\ILogger; use OCP\Security\ISecureRandom; +use Psr\Log\LoggerInterface; /** * Manage trusted certificates for users @@ -53,25 +53,16 @@ class CertificateManager implements ICertificateManager { */ protected $config; - /** - * @var ILogger - */ - protected $logger; + protected LoggerInterface $logger; /** @var ISecureRandom */ protected $random; private ?string $bundlePath = null; - /** - * @param \OC\Files\View $view relative to data/ - * @param IConfig $config - * @param ILogger $logger - * @param ISecureRandom $random - */ public function __construct(\OC\Files\View $view, IConfig $config, - ILogger $logger, + LoggerInterface $logger, ISecureRandom $random) { $this->view = $view; $this->config = $config; @@ -147,7 +138,8 @@ class CertificateManager implements ICertificateManager { $defaultCertificates = file_get_contents(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); if (strlen($defaultCertificates) < 1024) { // sanity check to verify that we have some content for our bundle // log as exception so we have a stacktrace - $this->logger->logException(new \Exception('Shipped ca-bundle is empty, refusing to create certificate bundle')); + $e = new \Exception('Shipped ca-bundle is empty, refusing to create certificate bundle'); + $this->logger->error($e->getMessage(), ['exception' => $e]); return; } diff --git a/lib/private/Security/IdentityProof/Manager.php b/lib/private/Security/IdentityProof/Manager.php index 0878efeebc7..c92d7390969 100644 --- a/lib/private/Security/IdentityProof/Manager.php +++ b/lib/private/Security/IdentityProof/Manager.php @@ -32,9 +32,9 @@ namespace OC\Security\IdentityProof; use OC\Files\AppData\Factory; use OCP\Files\IAppData; use OCP\IConfig; -use OCP\ILogger; use OCP\IUser; use OCP\Security\ICrypto; +use Psr\Log\LoggerInterface; class Manager { /** @var IAppData */ @@ -43,13 +43,12 @@ class Manager { private $crypto; /** @var IConfig */ private $config; - /** @var ILogger */ - private $logger; + private LoggerInterface $logger; public function __construct(Factory $appDataFactory, ICrypto $crypto, IConfig $config, - ILogger $logger + LoggerInterface $logger ) { $this->appData = $appDataFactory->get('identityproof'); $this->crypto = $crypto; |