Skip to content

Commit 9c1541e

Browse files
andreyboloninxabbuh
authored andcommitted
Update guard_authentication.rst
1 parent 5a3b572 commit 9c1541e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

security/guard_authentication.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ This requires you to implement six methods::
175175
}
176176

177177
// What you return here will be passed to getUser() as $credentials
178-
return array(
178+
return [
179179
'token' => $token,
180-
);
180+
];
181181
}
182182

183183
public function getUser($credentials, UserProviderInterface $userProvider)
@@ -206,27 +206,27 @@ This requires you to implement six methods::
206206

207207
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
208208
{
209-
$data = array(
209+
$data = [
210210
'message' => strtr($exception->getMessageKey(), $exception->getMessageData())
211211

212212
// or to translate this message
213213
// $this->translator->trans($exception->getMessageKey(), $exception->getMessageData())
214-
);
214+
];
215215

216-
return new JsonResponse($data, 403);
216+
return new JsonResponse($data, Response::HTTP_FORBIDDEN);
217217
}
218218

219219
/**
220220
* Called when authentication is needed, but it's not sent
221221
*/
222222
public function start(Request $request, AuthenticationException $authException = null)
223223
{
224-
$data = array(
224+
$data = [
225225
// you might translate this message
226226
'message' => 'Authentication Required'
227-
);
227+
];
228228

229-
return new JsonResponse($data, 401);
229+
return new JsonResponse($data, Response::HTTP_UNAUTHORIZED);
230230
}
231231

232232
public function supportsRememberMe()

0 commit comments

Comments
 (0)