Skip to content

Commit 7186d17

Browse files
committed
minor symfony#5943 Add tip for when returning null from createToken() (jeroenseegers)
This PR was submitted for the 2.8 branch but it was merged into the 2.7 branch instead (closes symfony#5943). Discussion ---------- Add tip for when returning `null` from `createToken()` | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | symfony#5264 Commits ------- 1337b31 Add caution when returning null from createToken()
2 parents 4ee6cb2 + 1337b31 commit 7186d17

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cookbook/security/api_key_authentication.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ will cause authentication to fail. You might want to return ``null`` instead
109109
to just skip the authentication, so Symfony can fallback to another authentication
110110
method, if any.
111111

112+
.. caution::
113+
114+
In case you return ``null`` from your ``createToken()`` method, be sure to enable
115+
``anonymous`` in you firewall. This way you'll be able to get an ``AnonymousToken``.
116+
112117
2. supportsToken
113118
~~~~~~~~~~~~~~~~
114119

0 commit comments

Comments
 (0)