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