diff options
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Authentication/Token/DefaultTokenMapper.php | 12 | ||||
-rw-r--r-- | lib/private/User/Session.php | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/private/Authentication/Token/DefaultTokenMapper.php b/lib/private/Authentication/Token/DefaultTokenMapper.php index 8848cd3ec56..44bc553a92e 100644 --- a/lib/private/Authentication/Token/DefaultTokenMapper.php +++ b/lib/private/Authentication/Token/DefaultTokenMapper.php @@ -149,4 +149,16 @@ class DefaultTokenMapper extends Mapper { $qb->execute(); } + /** + * delete all auth token which belong to a specific client if the client was deleted + * + * @param string $name + */ + public function deleteByName($name) { + $qb = $this->db->getQueryBuilder(); + $qb->delete('authtoken') + ->where($qb->expr()->eq('name', $qb->createNamedParameter($name))); + $qb->execute(); + } + } diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index f818666c374..0291c1baecb 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -725,7 +725,7 @@ class Session implements IUserSession, Emitter { */ public function tryTokenLogin(IRequest $request) { $authHeader = $request->getHeader('Authorization'); - if (strpos($authHeader, 'token ') === false) { + if (strpos($authHeader, 'Bearer ') === false) { // No auth header, let's try session id try { $token = $this->session->getId(); @@ -733,7 +733,7 @@ class Session implements IUserSession, Emitter { return false; } } else { - $token = substr($authHeader, 6); + $token = substr($authHeader, 7); } if (!$this->loginWithToken($token)) { |