aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/lib/Sabre/DAV/Auth/Backend/AbstractBasic.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/lib/Sabre/DAV/Auth/Backend/AbstractBasic.php')
-rw-r--r--vendor/sabre/dav/lib/Sabre/DAV/Auth/Backend/AbstractBasic.php87
1 files changed, 0 insertions, 87 deletions
diff --git a/vendor/sabre/dav/lib/Sabre/DAV/Auth/Backend/AbstractBasic.php b/vendor/sabre/dav/lib/Sabre/DAV/Auth/Backend/AbstractBasic.php
deleted file mode 100644
index 599f932d4..000000000
--- a/vendor/sabre/dav/lib/Sabre/DAV/Auth/Backend/AbstractBasic.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-
-namespace Sabre\DAV\Auth\Backend;
-
-use Sabre\DAV;
-use Sabre\HTTP;
-
-/**
- * HTTP Basic authentication backend class
- *
- * This class can be used by authentication objects wishing to use HTTP Basic
- * Most of the digest logic is handled, implementors just need to worry about
- * the validateUserPass method.
- *
- * @copyright Copyright (C) 2007-2014 fruux GmbH (https://fruux.com/).
- * @author James David Low (http://jameslow.com/)
- * @author Evert Pot (http://evertpot.com/)
- * @license http://sabre.io/license/ Modified BSD License
- */
-abstract class AbstractBasic implements BackendInterface {
-
- /**
- * This variable holds the currently logged in username.
- *
- * @var string|null
- */
- protected $currentUser;
-
- /**
- * Validates a username and password
- *
- * This method should return true or false depending on if login
- * succeeded.
- *
- * @param string $username
- * @param string $password
- * @return bool
- */
- abstract protected function validateUserPass($username, $password);
-
- /**
- * Returns information about the currently logged in username.
- *
- * If nobody is currently logged in, this method should return null.
- *
- * @return string|null
- */
- public function getCurrentUser() {
- return $this->currentUser;
- }
-
-
- /**
- * Authenticates the user based on the current request.
- *
- * If authentication is successful, true must be returned.
- * If authentication fails, an exception must be thrown.
- *
- * @param DAV\Server $server
- * @param string $realm
- * @throws DAV\Exception\NotAuthenticated
- * @return bool
- */
- public function authenticate(DAV\Server $server, $realm) {
-
- $auth = new HTTP\BasicAuth();
- $auth->setHTTPRequest($server->httpRequest);
- $auth->setHTTPResponse($server->httpResponse);
- $auth->setRealm($realm);
- $userpass = $auth->getUserPass();
- if (!$userpass) {
- $auth->requireLogin();
- throw new DAV\Exception\NotAuthenticated('No basic authentication headers were found');
- }
-
- // Authenticates the user
- if (!$this->validateUserPass($userpass[0],$userpass[1])) {
- $auth->requireLogin();
- throw new DAV\Exception\NotAuthenticated('Username or password does not match');
- }
- $this->currentUser = $userpass[0];
- return true;
- }
-
-
-}
-