Skip to content

Commit 954d099

Browse files
committed
fix: fix psalm
Signed-off-by: Jana Peper <[email protected]>
1 parent 21b7e0a commit 954d099

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

apps/webhook_listeners/lib/Controller/WebhooksController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ public function create(
187187
* @param "none"|"header"|null $authMethod Authentication method to use
188188
* @param ?array<string,mixed> $authData Array of data for authentication
189189
* @param ?array<string,mixed> $tokenNeeded List of user ids for which to include auth tokens in the event.
190-
* @param ?array<string,mixed> $tokenNeeded List of user ids for which to include auth tokens in the event.
191190
* Has two fields: "user_ids" list of user uids for which tokens are needed, "user_roles" list of roles (users not defined by their ID but by the role they have in the webhook event) for which tokens can be included.
192191
* Possible roles: "owner" for the user creating the webhook, "trigger" for the user triggering the webhook call.
193192
* Requested auth tokens are valid for 1 hour after receiving them in the event call request.

apps/webhook_listeners/lib/Db/TemporaryTokenMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function getById(int $id): TemporaryToken {
5454

5555
/**
5656
* @throws Exception
57-
* @return WebhookListener[]
57+
* @return TemporaryToken[]
5858
*/
5959
public function getAll(): array {
6060
$qb = $this->db->getQueryBuilder();

apps/webhook_listeners/lib/Service/TokenService.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace OCA\WebhookListeners\Service;
99

1010
use OC\Authentication\Token\IProvider;
11+
use OC\Authentication\Token\PublicKeyToken;
1112
use OCA\WebhookListeners\Db\TemporaryTokenMapper;
1213
use OCA\WebhookListeners\Db\WebhookListener;
1314
use OCP\AppFramework\Utility\ITimeFactory;
@@ -81,6 +82,9 @@ private function createTemporaryToken(string $userId): string {
8182
$name = 'Ephemeral webhook authentication';
8283
$password = null;
8384
$deviceToken = $this->tokenProvider->generateToken($token, $userId, $userId, $password, $name, IToken::PERMANENT_TOKEN);
85+
if (!($deviceToken instanceof PublicKeyToken)) {
86+
throw new \Exception('Unexpected token type');
87+
}
8488
$this->tokenMapper->addTemporaryToken($deviceToken->getId(), $deviceToken->getToken(), $userId, $this->time->getTime());
8589
return $token;
8690
}

0 commit comments

Comments
 (0)