From 9eca1da1dd9534f68672b3164da5ab56df285e42 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 22 Feb 2017 21:47:49 +0100 Subject: [PATCH] allow configuring authType for DAV backend Signed-off-by: Morris Jobke --- apps/files_external/lib/Lib/Storage/OwnCloud.php | 2 ++ lib/private/Files/Storage/DAV.php | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/files_external/lib/Lib/Storage/OwnCloud.php b/apps/files_external/lib/Lib/Storage/OwnCloud.php index 4a10844a770..427b55a4a54 100644 --- a/apps/files_external/lib/Lib/Storage/OwnCloud.php +++ b/apps/files_external/lib/Lib/Storage/OwnCloud.php @@ -23,6 +23,7 @@ */ namespace OCA\Files_External\Lib\Storage; +use Sabre\DAV\Client; /** * ownCloud backend for external storage based on DAV backend. @@ -69,6 +70,7 @@ class OwnCloud extends \OC\Files\Storage\DAV{ $params['host'] = $host; $params['root'] = $contextPath . self::OC_URL_SUFFIX . $root; + $params['authType'] = Client::AUTH_BASIC; parent::__construct($params); } diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index 76a6155df24..73cf137181a 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -64,6 +64,8 @@ class DAV extends Common { /** @var string */ protected $user; /** @var string */ + protected $authType; + /** @var string */ protected $host; /** @var bool */ protected $secure; @@ -95,6 +97,9 @@ class DAV extends Common { $this->host = $host; $this->user = $params['user']; $this->password = $params['password']; + if (isset($params['authType'])) { + $this->authType = $params['authType']; + } if (isset($params['secure'])) { if (is_string($params['secure'])) { $this->secure = ($params['secure'] === 'true'); @@ -133,11 +138,14 @@ class DAV extends Common { } $this->ready = true; - $settings = array( + $settings = [ 'baseUri' => $this->createBaseUri(), 'userName' => $this->user, 'password' => $this->password, - ); + ]; + if (isset($this->authType)) { + $settings['authType'] = $this->authType; + } $proxy = \OC::$server->getConfig()->getSystemValue('proxy', ''); if($proxy !== '') { -- 2.39.5