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

Appearance settings

Commit 8ec92f7

Browse filesBrowse files
committed
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
2 parents 90151ef + b36fc32 commit 8ec92f7
Copy full SHA for 8ec92f7

File tree

1 file changed

+9
-5
lines changed
Filter options

1 file changed

+9
-5
lines changed

‎src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface
3939
* Whatever value you return here will be passed to getUser() and checkCredentials()
4040
*
4141
* For example, for a form login, you might:
42-
*
43-
* return array(
44-
* 'username' => $request->request->get('_username'),
45-
* 'password' => $request->request->get('_password'),
46-
* );
42+
*
43+
* if ($request->request->has('_username')) {
44+
* return array(
45+
* 'username' => $request->request->get('_username'),
46+
* 'password' => $request->request->get('_password'),
47+
* );
48+
* } else {
49+
* return;
50+
* }
4751
*
4852
* Or for an API token that's on a header, you might use:
4953
*

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.