You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 2.8:
tweaks thanks to the guys
removing deprecation note on a section that was removed
Wrap all strings containing @ in quotes in Yaml
Updating some places to use the new CustomUserMessageAuthenticationException
Added a note about the use of _format query parameter
Always use "main" as the default firewall name (to match Symfony Standard Edition)
// CAUTION: this message will be returned to the client
85
+
// (so don't put any un-trusted messages / error strings here)
86
+
throw new CustomUserMessageAuthenticationException(
84
87
sprintf('API Key "%s" does not exist.', $apiKey)
85
88
);
86
89
}
@@ -101,6 +104,11 @@ value and then a User object is created::
101
104
}
102
105
}
103
106
107
+
.. versionadded:: 2.8
108
+
The ``CustomUserMessageAuthenticationException`` class is new in Symfony 2.8
109
+
and helps you return custom authentication messages. In 2.7 or earlier, throw
110
+
an ``AuthenticationException`` or any sub-class (you can still do this in 2.8).
111
+
104
112
Once you've :ref:`configured <cookbook-security-api-key-config>` everything,
105
113
you'll be able to authenticate by adding an apikey parameter to the query
106
114
string, like ``http://example.com/admin/foo?apikey=37b51d194a7513e45b56f6524f2d51f2``.
@@ -291,7 +299,11 @@ you can use to create an error ``Response``.
291
299
292
300
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
293
301
{
294
-
return new Response("Authentication Failed.", 403);
302
+
return new Response(
303
+
// this contains information about *why* authentication failed
0 commit comments