Skip to content

Commit 023e5da

Browse files
committed
minor #7067 Update guard_authentication.rst (andreybolonin, javiereguiluz)
This PR was submitted for the 3.1 branch but it was merged into the 2.8 branch instead (closes #7067). Discussion ---------- Update guard_authentication.rst Fixed const usage, array syntax Commits ------- ff729c5 Reverted a change made by mistake 2831204 Added the missing "use" import for the Response class 0582c7c Reverted the short array notation 9c1541e Update guard_authentication.rst
2 parents 5a3b572 + ff729c5 commit 023e5da

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

security/guard_authentication.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ property they use to access their account via the API::
5555

5656
public function getRoles()
5757
{
58-
return ['ROLE_USER'];
58+
return array('ROLE_USER');
5959
}
6060

6161
public function getPassword()
@@ -155,6 +155,7 @@ This requires you to implement six methods::
155155

156156
use Symfony\Component\HttpFoundation\Request;
157157
use Symfony\Component\HttpFoundation\JsonResponse;
158+
use Symfony\Component\HttpFoundation\Response;
158159
use Symfony\Component\Security\Core\User\UserInterface;
159160
use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
160161
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
@@ -213,7 +214,7 @@ This requires you to implement six methods::
213214
// $this->translator->trans($exception->getMessageKey(), $exception->getMessageData())
214215
);
215216

216-
return new JsonResponse($data, 403);
217+
return new JsonResponse($data, Response::HTTP_FORBIDDEN);
217218
}
218219

219220
/**
@@ -226,7 +227,7 @@ This requires you to implement six methods::
226227
'message' => 'Authentication Required'
227228
);
228229

229-
return new JsonResponse($data, 401);
230+
return new JsonResponse($data, Response::HTTP_UNAUTHORIZED);
230231
}
231232

232233
public function supportsRememberMe()

0 commit comments

Comments
 (0)