Skip to content

Commit

Permalink
Merge pull request #1629 from ConductionNL/feature/BEL-26/api-key-app…
Browse files Browse the repository at this point in the history
…lication

With ApiKey for auth, make sure we set application in session correctly
  • Loading branch information
WilcoLouwerse authored Mar 21, 2024
2 parents 4cd5eb3 + 5e8bb47 commit aa6486a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
2 changes: 1 addition & 1 deletion api/src/Security/ApiKeyAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function authenticate(Request $request): PassportInterface
}

// Set apiKey Application id in session
$this->session->set('apiKeyApplication', $application->getId()->toString());
$this->session->set('application', $application->getId()->toString());

// Set organization id and user id in session
$this->session->set('user', $user->getId()->toString());
Expand Down
9 changes: 0 additions & 9 deletions api/src/Service/ApplicationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,6 @@ public function getApplication(): Application
}
}

// If an api-key is used for authentication we already know which application is used
if ($this->session->has('apiKeyApplication')) {
$application = $this->entityManager->getRepository('App:Application')->findOneBy(['id' => $this->session->get('apiKeyApplication')]);
if ($application !== null) {
$this->session->set('application', $application->getId()->toString());
return $application;
}
}

// Find application using the publicKey
$public = ($this->request->headers->get('public') ?? $this->request->query->get('public'));
if (empty($public) === false) {
Expand Down

0 comments on commit aa6486a

Please sign in to comment.