Merge pull request #23925 from nextcloud/backport/23920/stable19
[stable19] Bearer must be in the start of the auth header
This commit is contained in:
commit
848170bee3
|
@ -807,15 +807,15 @@ class Session implements IUserSession, Emitter {
|
|||
*/
|
||||
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)) {
|
||||
|
|
Loading…
Reference in New Issue