Skip to content

Commit

Permalink
fix: Don't use existing user when header is set
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr committed Sep 12, 2024
1 parent 0c11c4e commit 94ef55d
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions lib/Service/Authorizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,13 @@ public function setCredentials(IRequest $request): void {
if (!$this->cors && $this->userSession->isLoggedIn()) {
$this->setUserId($this->userSession->getUser()->getUID());
} elseif (isset($request->server['PHP_AUTH_USER'], $request->server['PHP_AUTH_PW'])) {
if ($this->userSession->getUser() !== null) {
$this->setUserId($this->userSession->getUser()->getUID());
return;
}
if ($this->userSession->login($request->server['PHP_AUTH_USER'], $request->server['PHP_AUTH_PW']) === false) {
return;
}
$this->setUserId($this->userSession->getUser()->getUID());
} elseif ($auth !== null && $auth !== '') {
[$type, $credentials] = explode(' ', $auth);
if (strtolower($type) === 'basic') {
if ($this->userSession->getUser() !== null) {
$this->setUserId($this->userSession->getUser()->getUID());
return;
}
[$username, $password] = explode(':', base64_decode($credentials));
if (isset($username, $password) && $password !== '') {
return;
Expand Down

0 comments on commit 94ef55d

Please sign in to comment.