| Conditions | 4 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | public function checkAccessHeader($request) |
||
| 33 | { |
||
| 34 | // Both the access header and access header secret must be set for this check to validate |
||
| 35 | if ($this->accessHeader === null || $this->accessHeaderSecret === null) { |
||
| 36 | return true; |
||
| 37 | } |
||
| 38 | |||
| 39 | // Fetch the access header from the request |
||
| 40 | $header = $request->getHeaders()->get($this->accessHeader); |
||
| 41 | |||
| 42 | // Allow if the header values match |
||
| 43 | if (\hash_equals($this->accessHeaderSecret, $header)) { |
||
| 44 | return true; |
||
| 45 | } |
||
| 46 | |||
| 47 | // Deny by default |
||
| 48 | return false; |
||
| 49 | } |
||
| 51 |