diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-05-04 23:46:59 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2017-05-18 20:49:03 +0200 |
commit | 5f71805c35d04e585ea6d4227254b11204413dfd (patch) | |
tree | e2de66eb03b7127ff542393089013cda526df781 /apps/dav | |
parent | 879e11e7d1d9802647ade392f4ae317952bc6f8f (diff) | |
download | nextcloud-server-5f71805c35d04e585ea6d4227254b11204413dfd.tar.gz nextcloud-server-5f71805c35d04e585ea6d4227254b11204413dfd.zip |
Add basic implementation for OAuth 2.0 Authorization Code Flow
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Auth.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php index bdaf73d46e7..7ddbb70530a 100644 --- a/apps/dav/lib/Connector/Sabre/Auth.php +++ b/apps/dav/lib/Connector/Sabre/Auth.php @@ -210,6 +210,19 @@ class Auth extends AbstractBasic { */ private function auth(RequestInterface $request, ResponseInterface $response) { $forcedLogout = false; + + $authHeader = $request->getHeader('Authorization'); + if (strpos($authHeader, 'Bearer ') !== false) { + if($this->userSession->tryTokenLogin($this->request)) { + $this->session->set(self::DAV_AUTHENTICATED, $this->userSession->getUser()->getUID()); + $user = $this->userSession->getUser()->getUID(); + \OC_Util::setupFS($user); + $this->currentUser = $user; + $this->session->close(); + return [true, $this->principalPrefix . $user]; + } + } + if(!$this->request->passesCSRFCheck() && $this->requiresCSRFCheck()) { // In case of a fail with POST we need to recheck the credentials |