Try to fix authentication

This commit is contained in:
Marcel Klehr 2020-05-06 21:27:07 +02:00
parent 1ca983e3a1
commit 07125537c8
1 changed files with 8 additions and 7 deletions

View File

@ -76,13 +76,7 @@ class Authorizer {
return;
}
[$type, $credentials] = explode(' ', $auth);
if (strtolower($type) === 'basic') {
[$username, $password] = explode(':', base64_decode($credentials));
if (false === $this->userSession->login($username, $password)) {
return;
}
$this->setUserId($this->userSession->getUser()->getUID());
}
if (strtolower($type) === 'bearer') {
$this->setToken($credentials);
}
@ -91,6 +85,13 @@ class Authorizer {
return;
}
$this->setUserId($this->userSession->getUser()->getUID());
} elseif (strtolower($type) === 'basic') {
[$username, $password] = explode(':', base64_decode($credentials));
if (false === $this->userSession->login($username, $password)) {
return;
}
$this->setUserId($this->userSession->getUser()->getUID());
}
}