1 | <?php |
||
8 | class VerifyApiToken |
||
9 | { |
||
10 | /** |
||
11 | * The Token instance. |
||
12 | * |
||
13 | * @var \ElfSundae\Laravel\Api\Token |
||
14 | */ |
||
15 | protected $token; |
||
16 | |||
17 | /** |
||
18 | * The URIs that should be excluded from token verification. |
||
19 | * |
||
20 | * @var array |
||
21 | */ |
||
22 | protected $except = []; |
||
23 | |||
24 | /** |
||
25 | * Create the middleware. |
||
26 | * |
||
27 | * @param \ElfSundae\Laravel\Api\Token $token |
||
28 | */ |
||
29 | public function __construct(Token $token) |
||
33 | |||
34 | /** |
||
35 | * Handle an incoming request. |
||
36 | * |
||
37 | * @param \Illuminate\Http\Request $request |
||
38 | * @param \Closure $next |
||
39 | * @return mixed |
||
40 | */ |
||
41 | public function handle($request, Closure $next) |
||
51 | |||
52 | /** |
||
53 | * Determine if the request has a URI that should be passed through verification. |
||
54 | * |
||
55 | * @param \Illuminate\Http\Request $request |
||
56 | * @return bool |
||
57 | */ |
||
58 | protected function inExceptArray($request) |
||
72 | |||
73 | /** |
||
74 | * Verify the api token from request. |
||
75 | * |
||
76 | * @param \Illuminate\Http\Request $request |
||
77 | * @return bool |
||
78 | */ |
||
79 | protected function verifyToken($request) |
||
90 | |||
91 | /** |
||
92 | * Get the app key. |
||
93 | * |
||
94 | * @param \Illuminate\Http\Request $request |
||
95 | * @return string |
||
96 | */ |
||
97 | protected function getKey($request) |
||
101 | |||
102 | /** |
||
103 | * Get the time. |
||
104 | * |
||
105 | * @param \Illuminate\Http\Request $request |
||
106 | * @return int |
||
107 | */ |
||
108 | protected function getTime($request) |
||
112 | |||
113 | /** |
||
114 | * Get the api token. |
||
115 | * |
||
116 | * @param \Illuminate\Http\Request $request |
||
117 | * @return string |
||
118 | */ |
||
119 | protected function getToken($request) |
||
123 | } |
||
124 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.