@@ -4,7 +4,7 @@ |
||
4 | 4 | 'auth' => [ |
5 | 5 | 'path' => '/api', |
6 | 6 | 'url_whitelist' => [ |
7 | - '/api/auth/login', |
|
7 | + '/api/auth/login', |
|
8 | 8 | ], |
9 | 9 | 'expire' => 3600, |
10 | 10 | 'headers' => [ |
@@ -164,7 +164,7 @@ |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | if (!$this->hasParser($contentType)) { |
167 | - // If not, look for a media type with a structured syntax suffix (RFC 6839) |
|
167 | + // If not, look for a media type with a structured syntax suffix (RFC 6839) |
|
168 | 168 | $parts = expldoe('+', $contentType); |
169 | 169 | |
170 | 170 | if (count($parts) >= 2) { |
@@ -183,7 +183,7 @@ |
||
183 | 183 | */ |
184 | 184 | protected function shouldBeProcessed(ServerRequestInterface $request): bool |
185 | 185 | { |
186 | - //If no route has been match no need check for CSRF |
|
186 | + //If no route has been match no need check for CSRF |
|
187 | 187 | /** @var ?Route $route */ |
188 | 188 | $route = $request->getAttribute(Route::class); |
189 | 189 | if (!$route) { |
@@ -148,8 +148,8 @@ |
||
148 | 148 | )); |
149 | 149 | } else { |
150 | 150 | $this->setHeaders($headers) |
151 | - ->setPayload($payload) |
|
152 | - ->setOriginalToken($token) |
|
151 | + ->setPayload($payload) |
|
152 | + ->setOriginalToken($token) |
|
153 | 153 | ->setEncodedSignature($parts[2]); |
154 | 154 | |
155 | 155 | if (!$this->verify()) { |
@@ -91,12 +91,12 @@ |
||
91 | 91 | public function setValidationRules(): void |
92 | 92 | { |
93 | 93 | $this->addRules('username', [ |
94 | - new NotEmpty(), |
|
95 | - new MinLength(3) |
|
94 | + new NotEmpty(), |
|
95 | + new MinLength(3) |
|
96 | 96 | ]); |
97 | 97 | |
98 | 98 | $this->addRules('password', [ |
99 | - new NotEmpty(), |
|
99 | + new NotEmpty(), |
|
100 | 100 | ]); |
101 | 101 | } |
102 | 102 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | public function getUser(): IdentityInterface |
129 | 129 | { |
130 | 130 | //if (!$this->isLogged()) { |
131 | - // throw new AccountNotFoundException('User not logged', 401); |
|
131 | + // throw new AccountNotFoundException('User not logged', 401); |
|
132 | 132 | //} |
133 | 133 | |
134 | 134 | // $id = $this->session->get('user.id'); |
@@ -223,23 +223,23 @@ discard block |
||
223 | 223 | $expire = $this->config->get('api.auth.expire', 1800); |
224 | 224 | $tokenExpire = time() + $expire; |
225 | 225 | $this->jwt->setSecret($secret) |
226 | - ->setPayload([ |
|
227 | - 'id' => $user->id, |
|
228 | - 'exp' => $tokenExpire, |
|
229 | - ]) |
|
230 | - ->sign(); |
|
226 | + ->setPayload([ |
|
227 | + 'id' => $user->id, |
|
228 | + 'exp' => $tokenExpire, |
|
229 | + ]) |
|
230 | + ->sign(); |
|
231 | 231 | |
232 | 232 | $data = [ |
233 | - 'user' => [ |
|
233 | + 'user' => [ |
|
234 | 234 | 'id' => $user->id, |
235 | 235 | 'username' => $user->username, |
236 | 236 | 'lastname' => $user->lastname, |
237 | 237 | 'firstname' => $user->firstname, |
238 | 238 | 'permissions' => array_unique($permissions), |
239 | - ], |
|
240 | - 'token' => $this->jwt->getToken(), |
|
241 | - 'refresh_token' => '', |
|
242 | - 'expire_at' => $tokenExpire, |
|
239 | + ], |
|
240 | + 'token' => $this->jwt->getToken(), |
|
241 | + 'refresh_token' => '', |
|
242 | + 'expire_at' => $tokenExpire, |
|
243 | 243 | ]; |
244 | 244 | |
245 | 245 | return $data; |