aboutsummaryrefslogtreecommitdiffstats
path: root/lib/connector/sabre
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2013-07-22 15:30:57 +0200
committerGeorg Ehrke <developer@georgehrke.com>2013-07-22 15:30:57 +0200
commitf1e939e1a3c9f63d98bd5ca7ca67568a97ff366f (patch)
tree14e9096800bb4f005440db1b8510e32ed518c339 /lib/connector/sabre
parent63791e2d8d323df2717979cc8ecab0c08587ed47 (diff)
parentda892d69ab724354e1b3ee251e540ba306fffe44 (diff)
downloadnextcloud-server-f1e939e1a3c9f63d98bd5ca7ca67568a97ff366f.tar.gz
nextcloud-server-f1e939e1a3c9f63d98bd5ca7ca67568a97ff366f.zip
Merge branch 'master' into fix_return_value_search_principals
Diffstat (limited to 'lib/connector/sabre')
-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);
+ }
}