From 4885240992705088d9dad5fe9aa2bca835da8062 Mon Sep 17 00:00:00 2001 From: Jeroen Seegers Date: Tue, 1 Dec 2015 20:13:58 +0100 Subject: [PATCH] Add caution when returning null from createToken() --- cookbook/security/api_key_authentication.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cookbook/security/api_key_authentication.rst b/cookbook/security/api_key_authentication.rst index 41afcb03bc4..ee721e4894f 100644 --- a/cookbook/security/api_key_authentication.rst +++ b/cookbook/security/api_key_authentication.rst @@ -128,6 +128,11 @@ will cause authentication to fail. You might want to return ``null`` instead to just skip the authentication, so Symfony can fallback to another authentication method, if any. +.. caution:: + + In case you return ``null`` from your ``createToken()`` method, be sure to enable + ``anonymous`` in you firewall. This way you'll be able to get an ``AnonymousToken``. + 2. supportsToken ~~~~~~~~~~~~~~~~