@@ -54,8 +54,7 @@ |
||
54 | 54 | * @class Token |
55 | 55 | * @package Platine\Framework\Auth\Entity |
56 | 56 | */ |
57 | -class Token extends Entity |
|
58 | -{ |
|
57 | +class Token extends Entity { |
|
59 | 58 | |
60 | 59 | /** |
61 | 60 | * {@inheritdoc} |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | public function getUser(): IdentityInterface |
140 | 140 | { |
141 | 141 | //if (!$this->isLogged()) { |
142 | - // throw new AccountNotFoundException('User not logged', 401); |
|
142 | + // throw new AccountNotFoundException('User not logged', 401); |
|
143 | 143 | //} |
144 | 144 | |
145 | 145 | // $id = $this->session->get('user.id'); |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | $expire = $this->config->get('api.auth.token_expire', 900); |
235 | 235 | $tokenExpire = time() + $expire; |
236 | 236 | $this->jwt->setSecret($secret) |
237 | - ->setPayload([ |
|
238 | - 'sub' => $user->id, |
|
239 | - 'exp' => $tokenExpire, |
|
240 | - ]) |
|
241 | - ->sign(); |
|
237 | + ->setPayload([ |
|
238 | + 'sub' => $user->id, |
|
239 | + 'exp' => $tokenExpire, |
|
240 | + ]) |
|
241 | + ->sign(); |
|
242 | 242 | $refreshToken = Str::randomToken(24); |
243 | 243 | $jwtToken = $this->jwt->getToken(); |
244 | 244 | |
@@ -252,15 +252,15 @@ discard block |
||
252 | 252 | $this->tokenRepository->save($token); |
253 | 253 | |
254 | 254 | $data = [ |
255 | - 'user' => [ |
|
255 | + 'user' => [ |
|
256 | 256 | 'id' => $user->id, |
257 | 257 | 'username' => $user->username, |
258 | 258 | 'lastname' => $user->lastname, |
259 | 259 | 'firstname' => $user->firstname, |
260 | 260 | 'permissions' => array_unique($permissions), |
261 | - ], |
|
262 | - 'token' => $jwtToken, |
|
263 | - 'refresh_token' => $refreshToken, |
|
261 | + ], |
|
262 | + 'token' => $jwtToken, |
|
263 | + 'refresh_token' => $refreshToken, |
|
264 | 264 | ]; |
265 | 265 | |
266 | 266 | return $data; |
@@ -55,15 +55,13 @@ |
||
55 | 55 | * @class TokenRepository |
56 | 56 | * @package Platine\Framework\Auth\Repository |
57 | 57 | */ |
58 | -class TokenRepository extends Repository |
|
59 | -{ |
|
58 | +class TokenRepository extends Repository { |
|
60 | 59 | |
61 | 60 | /** |
62 | 61 | * Create new instance |
63 | 62 | * @param EntityManager $manager |
64 | 63 | */ |
65 | - public function __construct(EntityManager $manager) |
|
66 | - { |
|
64 | + public function __construct(EntityManager $manager) { |
|
67 | 65 | parent::__construct($manager, Token::class); |
68 | 66 | } |
69 | 67 | } |