allow configuring authType for DAV backend

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Jörn Friedrich Dreyer 2017-02-22 21:47:49 +01:00 committed by Morris Jobke
parent d551b8e6fd
commit 9eca1da1dd
No known key found for this signature in database
GPG key ID: 9CE5ED29E7FCD38A
2 changed files with 12 additions and 2 deletions

View file

@ -23,6 +23,7 @@
*/ */
namespace OCA\Files_External\Lib\Storage; namespace OCA\Files_External\Lib\Storage;
use Sabre\DAV\Client;
/** /**
* ownCloud backend for external storage based on DAV backend. * ownCloud backend for external storage based on DAV backend.
@ -69,6 +70,7 @@ class OwnCloud extends \OC\Files\Storage\DAV{
$params['host'] = $host; $params['host'] = $host;
$params['root'] = $contextPath . self::OC_URL_SUFFIX . $root; $params['root'] = $contextPath . self::OC_URL_SUFFIX . $root;
$params['authType'] = Client::AUTH_BASIC;
parent::__construct($params); parent::__construct($params);
} }

View file

@ -64,6 +64,8 @@ class DAV extends Common {
/** @var string */ /** @var string */
protected $user; protected $user;
/** @var string */ /** @var string */
protected $authType;
/** @var string */
protected $host; protected $host;
/** @var bool */ /** @var bool */
protected $secure; protected $secure;
@ -95,6 +97,9 @@ class DAV extends Common {
$this->host = $host; $this->host = $host;
$this->user = $params['user']; $this->user = $params['user'];
$this->password = $params['password']; $this->password = $params['password'];
if (isset($params['authType'])) {
$this->authType = $params['authType'];
}
if (isset($params['secure'])) { if (isset($params['secure'])) {
if (is_string($params['secure'])) { if (is_string($params['secure'])) {
$this->secure = ($params['secure'] === 'true'); $this->secure = ($params['secure'] === 'true');
@ -133,11 +138,14 @@ class DAV extends Common {
} }
$this->ready = true; $this->ready = true;
$settings = array( $settings = [
'baseUri' => $this->createBaseUri(), 'baseUri' => $this->createBaseUri(),
'userName' => $this->user, 'userName' => $this->user,
'password' => $this->password, 'password' => $this->password,
); ];
if (isset($this->authType)) {
$settings['authType'] = $this->authType;
}
$proxy = \OC::$server->getConfig()->getSystemValue('proxy', ''); $proxy = \OC::$server->getConfig()->getSystemValue('proxy', '');
if($proxy !== '') { if($proxy !== '') {