1 | <?php |
||
5 | class Basic |
||
6 | { |
||
7 | /** |
||
8 | * @var string |
||
9 | */ |
||
10 | protected $user; |
||
11 | |||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $password; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $realm; |
||
21 | |||
22 | /** |
||
23 | * @var callable |
||
24 | */ |
||
25 | protected $verify; |
||
26 | |||
27 | /** |
||
28 | * @var callable |
||
29 | */ |
||
30 | protected $deny; |
||
31 | |||
32 | /** |
||
33 | * Constructor. |
||
34 | */ |
||
35 | public function __construct($realm = "Secured Area", array $allowedUsers = array()) |
||
42 | |||
43 | /** |
||
44 | * Set realm |
||
45 | * @param string $realm |
||
46 | * |
||
47 | * @return Basic The current instance |
||
48 | */ |
||
49 | public function realm($realm) |
||
55 | |||
56 | /** |
||
57 | * Set the user verification system |
||
58 | * |
||
59 | * @param callable $verify |
||
60 | * |
||
61 | * @return Basic |
||
62 | */ |
||
63 | public function verify(callable $verify) |
||
69 | |||
70 | /** |
||
71 | * Set the callable executed on deny by the verification |
||
72 | * |
||
73 | * @param callable $deny |
||
74 | * |
||
75 | * @return Basic |
||
76 | */ |
||
77 | public function deny(callable $deny) |
||
83 | |||
84 | /** |
||
85 | * Process the basic auth |
||
86 | * |
||
87 | * @return Basic |
||
88 | */ |
||
89 | public function auth() |
||
110 | |||
111 | /** |
||
112 | * Get the verified user |
||
113 | * |
||
114 | * Only available after the auth method |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | public function getUser() |
||
122 | |||
123 | /** |
||
124 | * Get the password of the verified user |
||
125 | * |
||
126 | * Only available after the auth method |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | public function getPassword() |
||
134 | } |
||
135 |