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
throw new CustomUserMessageAuthenticationException(
73
75
sprintf('API Key "%s" does not exist.', $apiKey)
74
76
);
75
77
}
@@ -90,6 +92,11 @@ value and then a User object is created::
90
92
}
91
93
}
92
94
95
+
.. versionadded:: 2.8
96
+
The ``CustomUserMessageAuthenticationException`` class is new in Symfony 2.8
97
+
and helps you return custom authentication messages. In 2.7 or earlier, throw
98
+
an ``AuthenticationException`` or any sub-class (you can still do this in 2.8).
99
+
93
100
Once you've :ref:`configured <cookbook-security-api-key-config>` everything,
94
101
you'll be able to authenticate by adding an apikey parameter to the query
95
102
string, like ``http://example.com/admin/foo?apikey=37b51d194a7513e45b56f6524f2d51f2``.
@@ -280,7 +287,11 @@ you can use to create an error ``Response``.
280
287
281
288
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
282
289
{
283
-
return new Response("Authentication Failed.", 403);
290
+
return new Response(
291
+
// this contains information about *why* authentication failed
0 commit comments