Skip to content

Commit

Permalink
increased priority for jwt-created callback
Browse files Browse the repository at this point in the history
  • Loading branch information
danigargar committed Apr 5, 2024
1 parent b754427 commit 5f7acf3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Operation/ExchangeToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -93,14 +94,16 @@ 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);
};

$this->eventDispatcher->addListener(
Events::JWT_CREATED,
$payloadModifier
$payloadModifier,
EventPriorities::PRE_VALIDATE
);

$newToken = $this->jwtTokenManager->create($targetAdmin);
Expand Down

0 comments on commit 5f7acf3

Please sign in to comment.