Conditions | 2 |
Paths | 1 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
41 | public function __construct(Router $router, Hook $hook) |
||
42 | { |
||
43 | $router |
||
44 | ->appendRoute(new Route('/api/v2/devices', v2\Devices::class)) |
||
45 | ->appendRoute(new Route('/api/v2/users/{id:#([0-9a-z]{24})#}/request-challenges', v2\RequestChallenges::class)) |
||
46 | ->appendRoute(new Route('/api/v2/creation-challenges', v2\CreationChallenges::class)); |
||
47 | |||
48 | $hook->injectHook(new class() extends AbstractHook { |
||
49 | public function preAuthentication(Auth $auth): void |
||
50 | { |
||
51 | if (preg_match('#^/index.php/api/v2/users/([0-9a-z]{24})/request-challenges#', $_SERVER['ORIG_SCRIPT_NAME'])) { |
||
52 | $auth->injectAdapter(new AuthNone()); |
||
53 | } |
||
54 | } |
||
55 | }); |
||
56 | |||
57 | return true; |
||
|
|||
58 | } |
||
59 | } |
||
60 |