From 5f7acf396c4162018f55e40333bf23a31068f7b7 Mon Sep 17 00:00:00 2001 From: Dani Garcia Date: Thu, 4 Apr 2024 11:35:00 +0200 Subject: [PATCH] increased priority for jwt-created callback --- Operation/ExchangeToken.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Operation/ExchangeToken.php b/Operation/ExchangeToken.php index ee17670..53e5b89 100644 --- a/Operation/ExchangeToken.php +++ b/Operation/ExchangeToken.php @@ -2,6 +2,7 @@ namespace Ivoz\Api\Operation; +use ApiPlatform\Core\EventListener\EventPriorities; use ApiPlatform\Core\Exception\ResourceClassNotFoundException; use Lexik\Bundle\JWTAuthenticationBundle\Event\JWTCreatedEvent; use Lexik\Bundle\JWTAuthenticationBundle\Events; @@ -93,6 +94,7 @@ public function execute(string $inputToken, string $username): string } $tokenChain[] = $parentAdminTokenPayload['iden']; $payload['onBehalfOf'] = implode(' > ', $tokenChain); + $payload['onBehalOfUsername'] = $parentAdminTokenPayload['username']; $payload['iden'] = (string) $targetAdmin; $event->setData($payload); @@ -100,7 +102,8 @@ public function execute(string $inputToken, string $username): string $this->eventDispatcher->addListener( Events::JWT_CREATED, - $payloadModifier + $payloadModifier, + EventPriorities::PRE_VALIDATE ); $newToken = $this->jwtTokenManager->create($targetAdmin);