Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit62dcae3

Browse files
committed
Using JsonResponse + cleanup
1 parent440fe6f commit62dcae3

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

‎cookbook/security/guard-authentication.rst

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ This requires you to implement six methods::
149149
namespace AppBundle\Security;
150150

151151
use Symfony\Component\HttpFoundation\Request;
152-
use Symfony\Component\HttpFoundation\Response;
152+
use Symfony\Component\HttpFoundation\JsonResponse;
153153
use Symfony\Component\Security\Core\User\UserInterface;
154154
use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
155155
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
@@ -217,7 +217,7 @@ This requires you to implement six methods::
217217
// $this->translator->trans($exception->getMessageKey(), $exception->getMessageData())
218218
);
219219

220-
return newResponse(json_encode($data), 403);
220+
return newJsonResponse($data, 403);
221221
}
222222

223223
/**
@@ -230,7 +230,7 @@ This requires you to implement six methods::
230230
'message' => 'Authentication Required'
231231
);
232232

233-
return newResponse(json_encode($data), 401);
233+
return newJsonResponse($data, 401);
234234
}
235235

236236
public function supportsRememberMe()
@@ -571,7 +571,3 @@ Frequently Asked Questions
571571
to actually authenticate the user. You can continue doing that (see previous
572572
question) or use the ``User`` object from FOSUserBundle and create your own
573573
authenticator(s) (just like in this article).
574-
575-
*:doc:`Creating a Login Form</cookbook/security/guard-login-form>`
576-
*:doc:`Authenticating with an API Token</cookbook/security/guard-api-key>`
577-
*:doc:`Using Multiple Authenticators (Login form *and* API Token)</cookbook/security/guard-multi>`

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp