Merge pull request #23920 from nextcloud/fix/match_bearer_front
Bearer must be in the start of the auth header
This commit is contained in:
commit
2c6bbe783a
|
@ -814,15 +814,15 @@ class Session implements IUserSession, Emitter {
|
||||||
*/
|
*/
|
||||||
public function tryTokenLogin(IRequest $request) {
|
public function tryTokenLogin(IRequest $request) {
|
||||||
$authHeader = $request->getHeader('Authorization');
|
$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
|
// No auth header, let's try session id
|
||||||
try {
|
try {
|
||||||
$token = $this->session->getId();
|
$token = $this->session->getId();
|
||||||
} catch (SessionNotAvailableException $ex) {
|
} catch (SessionNotAvailableException $ex) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$token = substr($authHeader, 7);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->loginWithToken($token)) {
|
if (!$this->loginWithToken($token)) {
|
||||||
|
|
Loading…
Reference in New Issue