Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Bearer must be in the start of the auth header
Signed-off-by: Roeland Jago Douma <[email protected]>
  • Loading branch information
rullzer authored and backportbot[bot] committed Nov 6, 2020
commit c9bf32b454e3f00aec26d39eb3c7dde764711c1f
6 changes: 3 additions & 3 deletions lib/private/User/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -814,15 +814,15 @@ private function validateToken($token, $user = null) {
*/
public function tryTokenLogin(IRequest $request) {
$authHeader = $request->getHeader('Authorization');
if (strpos($authHeader, 'Bearer ') === false) {
if (strpos($authHeader, 'Bearer ') === 0) {
$token = substr($authHeader, 7);
} else {
// No auth header, let's try session id
try {
$token = $this->session->getId();
} catch (SessionNotAvailableException $ex) {
return false;
}
} else {
$token = substr($authHeader, 7);
}

if (!$this->loginWithToken($token)) {
Expand Down