Skip to content

Commit 4a35837

Browse files
committed
feat(auth): adjust PublicKeyTokenProviderTest
Signed-off-by: Julien Veyssier <[email protected]>
1 parent 3da919c commit 4a35837

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/private/Authentication/Token/PublicKeyTokenProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ public function invalidateToken(string $token) {
273273
$tokenEntry = null;
274274
try {
275275
$tokenEntry = $this->mapper->getToken($tokenHash);
276-
} catch (DoesNotExistException) {}
276+
} catch (DoesNotExistException) {
277+
}
277278
$this->mapper->invalidate($this->hashToken($token));
278279
$this->mapper->invalidate($this->hashTokenWithEmptySecret($token));
279280
$this->cacheInvalidHash($tokenHash);

tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use OCP\AppFramework\Db\DoesNotExistException;
1919
use OCP\AppFramework\Utility\ITimeFactory;
2020
use OCP\Authentication\Token\IToken;
21+
use OCP\EventDispatcher\IEventDispatcher;
2122
use OCP\ICacheFactory;
2223
use OCP\IConfig;
2324
use OCP\IDBConnection;
@@ -49,6 +50,8 @@ class PublicKeyTokenProviderTest extends TestCase {
4950
private $cacheFactory;
5051
/** @var int */
5152
private $time;
53+
/** @var IEventDispatcher */
54+
private $eventDispatcher;
5255

5356
protected function setUp(): void {
5457
parent::setUp();
@@ -72,6 +75,7 @@ protected function setUp(): void {
7275
$this->timeFactory->method('getTime')
7376
->willReturn($this->time);
7477
$this->cacheFactory = $this->createMock(ICacheFactory::class);
78+
$this->eventDispatcher = Server::get(IEventDispatcher::class);
7579

7680
$this->tokenProvider = new PublicKeyTokenProvider(
7781
$this->mapper,
@@ -82,6 +86,7 @@ protected function setUp(): void {
8286
$this->timeFactory,
8387
$this->hasher,
8488
$this->cacheFactory,
89+
$this->eventDispatcher,
8590
);
8691
}
8792

0 commit comments

Comments
 (0)