blob: fdad8a60507882f957695309914cb2b46a264f0c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
namespace Sabre\DAV\Auth\Backend;
use Sabre\DAV;
class Mock implements BackendInterface {
protected $currentUser;
public $defaultUser = 'admin';
/**
* @param Sabre\DAV\Server $server
* @param string $realm
* @throws Sabre\DAV\Exception\NotAuthenticated
*/
function authenticate(DAV\Server $server, $realm) {
if ($realm=='failme') throw new DAV\Exception\NotAuthenticated('deliberate fail');
$this->currentUser = $this->defaultUser;
}
function setCurrentUser($user) {
$this->currentUser = $user;
}
function getCurrentUser() {
return $this->currentUser;
}
}
|