Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
226 | daniel-mar | 1 | <?php |
2 | |||
3 | # if (!interface_exists('VolcanoAuthProvider')) throw new Exception('Required interface "VolcanoAuthProvider" not found.'); |
||
4 | # if (!class_exists('VolcanoDB')) throw new Exception('Required class "VolcanoDB" not found.'); |
||
5 | |||
6 | require_once __DIR__ . '/../../core/VolcanoAuthProvider.class.php'; |
||
7 | |||
8 | class VolcanoAuthFalse implements VolcanoAuthProvider { |
||
9 | public static function checkId($id) { |
||
10 | return self::strEqual($id, 'false', true); // is always case insensitive |
||
11 | } |
||
12 | |||
13 | public static function checkAuth($candidate, $token) { |
||
14 | return false; |
||
15 | } |
||
16 | |||
17 | protected static function strEqual($str1, $str2, $caseInsensitive = false) { |
||
18 | if ($caseInsensitive) { |
||
19 | return strtolower($str1) == strtolower($str2); |
||
20 | } else { |
||
21 | return $str1 == $str2; |
||
22 | } |
||
23 | } |
||
24 | } |
||
25 | |||
26 | require_once __DIR__ . '/../../core/1_VolcanoDB.class.php'; |
||
27 | VolcanoDB::registerAuthProvider(new VolcanoAuthFalse()); |
||
28 | |||
29 | # --- TEST |
||
30 | |||
31 | /* |
||
32 | $x = new VolcanoAuthFalse(); |
||
33 | assert(!$x->checkAuth('', '')); |
||
34 | */ |
||
35 |