Conditions | 4 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
62 | public function checkAccessHeader($request) |
||
63 | { |
||
64 | // Both the access header and access header secret must be set for this check to validate |
||
65 | if ($this->accessHeader === null || $this->accessHeaderSecret === null) { |
||
66 | return true; |
||
67 | } |
||
68 | |||
69 | // Fetch the access header from the request |
||
70 | $header = $request->getHeaders()->get($this->accessHeader); |
||
71 | |||
72 | // Allow if the header values match |
||
73 | if (\hash_equals($this->accessHeaderSecret, $header)) { |
||
74 | return true; |
||
75 | } |
||
76 | |||
77 | // Deny by default |
||
78 | return false; |
||
79 | } |
||
80 | } |
||
81 |