1 | <?php |
||
9 | class PayloadValidator extends AbstractValidator |
||
10 | { |
||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | protected $requiredClaims = ['iss', 'iat', 'exp', 'nbf', 'sub', 'jti']; |
||
15 | |||
16 | /** |
||
17 | * @var integer |
||
18 | */ |
||
19 | protected $refreshTTL = 20160; |
||
20 | |||
21 | /** |
||
22 | * Run the validations on the payload array |
||
23 | * |
||
24 | * @param array $value |
||
25 | * @return void |
||
26 | */ |
||
27 | 18 | public function check($value) |
|
37 | |||
38 | /** |
||
39 | * Ensure the payload contains the required claims and |
||
40 | * the claims have the relevant type |
||
41 | * |
||
42 | * @param array $payload |
||
43 | * @throws \Tymon\JWTAuth\Exceptions\TokenInvalidException |
||
44 | * @return bool |
||
45 | */ |
||
46 | 18 | protected function validateStructure(array $payload) |
|
54 | |||
55 | /** |
||
56 | * Validate the payload timestamps |
||
57 | * |
||
58 | * @param array $payload |
||
59 | * @throws \Tymon\JWTAuth\Exceptions\TokenExpiredException |
||
60 | * @throws \Tymon\JWTAuth\Exceptions\TokenInvalidException |
||
61 | * @return boolean |
||
62 | */ |
||
63 | 12 | protected function validateTimestamps(array $payload) |
|
79 | |||
80 | /** |
||
81 | * Check the token in the refresh flow context |
||
82 | * |
||
83 | * @param $payload |
||
84 | * @return bool |
||
85 | */ |
||
86 | protected function validateRefresh(array $payload) |
||
94 | |||
95 | /** |
||
96 | * Set the required claims |
||
97 | * |
||
98 | * @param array $claims |
||
99 | */ |
||
100 | public function setRequiredClaims(array $claims) |
||
106 | |||
107 | /** |
||
108 | * Set the refresh ttl |
||
109 | * |
||
110 | * @param integer $ttl |
||
111 | */ |
||
112 | public function setRefreshTTL($ttl) |
||
118 | } |
||
119 |