Skip to content

Commit 5af700b

Browse files
[Security] Add form_only option
1 parent 4d40cfd commit 5af700b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

reference/configuration/security.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,21 @@ failure_path
352352
This is the route or path that the user is redirected to after a failed login attempt.
353353
It can be a relative/absolute URL or a Symfony route name.
354354

355+
form_only
356+
............
357+
358+
**type**: ``boolean`` **default**: ``false``
359+
360+
By setting this option to ``true``, there will be a check the content type, which will prevent the
361+
:class:`Symfony\\Component\\Security\\Http\Authenticator\\FormLoginAuthenticator` from responding to requests
362+
that should be handled by :class:`Symfony\\Component\\Security\\Http\Authenticator\\JsonLoginAuthenticator` (i.e. the
363+
method :method:`FormLoginAuthenticator::supports <Symfony\\Component\\Security\\Http\Authenticator\\FormLoginAuthenticator::supports>`
364+
will return ``false`` if the content type is ``application/json`` and ``true`` for form data).
365+
366+
.. versionadded:: 5.4
367+
368+
The ``form_only`` option was introduced in Symfony 5.4.
369+
355370
use_forward
356371
...........
357372

0 commit comments

Comments
 (0)