@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * @throws \ByJG\Config\Exception\KeyNotFoundException |
| 18 | 18 | * @throws \Psr\SimpleCache\InvalidArgumentException |
| 19 | 19 | */ |
| 20 | - public function createToken($properties = []) |
|
| 20 | + public function createToken($properties = [ ]) |
|
| 21 | 21 | { |
| 22 | 22 | $jwt = new JwtWrapper(Psr11::container()->get('API_SERVER'), Psr11::container()->get('JWT_SECRET')); |
| 23 | 23 | $jwtData = $jwt->createJwtData($properties, 1800); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | try { |
| 36 | 36 | $jwt = new JwtWrapper(Psr11::container()->get('API_SERVER'), Psr11::container()->get('JWT_SECRET')); |
| 37 | 37 | $tokenInfo = json_decode(json_encode($jwt->extractData($token)), true); |
| 38 | - return $tokenInfo['data']; |
|
| 38 | + return $tokenInfo[ 'data' ]; |
|
| 39 | 39 | } catch (\Exception $ex) { |
| 40 | 40 | throw new Error401Exception($ex->getMessage()); |
| 41 | 41 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | public function requireRole($role, $token = null) |
| 52 | 52 | { |
| 53 | 53 | $data = $this->requireAuthenticated($token); |
| 54 | - if ($data['role'] !== $role) { |
|
| 54 | + if ($data[ 'role' ] !== $role) { |
|
| 55 | 55 | throw new Error401Exception('Insufficient privileges - ' . print_r($data, true)); |
| 56 | 56 | } |
| 57 | 57 | return $data; |