1 | <?php |
||
5 | class StaticBearerTokenRepository implements BearerTokenRepositoryInterface |
||
6 | { |
||
7 | /** |
||
8 | * array |
||
9 | */ |
||
10 | private $validTokens = []; |
||
11 | |||
12 | /** |
||
13 | * Create static bearer token repository. |
||
14 | * You can pass multiple tokens that will be available for your api. |
||
15 | * Format is associtive array where key is token string and value is IP range |
||
16 | * |
||
17 | * Example: |
||
18 | * ['ef0p9iwehjgoihrgrsdgfoihw4t' => '*'] |
||
19 | * |
||
20 | * Or: |
||
21 | * ['asfoihegoihregoihrhgrehg' => '127.0.0.1', 'asfo9uyewtoiyewgt4ty4r' => '*'] |
||
22 | * |
||
23 | * @see BearerTokenAuthorization#isValidIp for all available Ip range formats |
||
24 | * |
||
25 | * @param array $validTokens |
||
26 | */ |
||
27 | 33 | public function __construct($validTokens = []) |
|
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | 21 | public function validToken($token) |
|
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | 21 | public function ipRestrictions($token) |
|
50 | } |
||
51 |