minor #19142 [Security] [Guard] Improve comment with working example (pasdeloup)

This PR was squashed before being merged into the 2.8 branch (closes #19142).

Discussion
----------

[Security] [Guard] Improve comment with working example

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Improve the code given in the comment to make it work.
If you follow blindly the previous example (as I did) and never return null, you're stucked in an infinite redirection loop on your login page.

Commits
-------

b36fc32 [Security] [Guard] Improve comment with working example
This commit is contained in:
Fabien Potencier 2016-06-23 09:37:25 +02:00
commit 8ec92f76bc

View File

@ -39,11 +39,15 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface
* Whatever value you return here will be passed to getUser() and checkCredentials()
*
* For example, for a form login, you might:
*
* return array(
* 'username' => $request->request->get('_username'),
* 'password' => $request->request->get('_password'),
* );
*
* if ($request->request->has('_username')) {
* return array(
* 'username' => $request->request->get('_username'),
* 'password' => $request->request->get('_password'),
* );
* } else {
* return;
* }
*
* Or for an API token that's on a header, you might use:
*