aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2017-05-18 23:30:44 +0200
committerGitHub <noreply@github.com>2017-05-18 23:30:44 +0200
commit0eb4970ec8981d112a412a4858833459533b158a (patch)
tree4604252f8c26906dd2af1804d531465e0cb2d7f1 /lib/private
parentc60547295025eec862ee1ea9a3f5009f901f8bc2 (diff)
parentf4189699e7348615eeb0e528bc5395d818d301ea (diff)
downloadnextcloud-server-0eb4970ec8981d112a412a4858833459533b158a.tar.gz
nextcloud-server-0eb4970ec8981d112a412a4858833459533b158a.zip
Merge pull request #4704 from nextcloud/add-oauth-code-flow-support
Add oauth code flow support
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Authentication/Token/DefaultTokenMapper.php12
-rw-r--r--lib/private/User/Session.php4
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)) {