6 * This authentication backend assumes that authentication has been
7 * configured in apache, rather than within SabreDAV.
9 * Make sure apache is properly configured for this to work.
13 * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
14 * @author Evert Pot (http://www.rooftopsolutions.nl/)
15 * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
17 class Sabre_DAV_Auth_Backend_Apache implements Sabre_DAV_Auth_IBackend {
24 protected $remoteUser;
27 * Authenticates the user based on the current request.
29 * If authentication is successful, true must be returned.
30 * If authentication fails, an exception must be thrown.
32 * @param Sabre_DAV_Server $server
33 * @param string $realm
36 public function authenticate(Sabre_DAV_Server $server, $realm) {
38 $remoteUser = $server->httpRequest->getRawServerValue('REMOTE_USER');
39 if (is_null($remoteUser)) {
40 throw new Sabre_DAV_Exception('We did not receive the $_SERVER[REMOTE_USER] property. This means that apache might have been misconfigured');
43 $this->remoteUser = $remoteUser;
49 * Returns information about the currently logged in user.
51 * If nobody is currently logged in, this method should return null.
55 public function getCurrentUser() {
57 return $this->remoteUser;