summaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-06-10 10:41:46 +0200
committerGitHub <noreply@github.com>2016-06-10 10:41:46 +0200
commit67c3a974012770757ec63ef5257008fdb5902d37 (patch)
tree1fb08e17e48513337cd0c60d09ee513be508064c /apps/dav
parent6660488b735d42c6120e416d20279b448a5b1e1e (diff)
parentcf06b17df15d6de83d2893cbe08880bbd9dd5c2c (diff)
downloadnextcloud-server-67c3a974012770757ec63ef5257008fdb5902d37.tar.gz
nextcloud-server-67c3a974012770757ec63ef5257008fdb5902d37.zip
Merge pull request #25046 from owncloud/fix-the-realm
Use the correct realm for basic authentication
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/Connector/PublicAuth.php9
-rw-r--r--apps/dav/lib/Connector/Sabre/Auth.php4
-rw-r--r--apps/dav/lib/Connector/Sabre/ServerFactory.php3
3 files changed, 12 insertions, 4 deletions
diff --git a/apps/dav/lib/Connector/PublicAuth.php b/apps/dav/lib/Connector/PublicAuth.php
index 2716ca29107..4e63ca1d29e 100644
--- a/apps/dav/lib/Connector/PublicAuth.php
+++ b/apps/dav/lib/Connector/PublicAuth.php
@@ -31,13 +31,14 @@ use OCP\IRequest;
use OCP\ISession;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager;
+use Sabre\DAV\Auth\Backend\AbstractBasic;
/**
* Class PublicAuth
*
* @package OCA\DAV\Connector
*/
-class PublicAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
+class PublicAuth extends AbstractBasic {
/** @var \OCP\Share\IShare */
private $share;
@@ -62,6 +63,10 @@ class PublicAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
$this->request = $request;
$this->shareManager = $shareManager;
$this->session = $session;
+
+ // setup realm
+ $defaults = new \OC_Defaults();
+ $this->realm = $defaults->getName();
}
/**
@@ -99,7 +104,7 @@ class PublicAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
if (in_array('XMLHttpRequest', explode(',', $this->request->getHeader('X-Requested-With')))) {
// do not re-authenticate over ajax, use dummy auth name to prevent browser popup
http_response_code(401);
- header('WWW-Authenticate', 'DummyBasic real="ownCloud"');
+ header('WWW-Authenticate','DummyBasic realm="' . $this->realm . '"');
throw new \Sabre\DAV\Exception\NotAuthenticated('Cannot authenticate over ajax calls');
}
return false;
diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php
index 27900cc1cad..653da10bc3c 100644
--- a/apps/dav/lib/Connector/Sabre/Auth.php
+++ b/apps/dav/lib/Connector/Sabre/Auth.php
@@ -74,6 +74,10 @@ class Auth extends AbstractBasic {
$this->twoFactorManager = $twoFactorManager;
$this->request = $request;
$this->principalPrefix = $principalPrefix;
+
+ // setup realm
+ $defaults = new \OC_Defaults();
+ $this->realm = $defaults->getName();
}
/**
diff --git a/apps/dav/lib/Connector/Sabre/ServerFactory.php b/apps/dav/lib/Connector/Sabre/ServerFactory.php
index 699dd77166e..c5b4f6a9352 100644
--- a/apps/dav/lib/Connector/Sabre/ServerFactory.php
+++ b/apps/dav/lib/Connector/Sabre/ServerFactory.php
@@ -100,10 +100,9 @@ class ServerFactory {
$server->setBaseUri($baseUri);
// Load plugins
- $defaults = new \OC_Defaults();
$server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin($this->config));
$server->addPlugin(new \OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin($this->config));
- $server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, $defaults->getName()));
+ $server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend));
// FIXME: The following line is a workaround for legacy components relying on being able to send a GET to /
$server->addPlugin(new \OCA\DAV\Connector\Sabre\DummyGetResponsePlugin());
$server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $this->logger));