summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Connector/Sabre/Auth.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib/Connector/Sabre/Auth.php')
-rw-r--r--apps/dav/lib/Connector/Sabre/Auth.php22
1 files changed, 10 insertions, 12 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php
index 15ea9447ffd..8457670be6b 100644
--- a/apps/dav/lib/Connector/Sabre/Auth.php
+++ b/apps/dav/lib/Connector/Sabre/Auth.php
@@ -50,8 +50,6 @@ use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
class Auth extends AbstractBasic {
-
-
const DAV_AUTHENTICATED = 'AUTHENTICATED_TO_DAV_BACKEND';
/** @var ISession */
@@ -173,12 +171,12 @@ class Auth extends AbstractBasic {
*/
private function requiresCSRFCheck() {
// GET requires no check at all
- if($this->request->getMethod() === 'GET') {
+ if ($this->request->getMethod() === 'GET') {
return false;
}
// Official Nextcloud clients require no checks
- if($this->request->isUserAgent([
+ if ($this->request->isUserAgent([
IRequest::USER_AGENT_CLIENT_DESKTOP,
IRequest::USER_AGENT_CLIENT_ANDROID,
IRequest::USER_AGENT_CLIENT_IOS,
@@ -187,17 +185,17 @@ class Auth extends AbstractBasic {
}
// If not logged-in no check is required
- if(!$this->userSession->isLoggedIn()) {
+ if (!$this->userSession->isLoggedIn()) {
return false;
}
// POST always requires a check
- if($this->request->getMethod() === 'POST') {
+ if ($this->request->getMethod() === 'POST') {
return true;
}
// If logged-in AND DAV authenticated no check is required
- if($this->userSession->isLoggedIn() &&
+ if ($this->userSession->isLoggedIn() &&
$this->isDavAuthenticated($this->userSession->getUser()->getUID())) {
return false;
}
@@ -214,10 +212,10 @@ class Auth extends AbstractBasic {
private function auth(RequestInterface $request, ResponseInterface $response) {
$forcedLogout = false;
- if(!$this->request->passesCSRFCheck() &&
+ if (!$this->request->passesCSRFCheck() &&
$this->requiresCSRFCheck()) {
// In case of a fail with POST we need to recheck the credentials
- if($this->request->getMethod() === 'POST') {
+ if ($this->request->getMethod() === 'POST') {
$forcedLogout = true;
} else {
$response->setStatus(401);
@@ -225,10 +223,10 @@ class Auth extends AbstractBasic {
}
}
- if($forcedLogout) {
+ if ($forcedLogout) {
$this->userSession->logout();
} else {
- if($this->twoFactorManager->needsSecondFactor($this->userSession->getUser())) {
+ if ($this->twoFactorManager->needsSecondFactor($this->userSession->getUser())) {
throw new \Sabre\DAV\Exception\NotAuthenticated('2FA challenge not passed.');
}
if (
@@ -254,7 +252,7 @@ class Auth extends AbstractBasic {
}
$data = parent::check($request, $response);
- if($data[0] === true) {
+ if ($data[0] === true) {
$startPos = strrpos($data[1], '/') + 1;
$user = $this->userSession->getUser()->getUID();
$data[1] = substr_replace($data[1], $user, $startPos);