From f93db724d7905d9858af2d2d4cf083c20b9c28de Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Thu, 18 May 2017 21:19:39 +0200 Subject: Make legacy DAV backend use the BearerAuth backend as well Signed-off-by: Lukas Reschke --- apps/dav/appinfo/v1/publicwebdav.php | 3 ++- apps/dav/appinfo/v1/webdav.php | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'apps/dav/appinfo') diff --git a/apps/dav/appinfo/v1/publicwebdav.php b/apps/dav/appinfo/v1/publicwebdav.php index 95fb71032d5..3ef1c2e62a5 100644 --- a/apps/dav/appinfo/v1/publicwebdav.php +++ b/apps/dav/appinfo/v1/publicwebdav.php @@ -42,6 +42,7 @@ $authBackend = new OCA\DAV\Connector\PublicAuth( \OC::$server->getShareManager(), \OC::$server->getSession() ); +$authPlugin = new \Sabre\DAV\Auth\Plugin($authBackend); $serverFactory = new OCA\DAV\Connector\Sabre\ServerFactory( \OC::$server->getConfig(), @@ -59,7 +60,7 @@ $requestUri = \OC::$server->getRequest()->getRequestUri(); $linkCheckPlugin = new \OCA\DAV\Files\Sharing\PublicLinkCheckPlugin(); $filesDropPlugin = new \OCA\DAV\Files\Sharing\FilesDropPlugin(); -$server = $serverFactory->createServer($baseuri, $requestUri, $authBackend, function (\Sabre\DAV\Server $server) use ($authBackend, $linkCheckPlugin, $filesDropPlugin) { +$server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function (\Sabre\DAV\Server $server) use ($authBackend, $linkCheckPlugin, $filesDropPlugin) { $isAjax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest'); $federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application(); $federatedShareProvider = $federatedSharingApp->getFederatedShareProvider(); diff --git a/apps/dav/appinfo/v1/webdav.php b/apps/dav/appinfo/v1/webdav.php index 32f93b27760..a1ad4ab489d 100644 --- a/apps/dav/appinfo/v1/webdav.php +++ b/apps/dav/appinfo/v1/webdav.php @@ -52,9 +52,17 @@ $authBackend = new \OCA\DAV\Connector\Sabre\Auth( \OC::$server->getBruteForceThrottler(), 'principals/' ); +$authPlugin = new \Sabre\DAV\Auth\Plugin($authBackend); +$bearerAuthPlugin = new \OCA\DAV\Connector\Sabre\BearerAuth( + \OC::$server->getUserSession(), + \OC::$server->getSession(), + \OC::$server->getRequest() +); +$authPlugin->addBackend($bearerAuthPlugin); + $requestUri = \OC::$server->getRequest()->getRequestUri(); -$server = $serverFactory->createServer($baseuri, $requestUri, $authBackend, function() { +$server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function() { // use the view for the logged in user return \OC\Files\Filesystem::getView(); }); -- cgit v1.2.3