1 | <?php |
||
19 | class BasicAuth |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * The basic auth user |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | private $user; |
||
28 | |||
29 | /** |
||
30 | * The basic auth password |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | private $password; |
||
35 | |||
36 | /** |
||
37 | * The list of files to skip authentication |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | private $whitelist; |
||
42 | |||
43 | /** |
||
44 | * Realm name |
||
45 | * |
||
46 | * @var string |
||
47 | */ |
||
48 | private $realm; |
||
49 | |||
50 | /** |
||
51 | * Create a new basic auth instance |
||
52 | * |
||
53 | * @param string $user |
||
54 | * The username |
||
55 | * @param string $password |
||
56 | * The password |
||
57 | * @param array $whitelist |
||
58 | * The list of files to skip authentication |
||
59 | * @param string $realm |
||
60 | * The name of the realm |
||
61 | */ |
||
62 | public function __construct($user, $password, $whitelist = array(), $realm = "Authentication realm") |
||
69 | |||
70 | /** |
||
71 | * Perform authentication |
||
72 | * |
||
73 | * @param string $file |
||
74 | * @throws GenericsException |
||
75 | * @return bool |
||
76 | */ |
||
77 | public function auth($file = ''): bool |
||
107 | } |
||
108 |