summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Goetz <markus@woboq.com>2013-07-17 05:00:59 -0700
committerMarkus Goetz <markus@woboq.com>2013-07-17 05:00:59 -0700
commit3fd4ff79ee26cda9325be4a01f88b0e2cd7d3b3c (patch)
tree755597f17fb2c55369bd65266456119afa51450b
parenta3ff77156789a4eaf0e205aa93b168d399e011ac (diff)
parentbf7514f76abef4bcbb533e4c6c33e00a4e1fdfb5 (diff)
downloadnextcloud-server-3fd4ff79ee26cda9325be4a01f88b0e2cd7d3b3c.tar.gz
nextcloud-server-3fd4ff79ee26cda9325be4a01f88b0e2cd7d3b3c.zip
Merge pull request #4042 from guruz/webdav_auth_check_existing
WebDAV Auth Connector: Check if already logged in
-rw-r--r--lib/connector/sabre/auth.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/connector/sabre/auth.php b/lib/connector/sabre/auth.php
index 6990d928cff..bf3a49593cb 100644
--- a/lib/connector/sabre/auth.php
+++ b/lib/connector/sabre/auth.php
@@ -60,4 +60,25 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
}
return $user;
}
+
+ /**
+ * Override function here. We want to cache authentication cookies
+ * in the syncing client to avoid HTTP-401 roundtrips.
+ * If the sync client supplies the cookies, then OC_User::isLoggedIn()
+ * will return true and we can see this WebDAV request as already authenticated,
+ * even if there are no HTTP Basic Auth headers.
+ * In other case, just fallback to the parent implementation.
+ *
+ * @return bool
+ */
+ public function authenticate(Sabre_DAV_Server $server, $realm) {
+ if (OC_User::isLoggedIn()) {
+ $user = OC_User::getUser();
+ OC_Util::setupFS($user);
+ $this->currentUser = $user;
+ return true;
+ }
+
+ return parent::authenticate($server, $realm);
+ }
}