Skip to content

Commit

Permalink
store onBehalfOfIds in jwt payload
Browse files Browse the repository at this point in the history
  • Loading branch information
danigargar authored and mmadariaga committed Apr 11, 2024
1 parent 7e4d5f0 commit d812f1f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Operation/ExchangeToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -119,4 +120,4 @@ public function execute(string $inputToken, string $username): string

return $newToken;
}
}
}

0 comments on commit d812f1f

Please sign in to comment.