summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2016-03-31 19:32:30 +0200
committerLukas Reschke <lukas@owncloud.com>2016-03-31 19:32:30 +0200
commitba69a90ab5c7756d1a53c2871ed86b29a942bb85 (patch)
tree32302d0db92710caa93475a0f112b7b07ceb7042
parent262547ba3d81a870521ad65bca770e9e1b14f229 (diff)
downloadnextcloud-server-ba69a90ab5c7756d1a53c2871ed86b29a942bb85.tar.gz
nextcloud-server-ba69a90ab5c7756d1a53c2871ed86b29a942bb85.zip
Enforce type
-rw-r--r--apps/dav/lib/connector/publicauth.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/dav/lib/connector/publicauth.php b/apps/dav/lib/connector/publicauth.php
index fc9b98c4834..0d75a4db493 100644
--- a/apps/dav/lib/connector/publicauth.php
+++ b/apps/dav/lib/connector/publicauth.php
@@ -26,6 +26,7 @@
namespace OCA\DAV\Connector;
+use OCP\IConfig;
use OCP\IRequest;
class PublicAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
@@ -46,7 +47,8 @@ class PublicAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
* @param \OCP\IConfig $config
* @param IRequest $request
*/
- public function __construct($config, $request) {
+ public function __construct(IConfig $config,
+ IRequest $request) {
$this->config = $config;
$this->request = $request;
}
@@ -61,6 +63,7 @@ class PublicAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
* @param string $password
*
* @return bool
+ * @throws \Sabre\DAV\Exception\NotAuthenticated
*/
protected function validateUserPass($username, $password) {
$linkItem = \OCP\Share::getShareByToken($username, false);
@@ -103,7 +106,7 @@ class PublicAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
} else {
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
- header('Status: 401');
+ http_response_code(401);
header('WWW-Authenticate', 'DummyBasic real="ownCloud"');
throw new \Sabre\DAV\Exception\NotAuthenticated('Cannot authenticate over ajax calls');
}