aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryemkareems <yemkareems@gmail.com>2024-10-28 15:04:11 +0530
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-10-28 12:34:36 +0000
commite253479d83b21ba927b82e359290792636d0a49f (patch)
tree94184be1af8e451018e8e202b50eefa3ffe4b60c
parentbe581d7ce8727cd63a80be2646efb053a4ef64ab (diff)
downloadnextcloud-server-e253479d83b21ba927b82e359290792636d0a49f.tar.gz
nextcloud-server-e253479d83b21ba927b82e359290792636d0a49f.zip
fix: crypto type made not nullable and tests run using ICrypto
Signed-off-by: yemkareems <yemkareems@gmail.com>
-rw-r--r--lib/private/Authentication/LoginCredentials/Store.php2
-rw-r--r--lib/private/Server.php2
-rw-r--r--tests/lib/Authentication/LoginCredentials/StoreTest.php7
3 files changed, 5 insertions, 6 deletions
diff --git a/lib/private/Authentication/LoginCredentials/Store.php b/lib/private/Authentication/LoginCredentials/Store.php
index 5a1aad6c743..50483a5862d 100644
--- a/lib/private/Authentication/LoginCredentials/Store.php
+++ b/lib/private/Authentication/LoginCredentials/Store.php
@@ -48,7 +48,7 @@ class Store implements IStore {
/** @var IProvider|null */
private $tokenProvider;
- /** @var Crypto|null */
+ /** @var Crypto */
private $crypto;
public function __construct(ISession $session,
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 7e32a667c8a..45f06a13b83 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -513,7 +513,7 @@ class Server extends ServerContainer implements IServerContainer {
}
$logger = $c->get(LoggerInterface::class);
$crypto = $c->get(Crypto::class);
- return new Store($session, $logger, $tokenProvider, $crypto);
+ return new Store($session, $logger, $crypto, $tokenProvider);
});
$this->registerAlias(IStore::class, Store::class);
$this->registerAlias(IProvider::class, Authentication\Token\Manager::class);
diff --git a/tests/lib/Authentication/LoginCredentials/StoreTest.php b/tests/lib/Authentication/LoginCredentials/StoreTest.php
index 3e2ee7ea66c..ba3dbf78886 100644
--- a/tests/lib/Authentication/LoginCredentials/StoreTest.php
+++ b/tests/lib/Authentication/LoginCredentials/StoreTest.php
@@ -30,7 +30,6 @@ use OC\Authentication\LoginCredentials\Credentials;
use OC\Authentication\LoginCredentials\Store;
use OC\Authentication\Token\IProvider;
use OC\Authentication\Token\IToken;
-use OC\Security\Crypto;
use OCP\Authentication\Exceptions\CredentialsUnavailableException;
use OCP\ISession;
use OCP\Security\ICrypto;
@@ -60,9 +59,9 @@ class StoreTest extends TestCase {
$this->session = $this->createMock(ISession::class);
$this->tokenProvider = $this->createMock(IProvider::class);
$this->logger = $this->createMock(LoggerInterface::class);
- $this->crypto = $this->createMock(Crypto::class);
+ $this->crypto = $this->createMock(ICrypto::class);
- $this->store = new Store($this->session, $this->logger, $this->tokenProvider, $this->crypto);
+ $this->store = new Store($this->session, $this->logger, $this->crypto, $this->tokenProvider);
}
public function testAuthenticate() {
@@ -77,7 +76,7 @@ class StoreTest extends TestCase {
->with($this->equalTo('login_credentials'), $this->equalTo(json_encode($params)));
$this->crypto->expects($this->once())
->method('encrypt')
- ->willReturn($params['password']);
+ ->willReturn('123456');
$this->store->authenticate($params);
}