From d812f1f521cb608fe3c83a0ff32339342297e6b1 Mon Sep 17 00:00:00 2001 From: Dani Garcia Date: Tue, 9 Apr 2024 17:16:30 +0200 Subject: [PATCH] store onBehalfOfIds in jwt payload --- Operation/ExchangeToken.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Operation/ExchangeToken.php b/Operation/ExchangeToken.php index a390b3d..c35891c 100644 --- a/Operation/ExchangeToken.php +++ b/Operation/ExchangeToken.php @@ -93,13 +93,14 @@ public function execute(string $inputToken, string $username): string $tokenChain[] = $parentAdminTokenPayload['onBehalfOf']; } $tokenChain[] = $parentAdminTokenPayload['iden']; + $payload['onBehalfOf'] = implode(' > ', $tokenChain); + $payload['onBehalfOfIds'] = []; if (isset($parentAdminTokenPayload['onBehalfOfIds'])) { $payload['onBehalfOfIds'] = $parentAdminTokenPayload['onBehalfOfIds']; } - $payload['onBehalfOfIds'][] = $targetAdmin->getId(); + $payload['onBehalfOfIds'][] = $parentAdminTokenPayload['id'] ?? -1; - $payload['onBehalfOf'] = implode(' > ', $tokenChain); $payload['iden'] = (string) $targetAdmin; $event->setData($payload); @@ -119,4 +120,4 @@ public function execute(string $inputToken, string $username): string return $newToken; } -} +} \ No newline at end of file