Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php namespace Neomerx\Limoncello\Http\Middleware; |
||
34 | 1 | protected function authenticate(Request $request) |
|
35 | { |
||
36 | 1 | $isAuthenticated = false; |
|
37 | |||
38 | // 7 is a length of 'Bearer ' in Bearer Auth header |
||
39 | 1 | $bearerToken = substr($request->headers->get(self::HEADER_AUTHORIZATION), 7); |
|
40 | |||
41 | // check user authentication |
||
42 | 1 | if ($bearerToken !== false) { |
|
43 | 1 | $authenticateClosure = $this->getAuthenticationClosure(); |
|
44 | 1 | $isAuthenticated = $authenticateClosure($bearerToken); |
|
45 | 1 | } |
|
46 | |||
47 | 1 | return $isAuthenticated; |
|
48 | } |
||
49 | } |
||
50 |