diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-06-13 13:51:33 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2017-06-13 13:54:52 +0200 |
commit | 633396001f89023b9dd39b3dc20f9e5430239600 (patch) | |
tree | 8a97bd690d34cbaa18bf999e4affedcbe19e7995 /apps/dav/lib | |
parent | b7761be4d9a53c4a5cebff4caf37bd2b4af6ebb4 (diff) | |
download | nextcloud-server-633396001f89023b9dd39b3dc20f9e5430239600.tar.gz nextcloud-server-633396001f89023b9dd39b3dc20f9e5430239600.zip |
Prevent sending second WWW-Authenticate header
Overrides \Sabre\DAV\Auth\Backend\AbstractBearer::challenge to prevent sending a second WWW-Authenticate header which is standard-compliant but most DAV clients simply fail hard.
Fixes https://github.com/nextcloud/server/issues/5088
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/BearerAuth.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/dav/lib/Connector/Sabre/BearerAuth.php b/apps/dav/lib/Connector/Sabre/BearerAuth.php index f0e0f389c33..b7fd9116f21 100644 --- a/apps/dav/lib/Connector/Sabre/BearerAuth.php +++ b/apps/dav/lib/Connector/Sabre/BearerAuth.php @@ -25,6 +25,8 @@ use OCP\IRequest; use OCP\ISession; use OCP\IUserSession; use Sabre\DAV\Auth\Backend\AbstractBearer; +use Sabre\HTTP\RequestInterface; +use Sabre\HTTP\ResponseInterface; class BearerAuth extends AbstractBearer { /** @var IUserSession */ @@ -77,4 +79,16 @@ class BearerAuth extends AbstractBearer { return false; } + + /** + * \Sabre\DAV\Auth\Backend\AbstractBearer::challenge sets an WWW-Authenticate + * header which some DAV clients can't handle. Thus we override this function + * and make it simply return a 401. + * + * @param RequestInterface $request + * @param ResponseInterface $response + */ + public function challenge(RequestInterface $request, ResponseInterface $response) { + $response->setStatus(401); + } } |