| 1 | <?php |
||
| 11 | class OneKeyAccessControl implements AccessControl |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var string |
||
| 15 | */ |
||
| 16 | protected $key; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param string $key |
||
| 20 | */ |
||
| 21 | 4 | public function __construct($key) |
|
| 25 | |||
| 26 | /** |
||
| 27 | * @param \LunixREST\Server\APIRequest\APIRequest $request |
||
| 28 | * @return bool true if key is valid |
||
| 29 | */ |
||
| 30 | 2 | public function validateAccess(APIRequest $request): bool |
|
| 34 | |||
| 35 | /** |
||
| 36 | * @param $apiKey |
||
| 37 | * @return bool true if key is the key specified in the constructor |
||
| 38 | */ |
||
| 39 | 4 | public function validateKey($apiKey): bool |
|
| 43 | } |
||
| 44 |