Skip to content

Commit

Permalink
Check for an APIKEY_USER when using a api-key auth
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoLouwerse committed Jan 26, 2024
1 parent 27d58c1 commit 5a9d88e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/src/Security/ApiKeyAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ public function authenticate(Request $request): PassportInterface

try {
$user = $application->getOrganization()->getUsers()[0];

$users = array_filter($application->getOrganization()->getUsers(), function (User $user) {
return $user->getName() === 'APIKEY_USER';
});
if (empty($users[0]) === false) {
$user = $users[0];
}
} catch (\Exception $exception) {
throw new AuthenticationException('An invalid User is configured for this ApiKey');
}
Expand Down

0 comments on commit 5a9d88e

Please sign in to comment.